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

Marked treats tabs and spaces differently in lists #3126

Open
jkyte19 opened this issue Dec 6, 2023 · 0 comments
Open

Marked treats tabs and spaces differently in lists #3126

jkyte19 opened this issue Dec 6, 2023 · 0 comments
Labels
category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@jkyte19
Copy link

jkyte19 commented Dec 6, 2023

Marked version:
11.0.0

Describe the bug
When writing bulleted or numbered lists, if you have text before the list, tabs get interpreted differently to spaces and causes conversion issues.

To Reproduce
Steps to reproduce the behavior:

  1. Create a file with the below text, ensure tabs and spaces are in the proper places based on the headings.
I am using spaces after the number:
1.  Some Text
3.  Some Text
4.  Some Text

I am using tabs after the number:
1.	SomeText
2.	SomeText
3.	SomeText

I am using tabs after the number and have a space:

1.	SomeText
2.	SomeText
3.	SomeText

I am using spaces after the number:
-  Some Text
-  Some Text
-  Some Text

I am using tabs after the number:
-	SomeText
-	SomeText
-	SomeText

I am using tabs after the number and have a space:

-	SomeText
-	SomeText
-	SomeText
  1. Run marked on the file
marked README.md 
<p>I am using spaces after the number:</p>
<ol>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
</ol>
<p>I am using tabs after the number:
1.	SomeText
2.	SomeText
3.	SomeText</p>
<p>I am using tabs after the number and have a space:</p>
<ol>
<li>   SomeText</li>
<li>   SomeText</li>
<li>   SomeText</li>
</ol>
<p>I am using spaces after the number:</p>
<ul>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
</ul>
<p>I am using tabs after the number:
-	SomeText
-	SomeText
-	SomeText</p>
<p>I am using tabs after the number and have a space:</p>
<ul>
<li>   SomeText</li>
<li>   SomeText</li>
<li>   SomeText</li>
</ul>
  1. Marked Demo
    https://marked.js.org/demo/?text=I%20am%20using%20spaces%20after%20the%20number%3A%0A1.%20%20Some%20Text%0A2.%20%20Some%20Text%0A3.%20%20Some%20Text%0A%0AI%20am%20using%20tabs%20after%20the%20number%3A%0A1.%09SomeText%0A2.%09SomeText%0A3.%09SomeText%0A%0AI%20am%20using%20tabs%20after%20the%20number%20and%20have%20a%20space%3A%0A%0A1.%09SomeText%0A2.%09SomeText%0A3.%09SomeText%0A%0AI%20am%20using%20spaces%20after%20the%20number%3A%0A-%20%20Some%20Text%0A-%20%20Some%20Text%0A-%20%20Some%20Text%0A%0AI%20am%20using%20tabs%20after%20the%20number%3A%0A-%09SomeText%0A-%09SomeText%0A-%09SomeText%0A%0AI%20am%20using%20tabs%20after%20the%20number%20and%20have%20a%20space%3A%0A%0A-%09SomeText%0A-%09SomeText%0A-%09SomeText%0A&options=%7B%0A%20%22async%22%3A%20false%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22extensions%22%3A%20null%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22hooks%22%3A%20null%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22walkTokens%22%3A%20null%0A%7D&version=11.0.0

  2. CommonMark Demo
    https://spec.commonmark.org/dingus/?text=I%20am%20using%20spaces%20after%20the%20number%3A%0A1.%20%20Some%20Text%0A2.%20%20Some%20Text%0A3.%20%20Some%20Text%0A%0AI%20am%20using%20tabs%20after%20the%20number%3A%0A1.%09SomeText%0A2.%09SomeText%0A3.%09SomeText%0A%0AI%20am%20using%20tabs%20after%20the%20number%20and%20have%20a%20space%3A%0A%0A1.%09SomeText%0A2.%09SomeText%0A3.%09SomeText%0A%0AI%20am%20using%20spaces%20after%20the%20number%3A%0A-%20%20Some%20Text%0A-%20%20Some%20Text%0A-%20%20Some%20Text%0A%0AI%20am%20using%20tabs%20after%20the%20number%3A%0A-%09SomeText%0A-%09SomeText%0A-%09SomeText%0A%0AI%20am%20using%20tabs%20after%20the%20number%20and%20have%20a%20space%3A%0A%0A-%09SomeText%0A-%09SomeText%0A-%09SomeText%0A

Expected behavior
The lists with tabs should be interpreted the same regardless of any text placed before them.

Additional
The markdown given above displays correctly in both GitHub as well as VS Code's markdown previewer implying marked is having an issue interpreting the tabs correctly.

@UziTech UziTech added L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue category: lists labels Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

No branches or pull requests

2 participants