Skip to content
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

Protect renderers and renderer prototypes #465

Closed
Witiko opened this issue Jul 21, 2024 · 1 comment · Fixed by #506
Closed

Protect renderers and renderer prototypes #465

Witiko opened this issue Jul 21, 2024 · 1 comment · Fixed by #506
Labels
bug expl3 Related to the high-level programming language expl3 tug 2024 Related to the TUG 2024 conference
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Jul 21, 2024

Markdown renderers and renderer prototypes may appear in the table of contents, floats, and notes. Therefore, they should be defined as protected by default.

@Witiko Witiko added bug expl3 Related to the high-level programming language expl3 tug 2024 Related to the TUG 2024 conference labels Jul 21, 2024
@Witiko Witiko added this to the 3.7.1 milestone Jul 21, 2024
@Witiko Witiko modified the milestones: 3.7.1, 3.8.0 Aug 30, 2024
@Witiko Witiko closed this as completed Oct 2, 2024
@Witiko Witiko reopened this Oct 2, 2024
@Witiko Witiko modified the milestones: 3.8.0, 3.9.0 Oct 2, 2024
@Witiko
Copy link
Owner Author

Witiko commented Oct 2, 2024

As shown in the CI from #506, this feature needs more time in the oven, since we don't want to protect renderers that are used outside typesetting such as the renderers used in tests:

image

We would need an interface along the following lines:

  • \markdownSetup{renderers/rendererPrototypes={name/glob (+)= {...}}} defines protected commands by default.
  • \markdownSetup{renderers/rendererPrototypes={!name/glob (+)= {...}}} defines unprotected commands. This would be used in tests and in contexts where the renderers are not used for typesetting and/or need to expand.

Of course, the prefix ! is arbitrary and can be replaced with a more intuitive signifier.

Alternatively, we could also add new top-level keys unprotectedRenderers and unprotectedRendererPrototypes. This would keep us from extending the already-overloaded syntax for renderer (prototype) names / blobs.

On the first glance, we might also want to be able to (un)protect (potentially all) renderers and renderer prototypes in certain scenarios using e.g. \markdownSetup{(un)protectRenderers/RendererPrototypes = {name/glob, name/glob, ...}}. However, since we would likely use different renderers inside and outside typesetting, (un)protecting renderers seems less useful and potentially a source of slow-down. Therefore, I would delay this addition until it is needed.

Furthermore, many default definitions from plain TeX are not protected in #506. We should likely replace all uses of \def, \newcommand, and similar in files markdownthemewitiko_markdown_defaults.tex, markdownthemewitiko_markdown_defaults.sty, and t-markdownthemewitiko_markdown_defaults.tex with \cs_gset_protected:Npn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug expl3 Related to the high-level programming language expl3 tug 2024 Related to the TUG 2024 conference
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant