zopieux / py-gfm

Github-Flavored Markdown for Python-Markdown.
https://pypi.org/project/py-gfm/
BSD 3-Clause "New" or "Revised" License
71 stars 14 forks source link

list indents do not match GFM #10

Open gstein opened 7 years ago

gstein commented 7 years ago

In GFM, it is possible to create a list using 2 or 3 spaces before the '*' bullet indicator. But the Python markdown + py-gfm requires 4 space indents.

GFM spec on indent is at https://github.github.com/gfm/#list-items

zopieux commented 7 years ago

I don't understand what you mean by py-gfm requiring 4 space indents. Are you speaking about nested lists?

By the way, thanks for pointing out the formal spec of GFM. Their input/output examples would constitue very useful test vectors. I'll look into it for integration into this project.

gstein commented 7 years ago

Ah, sorry I wasn't clear. Yes, nested lists.

I have some markdown that looks like:

  1. Foo

    • bar

Note that there are (3) spaces before the asterisk, and GitHub properly creates a nested list. The lists do not nest properly when using py-gfm. I need to add a fourth space.

zopieux commented 7 years ago

Thanks for the clarification. Will look into it.

stephenpcook commented 6 years ago

A solution approach is suggested in https://github.com/mkdocs/mkdocs/issues/545#issuecomment-322649208

stuaxo commented 5 years ago

The comment further down is interesting too -

@PegasusWang Solved. Add "mdx_truly_sane_lists" to you requirements.txt or pip install mdx_truly_sane_lists.

Then edit your mkdocs.yml like this:

markdown_extensions:
  - mdx_truly_sane_lists
zopieux commented 4 years ago

I can confirm py-gfm behavior does not match cmark-gfm but fixing it would be a pain. Even mdx_truly_sane_lists does not correctly handle scenarios like

* foo
  * bar
  1. numbered

I did not attempt to fix it for 1.0.0. I think this level of conformance with GFM should rather be implemented through cmark-gfm bindings such as cmarkgfm.