Repository navigation
fix: take the language from the first known class - #84
Merged
Merged
Conversation
Pandoc highlights a block with the first class it knows as a language, but
the language pass read only the first class. A block such as {.terminal .bash}
lost its language to default and was named after terminal. The probe also
took numberLines, number-lines and number for languages, because Pandoc
writes the sourceCode class on any numbered block.
The pass now moves the first class Pandoc can highlight to the front. A block
with none gets default in front of its own classes, so line numbers survive.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The language pass used to read only the first class of a block.
Pandoc highlights with the first class it knows as a language, so a block written
{.terminal .bash}lostbashtodefault, was highlighted as plain text, and was labelledTERMINAL.The pass now moves the first class Pandoc can highlight to the front, so the window name, the code annotations and Pandoc all read the same class.
The probe also stops taking
numberLines,number-linesandnumberfor languages: Pandoc writessourceCodeon any numbered block, so the probe now asks for a language name on thecodetag.A block with no language keeps its own classes and gets
defaultin front, instead of having its first class replaced, so{.numberLines}keeps its line numbers.The new
language-not-firstfixture covers the HTML and Typst output, andtests/run.shpasses with 43 tests.