encoda
encoda copied to clipboard
Add ability to detect programming languages
This is desirable for providing a pleasant syntax highlighting user experience. PrismJS, our choice of syntax highlighting library,b does not support automatic language detection.
This means that if a code block in a markdown file is not annotated with a language, no syntax highlighting will be applied, leading to a poor experience.
We propose trying to detect the language when parsing code blocks if they haven't already been annotate with one.
Additionally,
Because we want to bring in some of the language analysis stuff into
encoda
anyway. e.g indockta
we scan R and Python code for package import statements so we can work out what to put into the Dockerfile I want to move that toencoda
so that it is also available tonixta
... and for compiling other meta data So bringing a js language detection library into encoda makes a lot of sense and filling in language property if it is not there — Nokome Bentley, May 31 17:44
Some relevant links include:
- https://github.com/blakeembrey/node-language-detect
- https://github.com/dachev/node-cld
- https://highlightjs.org/
I think https://github.com/dachev/node-cld is for detecting actual languages not programming languages.