Page 1 of 1

markdown issue: nested lists are nested only 2 levels, 3. level not nested

Posted: Tue May 05, 2020 11:54 am
by aisberg
serendipity_event_markdown

configuration ""Markdown Extra" verwenden" = yes

Try this text in an article:

Code: Select all

# Header 1

normaler Text

## Header 2

Es folgt eine Liste:

* qwertz
* asdfg
  * yxcvb
  * üpoiu
    * wertz
The list is not nested in 3 levels, but only in 2 levels: "wertz" is on the same level like "üpoiu"

You can check the output here:
http://testblog.aisberg.de/index.php?/a ... kdown.html

Re: markdown issue: nested lists are nested only 2 levels, 3. level not nested

Posted: Sun May 10, 2020 8:42 am
by thh
aisberg wrote:
Tue May 05, 2020 11:54 am
The list is not nested in 3 levels, but only in 2 levels: "wertz" is on the same level like "üpoiu"
Unfortunately that is a limitation of (at least) PHP Markdown, the library s9y uses to parse markdown; you can test that here: https://michelf.ca/projects/php-markdown/dingus/ What works there should work in s9y (or we should hopefully be able to make it work); what doesn't, well ...

If you'd like to see that feature, it would be most helpful if you could contact that project; the code is on Github at https://github.com/michelf/php-markdown. If they add that feature and do a new release, we can just update the library. (I'd volunteer to backport the change even before a new release of PHP Markdown, if you ping me.) - I'd like to have that feature, too, but I don't know if and when I get the time to have a look at PHP Markdown. So it's not "we won't do it", but more "don't hold your breath". :)

(I'm not sure if that is a bug or a missing feature. Markdown itself - the original concept from John Gruger at https://daringfireball.net/projects/markdown/syntax - doesn't seem to mention nesting of lists at all.)

Re: markdown issue: nested lists are nested only 2 levels, 3. level not nested

Posted: Sun May 10, 2020 9:09 pm
by aisberg
I added an example to this issue:
https://github.com/michelf/php-markdown/issues/312

Thank you for the background information how this markdown converter in s9y is implemented!

Re: markdown issue: nested lists are nested only 2 levels, 3. level not nested

Posted: Mon May 11, 2020 10:10 am
by aisberg
interesting discussion here:
https://github.com/yzhang-gh/vscode-mar ... -626420198

I learned that there are many different Markdown dialects and why in PHP markdown 4 spaces or one tab per level are used.

In the last comment https://github.com/michelf wrote:
I indeed think CommonMark's behavior makes more sense when it comes to parsing list indentation. But changing this in PHP Markdown would break backward compatibility with old documents and with John Gruber's original Markdown parser. It's also an interesting thought that the original Markdown with its quirks could have become a minority "dialect", of which PHP Markdown would be an implementation of.