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

🖐 Support restarting counter for each typst article in multi-article export #1741

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Jan 9, 2025

For the most part, typst handles its own numbering. This PR forces typst to reset numbering where myst resets numbering. However, the way this PR determines where numbering resets is by looking at the enumerator - if this value is customized with template to not look like #.#.#, this counter reset will not happen...

(This is a small part of the changes originally in #1701)

Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: b784a04

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
myst-to-typst Patch
myst-cli Patch
mystmd Patch

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

@@ -104,6 +104,11 @@ export const containerHandler: Handler = (node, state) => {
return;
}

if (node.enumerator?.endsWith('.1')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There should be a better way to do this... But it's not simple, since myst-to-typst is taking a fully-processed tree, it's lost some of the intermediate knowledge of how things are counted, and just has the final results.

Doing something like stashing the entire numbering object on each enumerated node could work, but that feels yucky. Maybe there is a happy medium?

But for now, I think the existing shortcut in this PR is ok. It handles default enumerators.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment to this line with that?

@rowanc1 rowanc1 merged commit 9457a8d into main Jan 9, 2025
7 checks passed
@rowanc1 rowanc1 deleted the typst/counter-restart branch January 9, 2025 18:10
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.

2 participants