-
Notifications
You must be signed in to change notification settings - Fork 226
store ordered list start index from cmark #22
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
store ordered list start index from cmark #22
Conversation
@swift-ci Please test |
Sources/Markdown/Block Nodes/Block Container Blocks/OrderedList.swift
Outdated
Show resolved
Hide resolved
@@ -24,7 +24,7 @@ enum RawMarkupData: Equatable { | |||
case thematicBreak | |||
case htmlBlock(String) | |||
case listItem(checkbox: Checkbox?) | |||
case orderedList | |||
case orderedList(start: Int?) |
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.
Since this is an API breaking change, this will require a coordinated change with Swift-DocC, right? Is there a way we could introduce the change without requiring the coordination?
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.
Also, I think this could benefit from a default value (orderedList(start: Int? = nil)
)
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.
The RawMarkup
type isn't used in Swift-DocC, so this won't cause source breakage there. The public accessor to the start index is the new start
property on the OrderedList
type.
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.
Looking at this again, this type (RawMarkupData
) isn't public API. Other enum cases don't use a default value; that's enforced via the public Markup
types which wrap RawMarkup
. I don't think it would be useful to include a default value for the list start value here; that comes from cmark.
947261a
to
c63f35b
Compare
Changes: - Removes embedded `cmark` in favour of [`apple/swift-cmark`](https://github.com/apple/swift-cmark) - Removes AST code in favour of [`apple/swift-markdown`](https://github.com/apple/swift-markdown) - Removes DebugVisitor in favour of `document.debugDescription()` from `swift-markdown` - Support tasklist/checkbox Later: - Restore ordered list starts, depends on: swiftlang/swift-markdown#22 - Restore various Down options, depends on: swiftlang/swift-markdown#23
c63f35b
to
1394626
Compare
I've rebased this onto the latest |
cmark will never parse a negative number as a list index, since the hyphen followed by a digit will not parse as a list marker
e81fd9f
to
7e81e97
Compare
@swift-ci Please test |
7e81e97
to
dbc1f77
Compare
Had to update a test after reverting the change to the markup formatter. @swift-ci Please test |
@swift-ci Please test |
0cdc726
to
06115ed
Compare
@swift-ci Please test |
Bug/issue #, if applicable: rdar://73847907
Summary
While cmark-gfm stores the start index for an ordered list, swift-markdown currently discards this information. This PR is part of a set to use this start index when handling ordered lists.
I also added license headers to the markdown in the doc bundle so that
bin/check-source
can pass.Dependencies
None
Testing
With the following markdown test file, ensure that the debug tree properly contains the start index of the list.
Steps:
swift run markdown-tool dump-tree test.md
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded