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

Markdown nested lists deeper than two levels don't get indented. #4009

Closed
5 tasks
monkeyhybrid opened this issue May 21, 2018 · 14 comments
Closed
5 tasks

Markdown nested lists deeper than two levels don't get indented. #4009

monkeyhybrid opened this issue May 21, 2018 · 14 comments
Labels
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/enhancement An improvement of existing functionality

Comments

@monkeyhybrid
Copy link

  • 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.

@monkeyhybrid
Copy link
Author

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).

@aschrijver
Copy link

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

@markuman
Copy link

markuman commented Jun 14, 2018

this screencast is made on my gitea 1.4.2 instance

indent

@aschrijver
Copy link

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

@markuman
Copy link

It depends on the relying markdown implementation.

gitlab.com for example behaves exactly like gitea :)

gitlabmarkdown

@markuman
Copy link

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.

@monkeyhybrid
Copy link
Author

@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).

@yasuokav
Copy link
Contributor

yasuokav commented Jun 15, 2018

@markuman Gitea uses russross/blackfriday for markdown rendering.

Maybe check this issue #329 and dup of #2186

@markuman
Copy link

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

@yasuokav
Copy link
Contributor

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

@monkeyhybrid
Copy link
Author

@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.

@lafriks lafriks added type/enhancement An improvement of existing functionality status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Jun 19, 2018
@lafriks
Copy link
Member

lafriks commented Jun 19, 2018

Marked as blocked by upstream library missing such functionality

@lunny
Copy link
Member

lunny commented Jun 13, 2019

This may duplicated with #3122

@mrsdizzie
Copy link
Member

This is fixed with new markdown library

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/enhancement An improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

7 participants