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

typst,table - support '.typst-no-figure' and 'typst-figure-kind=kind' #9778

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cscheid
Copy link
Contributor

@cscheid cscheid commented May 20, 2024

This is intended to close #9777 in a configurable way.

It also supports a slight generalization of the solution in #9574 by enabling control of the kind parameter for #figure().

I didn't know how to add classes and attributes to a plain markdown table in a clean way and so I used a Lua filter for that, but of course that can be changed if there's a better way to do it.

EDIT: I see that the test failure comes from CI on windows building Pandoc without Lua support. I'm going to change the tests to provide native input.

@cscheid cscheid changed the title typst,table - support 'typst-no-figure' class and 'typst-figure-kind' attribute typst,table - support '.typst-no-figure' and 'typst-figure-kind=kind' May 20, 2024
@cscheid cscheid force-pushed the bugfix/9777 branch 2 times, most recently from 6e740a2 to 6cd4100 Compare May 20, 2024 20:23
Repository owner deleted a comment May 20, 2024
return $ case Data.List.find (== "typst-no-figure") tabclasses of
return $ case Data.List.find (== "typst:no-figure") tabclasses of
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's more straightforward to use a boolean test here: if "typst:no-figure" elem tabclasses

@jgm
Copy link
Owner

jgm commented May 31, 2024

Something should be added to doc/typst-property-output.md describing these new features. That will also help me think about them.

@cscheid
Copy link
Contributor Author

cscheid commented May 31, 2024

Something should be added to doc/typst-property-output.md describing these new features. That will also help me think about them.

Ok, I've added some. On doing so, I'm now wondering if this PR should additionally support a typst:figure:supplement attribute that controls the supplement: https://typst.app/docs/reference/model/figure/ Otherwise, the only supported typst:figure:kind values would be raw, image, and table (and table itself is of course not very useful)

In addition to that, I now think the handlers for the Image and Figure nodes should support the same features. Consider, for example:

$ pandoc -f markdown -t typst
![Hello](./foo.png)
^D
#figure(image("./foo.png"),
  caption: [
    Hello
  ]
)

The same considerations that applied for Table apply to the Figure node as well. (I don't think Pandoc natively supports captions in code blocks, but if it ever does, it would be a reason to use raw as the figure kind in Typst)

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

Successfully merging this pull request may close these issues.

Typst - do not hardcode #figure() in Table writer?
2 participants