fix(storage-walker): honor <ol start> in storage → markdown - #246
Merged
Merged
Conversation
Number ordered lists from the start attribute instead of always 1. Values markdown cannot express (negative, non-integer, or a run that would exceed CommonMark's 9-digit marker) fall back to 1. Only an ordered list starting at 1 may interrupt a paragraph, so a list with another start is now separated by a blank line after inline text, after a nested item's lead-in paragraph, and after a callout header. Headings, thematic breaks and code fences cannot absorb the list, so nested lists stay tight after them. Markdown → storage already emits start via markdown-it, so round trips now keep the numbering. Fixes #241
…t's leading list Also stop at leading prose text so it is not mistaken for a list, and add round-trip coverage for code-first items, the nine-digit limit with empty items, tight lists after headings and fences, and start="0".
8 of 15 tasks
# Conflicts: # lib/storage-walker.js # tests/macro-converter.test.js
|
🎉 This PR is included in version 2.25.6 🎉 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.
Pull Request Template
Description
Storage → markdown now numbers ordered lists from
<ol start>instead of always starting at 1.now becomes
3. three\n4. four(it used to be1. three\n2. four).startvalue that markdown cannot express falls back to 1. That covers negative, signed, non-integer and empty values, and runs whose last number would go past999999999. Leading zeros and surrounding whitespace are ignored, andstart="0"is kept. Empty<li>items still don't use up a number.- Parent\n 3. Childis parsed as the single paragraphParent 3. Child. A list with any other start is therefore separated by a blank line in three places:Steps:<ol start="3">…);> **INFO**\n>\n> 3. a). This uses a structural check that skips empty or comment nodes, looks through transparent wrappers (div,p,span,ac:layout*), and stops at leading prose, so a paragraph<p>3. a</p>or text like3. fakeis not affected.marker.length, so9.→10.indents nested content by 4 automatically.start, through markdown-it plus html-to-storage's attribute pass-through. Round trips md → storage → md → storage are now stable, and tests cover them.Type of Change
Testing
npx jest: 39 suites and 1363 tests pass (after merging currentmain, including #247, #249 and #250).npx eslint lib testsis clean. The new tests intests/macro-converter.test.js("ordered list start (#241)") check exact output withtoBe, including exact storage in the round-trip cases.Checklist
Additional Context
Follow-up to #238 / #239. The callout header separator is built on #249's
quoteLines. These are known and left out of scope:<ol>…</ol><ol>…</ol>is read back as one markdown list, so the second list'sstartis lost. This already happens onmainwith plain<ol>s.reversed: markdown has no way to express this attribute.lib/html-to-markdown.js, a separate converter, also ignoresstart. That is left for a follow-up.Fixes #241