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

Nested Markdown lists get flattened in generated HTML #17

Open
mathrick opened this issue Aug 18, 2022 · 4 comments
Open

Nested Markdown lists get flattened in generated HTML #17

mathrick opened this issue Aug 18, 2022 · 4 comments

Comments

@mathrick
Copy link

Nested Markdown lists result in incorrect HTML generated, which puts them all at the same level, unless there is a switch between ordered and unordered lists, in which case they're properly nested. Repro:

(defsection @repro (:title "Incorrect HTML generated from Markdown")
  "Consider this list:

- Item 1
- Item 2
  - Subitem 1
  - Subitem 2
- Item 3
  * Subitem 3
    + Sub-subitem 1
      1. Sub-sub-subitem 1
      2. Sub-sub-subitem 2")
CL-USER> (40ants-doc/builder:update-asdf-system-docs clutch/docs::@repro :clutch)
 <INFO> [18:44:10] 40ants-doc/highlight highlight.lisp (download-highlight-js) -
  METADATA file lists same languages and theme. Skipping download of Highlight.js
#P"/home/mathrick/Dev/clutch/docs/"
#P"/home/mathrick/Dev/clutch/docs/repro/index.html"

This results in the following output:
flattened-list

@mathrick
Copy link
Author

Actually, I think I misread the output slightly; it's not the the ordered / unordered switch that makes it actually nest the output, it's either sufficient level of nesting, or the use of + as the bullet, since sub-subitem 1 and sub-sub-subitem 1 are rendered at the same level.

@mathrick
Copy link
Author

Some more testing suggests it's "sufficient amount of nesting" that makes it work properly, and the "sufficient amount" is actually determined by the level of indentation in the source Markdown. This for instance renders properly:

- Item 4
     + Subitem 4

Resutling in:
deep indent

@svetlyak40wt
Copy link
Member

This problem is caused by incorrect nesting handling in the underlying Markdown parser 3bmd:

Same way it requires additional indentation for code blocks inside list items. I've created an issue on this problem a year ago: 3b/3bmd#45

Also, I've even created a comprehensive test-suite for checking regressions during 3bmd fixes: 3b/3bmd#46

But seems it's author to busy to support this library :(

@svetlyak40wt
Copy link
Member

I'd like to use a Common Mark compatible parser, extensible and able to return document pieces as common lisp objects. But I didn't find such library for Common Lisp yet.

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

2 participants