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

List items parse unexpected #3631

Closed
wulei950626 opened this issue Mar 3, 2025 · 3 comments
Closed

List items parse unexpected #3631

wulei950626 opened this issue Mar 3, 2025 · 3 comments

Comments

@wulei950626
Copy link

Marked version: 15.0.0

Describe the bug
when useing marked.parse
Given this input:

-This shouldn't be an h tag
   -

Results in this:

<h2>-This shouldn't be an h tag</h2>

and not the expected:

<ul>
  <li>
    <p>This shouldn't be an h tag</p>
    <ul>
      <li></li>
    </ul>
  </li>
</ul>

you can try in https://spec.commonmark.org/dingus/
Image

@webketje
Copy link

webketje commented Mar 3, 2025

Your assertion is incorrect. Using the commonmark link you provided:

Image

Using the marked demo:

Image

The <p> tag you mention in "Expected" is never expected. IF you wanted this output:

<ul>
  <li>
    This shouldn't be an h tag
    <ul>
      <li>sublistitem</li>
    </ul>
  </li>
</ul>

It should be written as:

- This shouldn't be an h tag
  - sublistitem

or

* This shouldn't be an h tag
  * sublistitem

@UziTech
Copy link
Member

UziTech commented Mar 3, 2025

Yes according to the CommonMark spec that is a heading not a list. If you would like us to change it you will have to change the CommonMark spec.

Or you can create an extension that makes it a list.

@wulei950626
Copy link
Author

Thanks for the advice~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants