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

Remove spaces after list marker #7172

Open
reagle opened this issue Mar 22, 2021 · 6 comments
Open

Remove spaces after list marker #7172

reagle opened this issue Mar 22, 2021 · 6 comments

Comments

@reagle
Copy link

reagle commented Mar 22, 2021

When pandoc converts a list to markdown, the list marker is followed by three spaces. A few people seem to prefer this not be the case. @jgm wrote:

The motivation is to make sure embedded lists and block-level elements line up properly, obeying the "four-space rule." Note that pandoc's markdown reader no longer obeys the four-space rule, and one could imagine revising the writer to be sensitive to the four_space_rule extension flag. Nonetheless, obeying it creates the most portable markdown output.

@uvtc
Copy link

uvtc commented Mar 23, 2021

When converting to markdown, I think that rather than formatting lists like:

Lorem ipsum dolor sit amet.

-   foo
-   bar
-   baz

Lorem ipsum dolor sit amet.

(no space before the list marker, and three spaces after) they should instead be formatted like this:

Lorem ipsum dolor sit amet.

  - foo
  - bar
  - baz

Lorem ipsum dolor sit amet.

with two spaces before the list marker and one space after.

In both cases the list content starts at 4-places in. Rationale:

  • indentation before the list marker is how its generally rendered in html and pdf output, and looks better. For reference, see screenshots below of html and pdf output.
  • if you don't include any leading indentation before the list marker, then as you scan your eyes down the plain text document, everything looks jammed to the left. It just looks better with that indentation before the marker. And markdown should firstly be natural looking and easy to read.

pdf output:

image

html output:

image

@uvtc
Copy link

uvtc commented Mar 23, 2021

Nested lists example. Here's the markdown:

Lorem ipsum dolor sit amet.

  - foo
      - foo a
      - foo b
  - bar
      - bar a
      - bar b
          - bar b 1
          - bar b 2
      - bar c
  - baz
  - moo

Lorem ipsum dolor sit amet.

-   foo
    -   foo a
    -   foo b
-   bar
    -   bar a
    -   bar b
        -   bar b 1
        -   bar b 2
    -   bar c
-   baz
-   moo

Lorem ipsum dolor sit amet.

Here's the pdf output (of course, both styles render identically):

image

@leowill01
Copy link

@uvtc

In both cases the list content starts at 4-places in. Rationale:

  • indentation before the list marker is how its generally rendered in html and pdf output, and looks better. For reference, see screenshots below of html and pdf output.
  • if you don't include any leading indentation before the list marker, then as you scan your eyes down the plain text document, everything looks jammed to the left. It just looks better with that indentation before the marker. And markdown should firstly be natural looking and easy to read.

I have to disagree with this for several reasons:

  • it sounds like you're assuming lists always need to show some indentation as if they are always secondary to a preceding paragraph. However, I use lists a lot in and of themselves and thus have no need to have any sort of left-side space buffer since they don't follow any preceding text
    • You are using PDF output as a rationale for this, but personally in reality PDF is only one format I use. Most of the time I'm using a WSYWIG editor where It's quite easy to read any kind of list.
    • even then, i don't have a problem with lists being left-justified in markdown source view. the markdown syntax itself to me is enough to read it without trouble.
  • it introduces unwanted leading space characters. for me personally this is a hard no, especially since i use tabs and not spaces.
  • i personally don't see any reason why the "four space rule" needs to strictly followed. i personally am aware of all the lists I'm writing and I can change the formatting as I see fit. it breaks rendering especially for task lists on Zettlr (and i would assume some other apps like the Panda(Bear) beta), which is my main markdown writing app:
    • Screen Shot 2022-04-19 at 2 35 42 PM
    • so, this goes against it being "the most portable markdown output", at least for my use case (data science, academic writing, very long to-do list-only docs).
    • Not to mention that with respect to task lists specifically, the text doesn't even start at space 4, the checkbox does.
  • it's not a burden to read for me if the four space rule isn't followed. I think the lists may only become troublesome to read when different list types are mixed together, which I can't imagine is a significant enough use-case to warrant this type of unwanted automatic syntax changing.

I think at most this should be an option to enable, like @reagle first quoted @jgm as saying.

@jgm
Copy link
Owner

jgm commented Apr 19, 2022

Note that in current HEAD, the extra spaces are omitted for commonmark and gfm output. They are retained for markdown output, mostly because this makes the output compatible with a wide range of converters.

@leowill01
Copy link

I should note that I'm coming at this originally from RStudio Visual Markdown: rstudio/rstudio#11013

@uvtc
Copy link

uvtc commented Apr 19, 2022

Not sure why I didn't mention it above, but as alluded to in the quote from @jgm , following the four-space-rule makes multi-line multi-paragraph list content line up really nicely, and makes it easy to see which list item to which content belongs. Here's an example:

Lorem ipsum dolor sit amet.

  * Consectetur adipiscing elit, sed
    do eiusmod tempor incididunt ut
    labore et dolore magna aliqua.

      - nested list item here. Lorem
        ipsum dolor sit amet, consectetur
        adipiscing elit, sed do eiusmod
        tempor incididunt.

      - nested list item here. Lorem
        ipsum dolor sit amet, consectetur
        adipiscing elit, sed do eiusmod
        tempor incididunt.

    Second paragraph of first list
    item. Ut enim ad minim veniam, quis
    nostrud exercitation ullamco laboris.

        And here is a
        code block
        someone added.

    Third paragraph of first list item.
    Nisi ut aliquip ex ea commodo consequat.

  * Second list item. Excepteur sint occaecat
    cupidatat non proident, sunt in culpa qui
    officia deserunt mollit anim id est laborum.

    vanilla
      : From the vanilla bean. Lorem ipsum dolor
        sit amet, consectetur adipiscing elit,
        sed do eiusmod tempor incididunt ut labore.

        Second paragraph about vanilla!

    chocolate
      : From the cocoa bean. Et dolore magna
        aliqua. Ut enim ad minim veniam, quis
        nostrud exercitation ullamco laboris nisi.

  * Third list item.

with output:

image

(last list item didn't make it into the screenshot).

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

No branches or pull requests

5 participants