Improving syntax highlighting of Fortran code on GitHub

Probably a less important topic, but the syntax highlighting for Fortran on GitHub is just broken. Every time I skim through codes on GitHub I feel bad about this. Most of the F2018 syntaxes are not recognized, variants of function declaration are not recognized, *.fypp are not recognized at all, even some of the legacy codes are not highlighted correctly. The language highlighting of GitHub depends on github/linguist which the Fortran part depends on textmate/fortran.tmbundle. Both of them have unsolved Fortran related issues and the textmate/fortran.tmbundle has not been modified for years (the latest edit shown on GitHub is about 4 years ago). It’s kind of ironic that one the oldest high level languages does not even have a syntax highlighting support on the biggest software development/version control website – in the year of 2022! I sent a message sometime last year to GitHub mentioning this issue but got no replies because apparently my voice is not loud enough. So, I wonder if the Fortran community could do something and maybe make this one of the goals for 2022?


Is it possible to submit a patch to these repositories to fix the issues? I once compiled a list of all Fortran keywords and intrinsic procedure arguments (close to 600 counts) to improve the Doxygen Fortran documenter. I’d be happy to share these and help fix the GitHub syntax recognition of Fortran 2018 if you want to take the lead on this matter.

1 Like

I’d be happy to take the lead and I believe the issue should be very easy to solve because we already have a relatively saying complete *.tmLanguage available in vscode-fortran-support/fortran_free-form.tmLanguage.json. The vscode-fortran-support is under MIT and textmate is under GPLv3, so if maintainers from both repos agree we could just link the file from vscode-fortran-support to textmate? I have very limited experience in managing among multiple GitHub repos so I don’t know if that’s a viable option?

The Carbon App for Twitter also has problems with some Fortran code, discussed here.

Fantastic. I do not know the answers to your licensing questions, unfortunately. The TextMate repository does not seem to list a specific license that is inconsistent with the MIT license.

I just uploaded my Fortran keywords list to this GitHub repository. Doxygen uses the Flex parser, so I had to manually edit and insert all Fortran keywords and new rules to the source files. It did not take more than a few days.

I faced similar issues with the syntax highlighting provided with (neo)vim for Fortran source and started hacking the syntax file to make it look better (GitHub - awvwgk/fortran.vim: Updated syntax highlighting for Fortran in (neo)vim).

Usually the upstream projects are responsive about such contributions, therefore I think it should be straight-forward to get involved with our favorite editor/tool/platform development teams and try to make their Fortran support better for the benefit of all users.


Thanks for making this topic an individual thread! I too have a self-baked xml file (han190/Gtk-Source-View-Bakery ( for text editor and gnome-builder (both of them are GNOME apps). I am planning to polish it a bit more and see if I can make commit to gtksourceview. :slight_smile: