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

Pandoc Typst property thoughts #9955

Open
wlupton opened this issue Jul 5, 2024 · 0 comments
Open

Pandoc Typst property thoughts #9955

wlupton opened this issue Jul 5, 2024 · 0 comments

Comments

@wlupton
Copy link
Contributor

wlupton commented Jul 5, 2024

(The first part of this background discussion. The proposal is marked PROPOSAL below.)

A while back I created #8988. It considered this example markdown:

::: note
This is a note.
:::

and one idea was that this could become Typst code like this:

#note[This is a note.]

This will only work if a Typst note function has been defined, so @jgm suggested that only special classes, e.g., starting typst-, might be passed through to Typst. A lua filter might convert the note class to typst-foo-note (where foo is a prefix that acts as a namespace) and the emitted Typst code might be this:

#foo-note[This is a note.]

I have been doing something like this for a while, using a custom writer. It will output this:

#bbf-note[
This is a note.
]

If there are multiple classes the calls are nested, e.g., this:

::: {.note .gray}
Another note.
:::

outputs this:

#bbf-gray[
#bbf-note[
Another note.
]]

PROPOSAL

I'd prefer to use the built-in Typst writer, so I took a look at Pandoc Typst properties. They don't seem to designed to call styling functions such as my bbf-note but I wonder whether they could be extended to do so.

I believe that they currently only use key=value attributes, and not classes, so potentially a typst:func class could specify a function to be used in place of the element that would otherwise be used (nothing for span, block for div, table for table etc.). This:

::: {typst:breakable=false}
div
:::

currently outputs this:

#block(breakable: false)[
div

]

and this:

::: {typst:bbf-note typst:breakable=false}
div
:::

would output this:

#bbf-note(breakable: false)[
div

]

Does this sound like a reasonable idea? If so, I'd be happy to make a more complete proposal.

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

No branches or pull requests

1 participant