Closed blegat closed 6 years ago
We'd welcome a pull request to make Bibtex a separate language with its own syntax highlighting.
As of now, there are a few projects I see syntax highlighting for bibtex:
I don't know much javascript, but how would one move this upstream?
Unfortunately, we only support TextMate, Sublime Text, and Atom grammars.
From reading contributing.md and linguist/vendor/README.md, it looks like textmate/latex.tmbundle is the current official TextMate support for LaTeX and BibTex. Looking at that repo, it also seems to have plenty of code/tests on BibTex syntax; commits dating back from 2015. Is there a particular reason syntax highlighting is not being rendered with linguist now?
e.g.:
@incollection{dijkstra1982role,
title={On the role of scientific thought},
author={Dijkstra, Edsger W},
booktitle={Selected writings on computing: a personal perspective},
pages={60--66},
year={1982},
publisher={Springer}}
Is there a particular reason syntax highlighting is not being rendered with linguist now?
Yup, it's because we need a separate language entry for BibTeX. The file you linked to (Bibtex.plist) isn't the one being used for *.bib
files, because *.bib
is listed as a TeX extension, and TeX highlighting is handled using a different grammar.
If we use the Bibtex.plist
file specifically, the output is verrry different:
I've submitted a pull-request that will fix this. See #4584.
If I am not mistaken, currently
.bib
files are reported aslatex
and are not highlighted. I understand that reporting it as LaTeX allows to correctly highlight any LaTeX present in the fields as in the example below with$math$
. However, it would be nice to have a separate language that also adds color highlighting to@book
, ...