Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
馃憣 IMPROVE: Code block highlighting (#478)
In markdown a code block (a.k.a fence) is of the form: ````markdown ```language source text ``` ```` MyST-Parser mimics the `code-block` directive to render these blocks: In sphinx, the lexer name is only recorded as the `language` attribute, and the text is lexed later by pygments within the `visit_literal_block` method of the output format ``SphinxTranslator``. This is the current logic. However, in docutils, this directive directly parses the text with the pygments lexer, if syntax highlighting is enabled (the default). This was not handled. Both cases are now handled, and additionally the following configuration are added: - `myst_highlight_code_blocks` (docutils only): If True (default) use pygments to create lexical tokens for the given language, otherwise skip lexical analysis - `myst_number_code_blocks`: A list of languages to add line numbers to
- Loading branch information
1 parent
6c44075
commit 2b3a931
Showing
18 changed files
with
1,124 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.