Replies: 1 comment
-
In the syntax extension we discussed today with @xvrabcov, the renderer and renderer prototype definitions would be specified as comma-separated lists of globs, where a glob is a name of a renderer or renderer prototype with optional asterisks that match zero or more characters. Here are some examples: \markdownSetup{
renderers = {
headingOne = {...}, # Redefines the top-level heading. (Backwards compatibility)
{headingOne, headingTwo, headingThree} = {...}, # Redefines the first three levels of headings. (Enumeration)
heading* = {...}, # Redefines all levels of headings. (Wildcards)
}
} Between the list of globs and the equal sign ( \markdownSetup{
renderers = {
headingOne ^= {...}, # Prepends code to the top-level heading. (Prepending and appending)
headingOne $= {...}, # Appends code to the top-level heading. (Prepending and appending)
headingOne {^some code} = {}, # Removes code from the beginning of a definition. (Patching)
headingOne {^(.*)$} = {... \1 ... \1 ...}, # Repeats the definition twice and interleaves it with code. (Matching)
}
} The syntax extension satisfies all the desiderata. It is unclear whether a failure to patch or match should produce a warning or an error. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment, the
\markdownSetup
LaTeX command allows the redefinition of individual renderers and renderer prototypes. This has several shortcomings:It makes sense to consider these shortcomings together rather than in isolation. For example, redefining all six levels of headings to behave the same is seldom useful, but prepending or appending the same code to all six levels of headings or all ordered, unordered, and definition lists is a common pattern.
Here are some possible desiderata for a syntax extension to
\markdownSetup
:\markdownSetup
should stay valid and keep its current meaning.Requires Add reflection to the TeX implementation #119.
This thread will list some of the ideas for the syntax extensions and outline which desiderata they satisfy.
Beta Was this translation helpful? Give feedback.
All reactions