fix(stringify): render ordered-list start as native numbering#255
Merged
farnabaz merged 2 commits intoJun 30, 2026
Merged
Conversation
An ordered list with a non-1 `start` (e.g. `5. 6. 7.`) round-tripped to the
verbose `::ol{start="5"}\n1. …\n::` wrapper instead of native markdown
numbering. `ol.ts` hardcoded the item counter to `order: 1`, and nothing
marked `start` as implicit, so `userBlockAttrs('ol', …)` treated it as a real
user attr and forced the `::ol{…}` block form.
Seed the counter from `start` and add `ol: { drop: ['start'] }` to
`IMPLICIT_ATTRS` so `start` is recognized as conveyed by the native syntax.
Now `5. 6. 7.` round-trips losslessly, and a legacy `::ol{start="…"}` wrapper
normalizes to clean native numbering. Genuine non-`start` attrs still wrap.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@hendrikheil is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
comark
@comark/angular
@comark/ansi
@comark/html
@comark/nuxt
@comark/react
@comark/svelte
@comark/vue
commit: |
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.
Problem
An ordered list with a non-1
startround-tripped to the verbose::ol{…}block form instead of native markdown numbering:The same path means a legacy
::ol{start="…"}wrapper (e.g. one written by an older renderer) never normalizes back to a plain list — it stays an MDC component block. AST and HTML were already correct; only the Markdown round-trip was affected.Root cause
handlers/ol.tshardcoded the item counter toorder: 1, and nothing markedstartas implicit. SouserBlockAttrs('ol', { start })treatedstartas a genuine user attr and forced the::ol{…}wrapper form, losing the native numbering.Fix
handlers/ol.ts: seed the item counter fromstart(order = start >= 1 ? start : 1) so native numbering carries it.stringify/attributes.ts: addol: { drop: ['start'] }toIMPLICIT_ATTRS, sostartis recognized as conveyed by the native syntax and never echoes into a wrapper.Result (idempotent)
5. 6. 7.→ round-trips as native5. 6. 7.::ol{start="3"}\n1. …\n::→ normalizes to native3. 4. …::ol{start="undefined"}\n1. …\n::→ heals to clean1. 2. 3.::ol{attr="value"}(a genuine non-startattr) → still wraps (unchanged)Tests
Two new SPECs (
common-mark/ordered-list-start.md,COMARK/ordered-list-start-wrapper-normalizes.md); full suite 1084 passing. The #214 attribute specs (attributes/ordered-list.md,attributes/wrapped-ol.md) stay green.🤖 Generated with Claude Code