Gitea: Markdown nested lists deeper than two levels don't get indented.

Created on 21 May 2018  路  14Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.4.1
  • Git version:
  • Operating system: Linux
  • Database (use [x]):

    • [ ] PostgreSQL

    • [x ] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [x ] Yes

    • [ ] No

    • [ ] Not relevant

Description

Lists can normally be nested in Markdown, by using two (2) spaces to indent per level of nesting.

Today, I committed some markdown that uses multiple levels of nesting and it does not behave as expected. Every second level of nesting does not show as being nested.

For example, the following markdown, using indenting of 2 spaces per nested level, should display 8 levels of nesting, but it actually only shows 4:

* Level 1
  * Level 2
    * Level 3
      * Level 4
        * Level 5
          * Level 6
            * Level 7
              * Level 8

Outputs:

<ul>
  <li>Level 1 聽
    <ul>
      <li>Level 2</li>
      <li>Level 3
        <ul>
          <li>Level 4</li>
          <li>Level 5
            <ul>
              <li>Level 6</li>
              <li>Level 7
                <ul>
                  <li>Level 8</li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

However, it is possible to force the nesting to display properly by using additional spaces (3 spaces instead of 2) per nested level, on the second level onwards. This is not normal behaviour in other markdown implementations.

I see this incorrect behaviour in both markdown files, and the Wiki. For a test page on try.gitea.io, see here.

kinenhancement statublocked

Most helpful comment

this screencast is made on my gitea 1.4.2 instance

indent

All 14 comments

I just want to add, although I referenced this issue in #3122, that was due to a misunderstanding on my part and I don't believe the issues are related (the other one was not to do with Markdown).

I can confirm the nesting issue in Gitea 43fc430 and that the suggested work-around of adding 3 spaces from level 3 fixes it.

this screencast is made on my gitea 1.4.2 instance

indent

Thanks. So, you are suggesting it must be 4 spaces in 'Gitea-flavoured' markdown? Usually nesting needs only 2 spaces, I thought.

It depends on the relying markdown implementation.

gitlab.com for example behaves exactly like gitea :)

gitlabmarkdown

The underlying markdown implementation of gitea is https://github.com/sparksuite/simplemde-markdown-editor

the interesting thing is, that the demo on https://simplemde.com/ works with both, 2 or 4 indents.
the only settings for indentions are:

indentWithTabs: If set to false, indent using spaces instead of tabs. Defaults to true.

So when I prepares a list with tabs for indention, it is treated as 4 spaces in the browser which works correctly.

My suggestion is to use always 4 spaces for indention.

@markuman Thanks for adding the animated GIF; it makes it a lot clearer than my initial post!

It's bit of a shame because a lot of third-party markdown uses 2 spaces, so even though I can make sure I use 4 spaces from here on, things will still be a bit screwed up for other people's work. If Gitea could use either, that would be great.

At least using 4 spaces seems to behave in other flavours where the standard is 2 (from my very quick, uncomprehensive test).

@markuman Gitea uses russross/blackfriday for markdown rendering.

Maybe check this issue #329 and dup of #2186

@yasuokav but https://try.gitea.io/vendor/librejs.html is listing https://simplemde.com/ and I thought, the JS library does the frontend rendering?

@markuman I think it's just used for the wiki page editor.

@yasuokav Good catch. I'll voice my support for an option for 2 space indenting on #329 as it seems that is a blocker for any potential change in Gitea.

Marked as blocked by upstream library missing such functionality

This may duplicated with #3122

This is fixed with new markdown library

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adpande picture adpande  路  3Comments

BRMateus2 picture BRMateus2  路  3Comments

thehowl picture thehowl  路  3Comments

jorise7 picture jorise7  路  3Comments

internalfx picture internalfx  路  3Comments