feat!: populate canonical headingLevel on read and clamp write-side levels via the shared helper - #58
Merged
Merged
Conversation
document-schema.js 3.0.0 carries CONTENT_FORMAT_VERSION 3 and defines the canonical ContentParagraph.headingLevel field plus the shared clampHeadingLevel() helper that the heading-level work in this package builds on, so the dependency range moves to ^3.0.0 ahead of that.
…evels via the shared helper
readMarkdown's lowering now records each heading's own #-depth as
ContentParagraph.headingLevel -- document-schema.js's canonical,
format-agnostic depth field -- alongside the existing Heading{N}
styleId, so a consumer that never learned this package's own styleId
spelling still gets the depth as a number. writeMarkdown's clamp of a
Heading{N} styleId deeper than 6 now goes through document-schema.js's
clampHeadingLevel() instead of this package's own private clamp, giving
the ecosystem one heading-range clamp; the md/heading-level-clamped
diagnostic fires exactly as before. headingStyleId,
parseHeadingStyleId, and MAX_HEADING_STYLE_LEVEL stay exported
unchanged for the sibling packages consuming the styleId vocabulary --
only the clamping logic centralises.
Closes #54.
BREAKING CHANGE: readMarkdown's emitted ContentDocuments now carry
CONTENT_FORMAT_VERSION 3 and validate against document-schema.js 3;
consumers still validating against schema 2 must move to 3.
Contributor
|
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes, companion to document-schema.js 3.0.0's canonical
ContentParagraph.headingLevelfield and sharedclampHeadingLevel()helper:lowerHeadingnow records each heading's own#-depth asContentParagraph.headingLevelalongside the existingHeading{N}styleId, so a consumer that never learned this package's own styleId spelling still gets the depth as a number. CommonMark headings are already numbered 1-6 by construction, so no inference is needed.Heading{N}styleId is replaced by document-schema.js'sclampHeadingLevel(), giving the ecosystem one heading-range clamp instead of two. Themd/heading-level-clampeddiagnostic fires exactly as before (both existing tests pass unchanged).headingStyleId,parseHeadingStyleId, andMAX_HEADING_STYLE_LEVELstay exported unchanged — documents.js and the web app consume the styleId vocabulary; only the clamping logic centralises.This is deliberately a breaking major: emitted
ContentDocuments now carryCONTENT_FORMAT_VERSION3, incompatible for consumers still validating on schema 2. The earlier 1.4.1 release shipped the same dependency bump as a patch via the sibling-release automation — that was an oversight of the automation, not a decision; this release states the major the bump always warranted.Closes #54
Generated by Claude Code