Skip to content
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

Allow lists without a leading blank line to be rendered as lists (GitHub flavored) #224

Open
depryf opened this issue Feb 3, 2016 · 2 comments

Comments

@depryf
Copy link

depryf commented Feb 3, 2016

Maybe there is already a way to do this, but I didn't find it in the current extensions.

The regular markdown (not GitHub flavored) requires an empty line between a sentence and the start of a list:

This is a sentence

- list item 1
- list item 2

The following in regular markdown (and in pegdown) doesn't render the list items in a list:

This is a sentence
- list item 1
- list item 2

In GitHub it does.

Is there currently a way to achieve the same behavior as in GitHub?

@vsch
Copy link
Contributor

vsch commented Dec 13, 2016

@depryf, there is no way to do it in pegdown and no easy way without risking breaking a lot of parser rules.

The difficulty in maintaining and modifying pegdown parser was one of the reasons I rewrote commonmark-java to replace pegdown in my Markdown Navigator plugin for IntelliJ IDEs: https://github.com/vsch/idea-multimarkdown. The parser project is https://github.com/vsch/flexmark-java has very detailed source based AST with source offset for every part of the element. I need that for syntax highlighting and other plugin source reliant features.

It is CommonMark 0.27 (GitHub Comments) compliant but In the last release I added list parsing options to emulate list indentation rules used by: markdown.pl, MultiMarkdown (like pegdown 4 space indents) and kramdown (GitHub Docs). The only extensions that pegdown has that I did not yet implement are: typographic quotes, smarts and definition lists. The rest of the extensions are available, with some extra ones that pegdown does not have.

As an added bonus and what motivated me to switch the parsing is 30-50x faster than pegdown on average documents and several thousand times faster on pegdown's pathological input like [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[.

The AST offsets are bug free and regular. It is also fully modifiable unlike pegdown's with next, prev and parent links.

@depryf
Copy link
Author

depryf commented Dec 13, 2016

Thank you for the answer. I guess this issue can be closed then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants