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

[Feature Request] Adjust List indentation to follow github syntax(Fixed to four spaces) #33

Open
LazyRen opened this issue Jan 8, 2022 · 2 comments

Comments

@LazyRen
Copy link

LazyRen commented Jan 8, 2022

According to the Kramdown Syntax for Lists

The first list marker in a list may be indented up to three spaces. The column number of the first non-space character which appears after the list item marker on the same line specifies the indentation that has to be used for the following lines of content of the list item. If there is no such character, the indentation that needs to be used is four spaces or one tab. Indented lines may be followed by lines containing text with any amount of indentation due to line wrapping.

This means, if ordered list is (usually) used, list will take 3 spaces as the indentation for that list item.
for unordered list, it will be 2 spaces.

I'm wondering would it be possible for GFM (since it is default preprocessor for Jekyll - therefore github pages) to be matched with Github style? (consistent 4 spaces) Or at least provide option to it?

So for example, below markdown will print proper codeblocks with NO SPACE at the start of the codeblock.
But for the Kramdown with GFM preprocessor, codeblocks WILL HAVE unintended spaces at the start of the codeblock
(and I'm delibrately using 1. to show that they are from the same list)

Markdown:

1. First ordered item

    ```default
    Codeblock with one tab(four space) indentation
    ```

1. Second ordered item

   ```default
   Codeblock with **3 spaces** indentation
   ```

1. Third ordered item

* First unordered item

    ```default
    Codeblock with one tab(four space) indentation
    ```

* Second unordered item

  ```default
  Codeblock with **two spaces** indentation
  ```

* Third unordered item

Github Example: No space at the start of the codeblock

  1. First ordered item

    Codeblock with one tab(four space) indentation
    
  2. Second ordered item

    Codeblock with **3 spaces** indentation
    
  3. Third ordered item

  • First unordered item

    Codeblock with one tab(four space) indentation
    
  • Second unordered item

    Codeblock with **two spaces** indentation
    
  • Third unordered item

Jekyll Blog Example:

  • Screenshot

spaces

  • html
<ol>
  <li>
    <p>First ordered item</p>

    <pre><code class="language-default"> Codeblock with one tab(four space) indentation
</code></pre>
  </li>
  <li>
    <p>Second ordered item</p>

    <pre><code class="language-default">Codeblock with **3 spaces** indentation
</code></pre>
  </li>
  <li>
    <p>Third ordered item</p>
  </li>
</ol>

<ul>
  <li>
    <p>First unordered item</p>

    <pre><code class="language-default">  Codeblock with one tab(four space) indentation
</code></pre>
  </li>
  <li>
    <p>Second unordered item</p>

    <pre><code class="language-default">Codeblock with **two spaces** indentation
</code></pre>
  </li>
  <li>
    <p>Third unordered item</p>
  </li>
</ul>

Thank you.

@LazyRen
Copy link
Author

LazyRen commented Jan 8, 2022

Sorry let me close this issue since it seems current implementation is intended.

I still don't like the fact that Github issues interprets it in different way...

@LazyRen LazyRen closed this as completed Jan 8, 2022
@LazyRen
Copy link
Author

LazyRen commented Jan 9, 2022

I'm sorry let me re-open this as it is not consistent with the list with non-codeblock line sequences.

And fenced codeblock also must prevent this from happening, if my understanding is correct.

Markdown:

1. First ordered item requires 3 spaces

    This is 4 spaces indented but has no space at front

2. Second ordered item requires 3 spaces

    Another 4 spaces indented line

    ```default
    I'm codeblock with 4 spaces indented.
    Why do I have 1 space at the front?
   Line with 3 spaces indentation within the codeblock
    ```

3. Placeholder item

Github:

  1. First ordered item requires 3 spaces

    This is 4 spaces indented but has no space at front

  2. Second ordered item requires 3 spaces

    Another 4 spaces indented line

    I'm codeblock with 4 spaces indented.
    Why do I have 1 space at the front?
    Line with 3 spaces indentation within the codeblock
    
  3. Placeholder item

Jekyll Blog Example:

  • screenshot

    markdown_testing

  • html

    <ol>
    <li>
        <p>First ordered item requires 3 spaces</p>
    
        <p>This is 4 spaces indented but has no space at front</p>
    </li>
    <li>
        <p>Second ordered item requires 3 spaces</p>
    
        <p>Another 4 spaces indented line</p>
    
        <pre><code class="language-default"> I'm codeblock with 4 spaces indented.
    Why do I have 1 space at the front?
    Line with 3 spaces indentation within the codeblock
    </code></pre>
    </li>
    <li>
        <p>Placeholder item</p>
    </li>
    </ol>

It's a surprise that codeblock under html is rendered without preceding spaces since it only requires 2 spaces, but I have used 4 spaces instead.
Same content will be rendered with 2 spaces attached to each line of the codeblock in Jekyll Blog.
markdown_testing2

<ul>
  <li>
    <p>html</p>

    <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="nt">&lt;ol&gt;</span>
  <span class="nt">&lt;li&gt;</span>
      <span class="nt">&lt;p&gt;</span>First ordered item requires 3 spaces<span class="nt">&lt;/p&gt;</span>

      <span class="nt">&lt;p&gt;</span>This is 4 spaces indented but has no space at front<span class="nt">&lt;/p&gt;</span>
  <span class="nt">&lt;/li&gt;</span>
  <span class="nt">&lt;li&gt;</span>
      <span class="nt">&lt;p&gt;</span>Second ordered item requires 3 spaces<span class="nt">&lt;/p&gt;</span>

      <span class="nt">&lt;p&gt;</span>Another 4 spaces indented line<span class="nt">&lt;/p&gt;</span>

      <span class="nt">&lt;pre&gt;&lt;code</span> <span class="na">class=</span><span class="s">"language-default"</span><span class="nt">&gt;</span> I'm codeblock with 4 spaces indented.
  Why do I have 1 space at the front?
  Line with 3 spaces indentation within the codeblock
  <span class="nt">&lt;/code&gt;&lt;/pre&gt;</span>
  <span class="nt">&lt;/li&gt;</span>
  <span class="nt">&lt;li&gt;</span>
      <span class="nt">&lt;p&gt;</span>Placeholder item<span class="nt">&lt;/p&gt;</span>
  <span class="nt">&lt;/li&gt;</span>
  <span class="nt">&lt;/ol&gt;</span>
</code></pre><button><small class="icon-copy" title="Copy"></small><small class="icon-checkmark" title="Done"></small></button></div>    </div>
  </li>
</ul>

@LazyRen LazyRen reopened this Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant