Default language for code snippets changed?

I have just noticed that raw ``` starts a block of code not interpreted as Fortran any more.

program main 
 character(len=*), parameter :: str="first part &
    & second part"
  print '(a)', str     
end program main
! outputs: first part second part

One has to explicitly start with ```fortran to get the proper output

program main
 character(len=*),parameter :: str2="first line" // new_line('a') // "second &
    &line"
  print '(a)', str2
end program main
2 Likes

There is no default language as far as I can see, rather the language is guessed in case no hint or an unknown hint is provided, this heuristic depends very much on the enabled language and the implementation in the highlighting plugin. In most cases the snippets are correctly identified as Fortran, but not always.

2 Likes

I see. As it has always worked (recognizing my Fortran snippets without a hint), I thought it was the default, which would not be a bad idea on a Fortran Discourse, anyway.
BTW, what is the proper hint for C snippets? The following gets properly prettyfied with just raw ``` but fails to do it either with c or C hint. Strange.

#include <stdio.h>
int i=1;
printf("%d\n",i);
while (i<5) { printf("%d\n",++i); }

I think only cpp is enabled for highlighting at the moment. I enabled c as well now.

2 Likes

Thanks! I was using cpp for quite a while now, to highlight C snippets too.