Skip to content
This repository has been archived by the owner on Jul 30, 2023. It is now read-only.

list indents do not match GFM #10

Open
gstein opened this issue Oct 23, 2017 · 6 comments
Open

list indents do not match GFM #10

gstein opened this issue Oct 23, 2017 · 6 comments

Comments

@gstein
Copy link

gstein commented Oct 23, 2017

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
Copy link
Owner

zopieux commented Oct 23, 2017

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
Copy link
Author

gstein commented Oct 23, 2017

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
Copy link
Owner

zopieux commented Oct 23, 2017

Thanks for the clarification. Will look into it.

@stephenpcook
Copy link

A solution approach is suggested in mkdocs/mkdocs#545 (comment)

@stuaxo
Copy link

stuaxo commented Oct 9, 2019

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
Copy link
Owner

zopieux commented Jul 26, 2020

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.

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

No branches or pull requests

4 participants