Markup: Render: 2 vs 4 white spaces in markdown lists

Created on 2 Jan 2018  路  7Comments  路  Source: github/markup

Please read my original issue here: https://github.com/lsegal/yard/issues/1155

TL;DR : markdown list are rendered normally when using 4 white spaces but not when using 2 white spaces as indentation.

Wrong behaviour

makrdown (2 spaces):

+ 1st
  + 2nd
    + 3rd

render:

$ github-markup test.md 
<ul>
<li>1st

<ul>
<li>2nd</li>
<li>3rd</li>
</ul></li>
</ul>

Right behaviour

markdown (4 spaces):

+ 1st
    + 2nd
        + 3rd

render:

$ github-markup test.md
<ul>
<li>1st

<ul>
<li>2nd

<ul>
<li>3rd</li>
</ul></li>
</ul></li>
</ul>

Expected behaviour

2 spaces should renders the same as 4 spaces.

Environment details:

  • OS: Antergos
  • Ruby version (ruby -v): ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
  • Relevant gems dependency/versions:

    • github-markup (1.6.2, 1.6.1)

    • redcarpet (3.4.0)

All 7 comments

Please see #1014; this is expected behaviour. Additionally, please contact the support team for future questions of this kind; this isn't the correct venue.

@kivikakk The answer in #1014 doesn't have sens because it's say on the README:

This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com:

  1. This library converts the raw markup to HTML. See the list of supported markup formats below.

But rendering with 2 spaces is correctly done on GitHub.com.

The proof here:

  • 1st

    • 2nd

    • 3rd

So GitHub.com is not using its own github/markup ?

And the GMF specs tell us that 2 spaces indentation is correct !
There is even an example with exactly what I tell:

@kivikakk when I read this document (via):

the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item.

This seems to indicate that the example by @noraj1337 is not behaving to specification. List items using a one character list marker and one space separator should allow following items to be indented with two additional spaces preceding their list marker.

It is particularly confusing that "2nd" indents correctly but "3rd" does not.

You need to have the commonmarker library installed; github/markup selects an installed library and uses that. If you've upgraded from or are using an older version, it might be using redcarpet instead, as you've indicated is installed. I think redcarpet is formatting your Markdown incorrectly locally, which is why you're seeing what you are.

This looks more like the right answer.
I uninstalled redcarpet and installed and now have the good behaviour.
Thx @kivikakk. I was using redcarpet because it was the default recognized by yard.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kalkin picture kalkin  路  3Comments

schmidtw picture schmidtw  路  4Comments

atomoton picture atomoton  路  7Comments

woodruffw picture woodruffw  路  6Comments

davidmoten picture davidmoten  路  5Comments