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

🔢 Add enumeration options to common directives #1477

Merged
merged 6 commits into from
Aug 22, 2024
Merged

Conversation

rowanc1
Copy link
Collaborator

@rowanc1 rowanc1 commented Aug 21, 2024

This adds enumerated / enumerator (aliased as numbered / number) to all common directives (code, figures, etc.). This allows for things like turning off enumeration for a specific figure / equation as well as taking control of numbering completely.

In a recent example, we had to create a figure with a specific number S5 and then carry on numbering as usual.

This also introduces some places to centralize directive option logic - which we could extend to classes in the future.

Copy link

changeset-bot bot commented Aug 21, 2024

🦋 Changeset detected

Latest commit: a165d36

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

This PR includes changesets to release 7 packages
Name Type
myst-directives Patch
myst-transforms Patch
myst-parser Patch
mystmd Patch
myst-roles Patch
myst-to-html Patch
myst-cli 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

Copy link
Contributor

@agoose77 agoose77 left a comment

Choose a reason for hiding this comment

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

I like the refactoring of options for directives. We should extend this to class in the future.

docs/cross-references.md Outdated Show resolved Hide resolved
@rowanc1
Copy link
Collaborator Author

rowanc1 commented Aug 22, 2024

Yes - I purposely left class out as there is some extra work to do on the UI side to actually make that possible. But I think the pattern is good (and easy) to follow!

Copy link
Collaborator

@fwkoch fwkoch left a comment

Choose a reason for hiding this comment

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

This looks good - relies on the fact that we already respect enumerated flag. I like the shared option refactor.

},
...labelDirectiveOption('blockquote'),

// TODO: Add enumeration in future
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good that we are not adding enumerator on places where we do not number stuff yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking forward to being able to number everything ... !

packages/myst-directives/src/mermaid.ts Outdated Show resolved Hide resolved
@rowanc1 rowanc1 merged commit 88396dd into main Aug 22, 2024
7 checks passed
@rowanc1 rowanc1 deleted the feat/enumerate branch August 22, 2024 20:22
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.

3 participants