🏷️ Render span identifiers as Typst labels#2698
Conversation
update span renderer to include node identifiers as Typst tags
🦋 Changeset detectedLatest commit: ca6b214 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This looks good! Could you add a few test cases as well, they should be in the |
packages/myst-to-typst/src/index.ts
Outdated
| span(node, state) { | ||
| state.renderChildren(node, 0, { trimEnd: false }); | ||
| if (node.identifier) { | ||
| state.write(` <${node.identifier}>`); |
There was a problem hiding this comment.
For a span, do we want the #label("${node.identifier}") syntax?
I am not sure...
https://typst.app/docs/reference/foundations/label
For example, if you have a labeled span in a header (silly, but maybe illustrative).
|
@rowanc1 thanks for the review! I have added some test cases, and changes the typst syntax to #label() as I thought it made more sense. You were right about a labeled span in a header potentially breaking things, which is solved now. I'm still getting familiar with typst, so if you have any other comments please let me know! |
|
@rowanc1 can you check whether all comments have sufficiently be addressed? Thnx in advance! (Luuk has not much time left on working on the project, hence the request) |
rowanc1
left a comment
There was a problem hiding this comment.
Looks good, will wait for tests to go green then get this merged.
update span handler to include node identifiers as Typst tags, which allows {index} to render properly.