SublimeText-Markdown / MarkdownEditing

Powerful Markdown package for Sublime Text with better syntax understanding and good color schemes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use pygments for syntax highlighting in code block

ncarboni opened this issue · comments

While the list of supported languages for code blocks is quite long, some are still missing (ex: SPARQL).
I was wondering it if it is possible to use pygments as syntax highlighter instead (or other ones).

Alternatively, as the syntax of some of the language I used are already available for ST, do any know of any guide on how to add them to MarkdownEditing? I would love to use them in code blocks.

Highlighting text/source fully relies on ST's syntax engine. It is not possible to use pygments, tree-sitter or any other highlighting engine.

What is needed to highlight fenced code blocks, is:

  1. a syntax definition that ST understands (e.g.: <Name>.sublime-syntax)

  2. a context in Markdown.sublime-syntax which embeds that syntax.

    e.g.: https://github.com/SublimeText-Markdown/MarkdownEditing/blob/38bb41157433808ff265d5298edfd40f202804a1/syntaxes/Markdown.sublime-syntax#L1846C1-L1866

Thank you! I will make some tests and, If I manage to make something work, I will do a pull request