Add exposing list markers *, -, +, or numeric to AST and API.#226
Open
nathanaschbacher wants to merge 1 commit intocommonmark:masterfrom
Open
Add exposing list markers *, -, +, or numeric to AST and API.#226nathanaschbacher wants to merge 1 commit intocommonmark:masterfrom
nathanaschbacher wants to merge 1 commit intocommonmark:masterfrom
Conversation
Prior to this commit the node struct for a list contained a member to store whatever char was parsed from the markdown, but this value wasn't exposed through the API, nor was it made available in the output of the AST in any format. Following this commit a `cmark_marker_type` struct has been added to capture various forms of list markers: `CMARK_NUMERIC_MARKER` (for ordered lists) and `CMARK_ASTERISK_MARKER`, `CMARK_HYPHEN_MARKER`, & `CMARK_PLUS_MARKER` (for unordered lists). The value of which is stored in the `marker` member of the `cmark_list` node struct. This enables two primary features: 1. The bullet marker types are now preserved when converting from markdown to markdown. 2. The XML representation of the AST now has a `marker="hyphen"` (as well as numeric, asterisk, and plus) as an attribute on the list nodes. This is similar to the `delim="period"` attribute available on ordered list nodes. Tests have been added and are passing. The original test suite still passes as well. This commit also updates the racket-lang wrapper to support these new features as well as fixes a minor bug for a missing `no_delim` symbol because `NO_DELIM` wasn't defined in cmark.h
Author
|
I also have a similar branch that doesn't create the concept of a "marker" and instead just overloads the "deliminator" concept to include Likewise for a version that doesn't bother to convert to a term and just keeps the syntax, like |
|
Could there be a review/consideration for this? |
QuietMisdreavus
pushed a commit
to swiftlang/swift-cmark
that referenced
this pull request
Dec 29, 2021
Move CI build over to Actions, per `@jgm`'s upstream work.
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.
Prior to this commit the node struct for a list contained a member to
store whatever char was parsed from the markdown, but this value
wasn't exposed through the API, nor was it made available in the
output of the AST in any format.
Following this commit a
cmark_marker_typestruct has been added tocapture various forms of list markers:
CMARK_NUMERIC_MARKER(forordered lists) and
CMARK_ASTERISK_MARKER,CMARK_HYPHEN_MARKER, &CMARK_PLUS_MARKER(for unordered lists). The value of which isstored in the
markermember of thecmark_listnode struct.This enables two primary features:
markdown to markdown.
marker="hyphen"(aswell as numeric, asterisk, and plus) as an attribute on the list
nodes. This is similar to the
delim="period"attribute available onordered list nodes.
Tests have been added and are passing. The original test suite still
passes as well. This commit also updates the racket-lang wrapper to
support these new features as well as fixes a minor bug for a missing
no_delimsymbol becauseNO_DELIMwasn't defined in cmark.hIf you'd like to see examples of the different results of running this through the updated
cmarkexecutable, then take a look at this Gist: https://gist.github.com/nathanaschbacher/93f45e938aef671a07e8c9f8850115cfFinally, this should close issue #225 that I opened earlier today.
Cheers!