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

🧮 Numbering improvements for custom containers #790

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Conversation

rowanc1
Copy link
Collaborator

@rowanc1 rowanc1 commented Nov 30, 2023

This opens up the numbering dictionary to any item, and also allows figure directives (and notebook cells) to set the kind of a container directly. The two of these combined allow for numbering and referencing of custom container types.

@rowanc1 rowanc1 requested a review from fwkoch November 30, 2023 02:36
@rowanc1 rowanc1 merged commit 4846c7f into main Nov 30, 2023
4 checks passed
@rowanc1 rowanc1 deleted the feat/numbering branch November 30, 2023 04:16
obj,
{ optional: [...NUMBERING_KEYS, ...NUMBERING_OPTIONS], alias: NUMBERING_ALIAS },
// Do not add warnings on this filter process
{ property: '', messages: { errors: [], warnings: [] }, keepExtraKeys: true },
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can also use suppressErrors/suppressWarnings - which will just prevent logging entirely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #794.

HEADING_KEYS.forEach((headingKey) => {
if (headings && !defined(value[headingKey])) {
// This will be validated next!
value[headingKey] = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

export const NUMBERING_OPTIONS = ['enumerator', 'headings'];

const HEADING_KEYS = ['heading_1', 'heading_2', 'heading_3', 'heading_4', 'heading_5', 'heading_6'];
export const NUMBERING_KEYS = ['figure', 'equation', 'table', 'code', ...HEADING_KEYS];
Copy link
Collaborator

Choose a reason for hiding this comment

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

And then I guess this just works with the enumerate transform, since it already increments count based on kind. Nice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I was impressed at how much of this already just worked and all we needed to do was to be less strict in validation!

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