galaxy-hub icon indicating copy to clipboard operation
galaxy-hub copied to clipboard

List formatting weirdness

Open natefoo opened this issue 3 years ago • 2 comments

Using a 4-space indent to add paragraphs in list items does some weird stuff:

  1. Paragraph spacing is almost the same as line spacing inside a paragraph, which makes consecutive paragraphs hard to read.
  2. There's no space after the last paragraph, before the next list item, which is also tough to read.
  3. Using a <br/> between paragraphs works, but a <br/> after a code block renders as its own code block containing <br/> and breaking the indent for the rest of the list item.

Test page:

---
title: Test
tags: [galaxy]
subsites: [global]
---

first paragraph outside list

second paragraph outside list

1. list item 1

    first paragraph in list

    second paragraph in list

2. list item 2

    first paragraph in list

    <br/>

    second paragraph in list

3. list item 3

    first paragraph in list

    <br/>
    
    ```
    some code
    ```
    
    <br/>
    
    second paragraph in list
    
4. list item 4

Renders as: image

Compared to GH rendering the same markdown:

  1. list item 1

    first paragraph in list

    second paragraph in list

  2. list item 2

    first paragraph in list


    second paragraph in list

  3. list item 3

    first paragraph in list


    some code
    

    second paragraph in list

  4. list item 4

natefoo avatar Nov 02 '22 00:11 natefoo

It shouldn't be 4 spaces though, right? it should be aligned with the text of the list element:

1. list item 1

    first paragraph in list

instead use

1. list item 1

   first paragraph in list

hexylena avatar Nov 02 '22 08:11 hexylena

The original "spec" (which isn't really a spec, but whatever) says:

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

The GFM spec says it should be aligned but doesn't explicitly discuss over-indenting, just under-indenting. The GH example I put in the original comment is using 4 and renders properly. But you're right that by that spec it should be aligned.

I guess the prettier option if you (like me) want to keep 4-space tabs is to use two spaces after single digit list markers and three after unordered list markers:

1.  some text
  ^^
    more text in the same block

-   some more text
 ^^^
    also more text in the same block

Anyhow, switching to 3 spaces in the example I put in the original issue does fix the hub rendering that <br/> as an unindented code block, but the paragraphs in list items still don't appear to be paragraph separated.

natefoo avatar Nov 03 '22 00:11 natefoo