Skip to content

Identify type of Markdown item as part of AST? #125

Closed

Description

@gjtorikian

I noticed that, given different types of lists, the AST renders the precise same way. (Example)

That is, given:

* word
* hey

- hey
- word

The AST lists

<list type="bullet" tight="true">

for both types of lists. I would hope that it had mentioned asterisk or dash or something.

@jgm Is there a reason for this? And if not, would you accept a contribution to fix that?

Activity

  1. jgm commented on May 13, 2016

    @jgm
    Member

    I'm not sure about this one. See the discussion at
    http://talk.commonmark.org/t/preserve-bullet-char-in-ast/1108
    It would be helpful if you'd comment there on the discussion
    so far, and say a bit about why you'd like this feature.

    +++ Garen Torikian [May 12 16 14:53 ]:

    I noticed that, given different types of lists, the AST renders the
    precise same way. ([1]Example)

    That is, given:

    • word

    • hey

    • hey

    • word

      The AST lists

      for both types of lists. I would hope that it had mentioned asterisk or
      dash or something.

      [2]@jgm Is there a reason for this? And if not, would you accept a
      contribution to fix that?

      —
      You are receiving this because you were mentioned.
      Reply to this email directly or [3]view it on GitHub

    References

    1. http://spec.commonmark.org/dingus/?text=* word
      • hey
  2. jgm commented on Jun 24, 2016

    @jgm
    Member

    To do this, we'd need to extend the API with something like cmark_node_get_list_bullet or something like that.

    Here's one potential issue I see: suppose we have an HTML -> CommonMark converter (I've written one of these using my lua bindings). If we add bullet types to the AST, then when we're building the AST to match the structure of the HTML document, we need to specify a bullet type of *, +, or - for each unordered list. But of course, there's nothing corresponding to that in HTML.

    Perhaps this is just a minor inconvenience, since you could set this arbitrarily or leave it as its default value.

    I'd be receptive to a PR to add this feature, if you need it in github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions