-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support bulk and partial redefinitions in the \markdownSetup
plain TeX command
#232
Comments
Discussed in #121Originally posted by Witiko March 5, 2022 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. |
Patching and matching seem both very situational and signlificantly more difficult to implement than the rest, especially since they involve specifying regular expressions ( Dropping patching and matching for now, here is a simple parser of the extended syntax for definitions: https://www.overleaf.com/read/ztzjgtnkkwdx |
Support for enumeration makes things a bit more difficult in combination with prepending, appending, and matching, because the implementation must take care that we always change a renderer only once even if it is duplicated by the user. However given the lack of support for O(1) sets in expl3, this seems as a bit of a headache. Perhaps we can also drop enumeration for now, support just wildcards in 2.23.0, and revisit this in the future. |
In milestone 3.5.0, we should implement prepending ( |
\markdownSetup
LaTeX command\markdownSetup
plain TeX command
Discussed in #121
Originally posted by Witiko March 5, 2022
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.
The text was updated successfully, but these errors were encountered: