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

feature request: output-specific blocks #38

Open
joshuahhh opened this issue Sep 11, 2022 · 0 comments
Open

feature request: output-specific blocks #38

joshuahhh opened this issue Sep 11, 2022 · 0 comments

Comments

@joshuahhh
Copy link
Collaborator

I'd like to be able to define blocks whose contents render only for a specific output format. Note that this is different from the notation described at https://pandoc.org/MANUAL.html#extension-raw_attribute, because the contents of this block would continue to be Markdown syntax in need of parsing, rather than raw output-specific syntax.

I've partially hacked this in. I use blocks that look like ::: {.html-only}. Then I add special case checks at the top of various output methods. For instance, I put:

if (hasClass(ast, 'html-only')) {
  return undefined;
}

towards the top of tex in tex-format.js.

But this isn't the right place for this check. Really, the first thing the tex-output-specific code should do is go through the AST and prune out these nodes. Problems are caused by delaying this. For instance, the LaTeX image converter goes through the AST to find images to convert. Images inside of ::: {.html-only} blocks should be ignored, but they're not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant