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

Missing List Indent for nested list item #736

Open
cyfung1031 opened this issue Jun 3, 2023 · 3 comments
Open

Missing List Indent for nested list item #736

cyfung1031 opened this issue Jun 3, 2023 · 3 comments

Comments

@cyfung1031
Copy link

cyfung1031 commented Jun 3, 2023

Greasy Fork uses redcarpet to render markdown but the tab indent is missing

Markdown Example:

  1. Item 1

  2. Item 2

    a. Item a

    b. Item b

The item a b shall be under item 2 with tab indent.
But Greasy Fork is just
img

It is possible due to redcarpet as explained by GreasyFork's administrator.

@cyfung1031 cyfung1031 changed the title Is this a bug? (Missing List Indent for sub-item) Is this a bug? Jun 3, 2023
@cyfung1031
Copy link
Author

1. Item 1\n\n2. Item 2\n\n a. Item a\n\n b. Item b

Expected:

<ol>
<li><p>Item 1</p>
</li>
<li><p>Item 2</p>
<p>a. Item a</p>
<p>b. Item b</p>
</li>
</ol>

Actual:

<ol>
<li><p>Item 1</p></li>
<li><p>Item 2</p></li>
</ol>

<p>a. Item a</p>

<p>b. Item b</p>

@cyfung1031 cyfung1031 changed the title (Missing List Indent for sub-item) Is this a bug? Missing List Indent for nested list item Jun 3, 2023
@cyfung1031
Copy link
Author

Marked.js can produce the correct result. Guess this issue is similar to #711.

Correct Result

@DannyBen
Copy link

DannyBen commented Apr 16, 2024

This simple reproduction case demonstrates the issue clearly I think:

require 'redcarpet'
markdown = Redcarpet::Markdown.new Redcarpet::Render::HTML

text = <<~MARKDOWN
- one
  - two
    - three
MARKDOWN

puts markdown.render text
# == Actual output
# <ul>
# <li>one
# 
# <ul>
# <li>two</li>
# <li>three</li>
# </ul></li>
# </ul>
# 
# == Expected output:
# <ul>
# <li>one<ul>
# <li>two<ul>
# <li>three</li>
# </ul>
# </li>
# </ul>
# </li>
# </ul>

Correct Result

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