ali-rantakari / peg-markdown-highlight

C library for Markdown syntax highlighting, using a recursive-descent parser.
Other
181 stars 36 forks source link

Line indent for lists #9

Closed schriftgestalt closed 8 years ago

schriftgestalt commented 9 years ago

If a list element contains more then one line, the next line should be indented like the first line, leaving the number or bullet at the begging of the line.

ali-rantakari commented 8 years ago

Can you please be more specific about what you're commenting on here? This is a syntax highlighting library — when you talk about “indenting” that confuses me. Are you referring to the simplistic text editor examples?

schriftgestalt commented 8 years ago

It seems that the markdown parser I was comparing to was behaving differently than most others. But I’ll give my example anyway: If you have a list and an item is longer than the line, the second line is indented to the same level then the first (without the bullet or number). If you add one new line in an item the standard implementation would ignore that line break (as the github implementation). But in case of live formatting in an textview, the ignoring is not a good idea. I would like that the next line has the same indentation as the preceding list item.

example:

- this is an item
- this is anther item with a lot text. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
A new paragraph with more text.

This is how it looks:

  • this is an item
  • this is anther item with a lot text. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. A new paragraph with more text.

This should render like this:

  • this is an item
  • this is anther item with a lot text. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.

    A new paragraph with more text.

but without the blank line.

ali-rantakari commented 8 years ago

Thanks for the more clear example. However I think this is a little out of the scope of this project and the text editor highlighting examples — i.e. this is more like something to implement by the authors of Markdown text editors (that may or may not use this library for syntax highlighting.)