Skip to content

List block cannot have a second line #244

Open

Description

@Drizin

Given the following block:

1. Main bullet  

    Second line

Blackfriday is rendering this:

<ol>
   <li>
       <p>mainbullet</p>
   </li>
</ol>
<p>second line</p>

While I guess it shound render this:

<ol>
   <li>
      <p>mainbullet</p>
      <p>second line</p>
  </li>
</ol>

Makes sense?

Activity

  1. dmitshur commented on Mar 8, 2016

    @dmitshur
    Collaborator

    I tried it in https://dmitri.shuralyov.com/projects/live-markdown/live-markdown.html and could not reproduce. It rendered the way you expected.

    image

    What configuration of blackfriday are you using? It seems to be a configuration issue.

    Also, what version of blackfriday are you using? It probably makes a difference.

  2. Drizin commented on Mar 8, 2016

    @Drizin
    Author

    shurcooL, thanks. Your live-preview website helped me track down the problem.
    The second paragraph needs to have 4 spaces to be correctly nested under the bullet
    I was expecting that 3 spaces would be enough (since the bullet has a 3-chars padding: 1 digit + 1 dot + 1 space).

    I'm not sure if my expectation was wrong, but what led me to the error was that in Journey Blog Engine there is a live preview (while I'm editing posts) which uses javascript showdown and where only a single space padding is enough for nesting the paragraph. However, during runtime journey uses blackfriday, and the nested paragraphs were breaking the ordered list.

    If 4 spaces is the correct minimum padding then please close this issue.

    Thanks for the help.

  3. rtfb commented on Mar 8, 2016

    @rtfb
    Collaborator

    Markdown spec is explicit about the four spaces:

    List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab

    FWIW, we have a PR (#37) hanging there since 2013 that proposes one-space indent for lists. Needless to say, I'm reluctant to merging it and it should probably be closed already.

  4. Drizin commented on Mar 8, 2016

    @Drizin
    Author

    I was not aware that there are multiple standards, but just for reference:

    • I used to refer to markdowntutorial.com, where a single space is enough
    • CommonMark specs suggest that subsequent paragraphs must start at the same position where the text after the list marker starts. They also discuss how the original spec was not followed by some implementations.

    Maybe a flag for CommonMark compatibility would make sense? Just a suggestion.

  5. rtfb commented on Mar 8, 2016

    @rtfb
    Collaborator

    CommonMark is definitely in the plans, but it will take quite some time to put together.

  6. dmitshur commented on Mar 9, 2016

    @dmitshur
    Collaborator

    I was expecting that 3 spaces would be enough (since the bullet has a 3-chars padding: 1 digit + 1 dot + 1 space).

    Unfortunately, this is a common pitfall. Some Markdown packages require 4 spaces, some allow less. Blackfriday currently requires 4 spaces, or a single tab. A single tab is my personal preferred style for indentation.

    If 4 spaces is the correct minimum padding then please close this issue.

    I think it is "correct" for the current scope and goals of Blackfriday today. This may change in the future, but that's my current best estimate. Of course, not having a single definitive spec that we agree on makes the definition of correctness a fuzzy topic. CommonMark is a spec, but I'm not sure we all agree on it. I don't like it because it's too complicated. I'm not opposed to it, but I won't be able to contribute a lot of feature development to make it a reality.

  7. rugk commented on Aug 23, 2016

    @rugk

    I also have this issue.
    Moved from gogs/gogs#3494


    Description

    Basically text for one list item element (for on bullet) can be indented with two spaces. Gogs however ignores that and shows too spaces even if these are e.g. in code blocks.

    Example file

    1. Okay.
      So let's start. (2 spaces)
    
    2. Example
        So go on. (4 spaces)
    3. Example
    4. Hi, step 4 is this (remove X below; I just needed it for escaping, so the code is displayed correctly):
    
      `X``sh
      echo yes > ChrootEveryone
      echo 25 > MaxClientsNumber
      echo 5 > MaxClientsPerIP
      `X``
    
      Adjust everything like you want.
    
      > Also quotes
    
      You can also just don't do it.

    Rendered on GitHub

    1. Okay.
      So let's start. (2 spaces)

    2. Example
      So go on. (4 spaces)

    3. Example

    4. Hi, step 4 is this (remove X below; I just needed it for escaping, so the code is displayed correctly):

      echo yes > ChrootEveryone
      echo 25 > MaxClientsNumber
      echo 5 > MaxClientsPerIP

      Adjust everything like you want.

      Also quotes

      You can also just don't do it.

    Live example

    https://try.gogs.io/rugk/markdown-indentation-parse-test/src/master/test.md

  8. rtfb commented on Oct 8, 2017

    @rtfb
    Collaborator

    Closing this because it works by the spec.

  9. rugk commented on Oct 8, 2017

    @rugk

    There is no official markdown spec. This is just how it is always done, so…

  10. rtfb commented on Oct 8, 2017

    @rtfb
    Collaborator

    I treat the original Markdown spec by John Gruber as official. When we support CommonMark (I already have some progress on it), we will have another, better-defined spec, but for now I find having an under-defined spec better than not having any at all.

  11. rugk commented on Oct 8, 2017

    @rugk

    So what? If you support CommonMark the thing this issue is about is defined here.

    And if you follow the "original spec", you can find the same thing here. (at "hanging indents") or later:

    Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

    So in both specs you link too this is supported and your library does not follow any of these specs.

  12. reopened this on Oct 8, 2017
  13. rtfb commented on Oct 8, 2017

    @rtfb
    Collaborator

    @rugk, which of the four examples that you presented here do you think we ought to support? I have closed this due to what turned out to be a solved issue of OP. If you think the OP issue is not addressed, please be more specific. If you think some other of your provided examples should be supported, let's figure out if they belong to the same issue and address accordingly.

  14. rugk commented on Oct 8, 2017

    @rugk

    Uhh, just reread this old issue. I would be fine with a flexible approach just allowing 2, 3 or 4 spaces (or tabs) or so. That's what GitHub does, as I showed in the example above. Just be flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址