-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
obj, | ||
{ optional: [...NUMBERING_KEYS, ...NUMBERING_OPTIONS], alias: NUMBERING_ALIAS }, | ||
// Do not add warnings on this filter process | ||
{ property: '', messages: { errors: [], warnings: [] }, keepExtraKeys: true }, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
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.