-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix: fix tabs at beginning of list items #2679
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
4790658
to
269e832
Compare
@@ -203,7 +203,7 @@ export class Tokenizer { | |||
raw = cap[0]; | |||
src = src.substring(raw.length); | |||
|
|||
line = cap[2].split('\n', 1)[0]; | |||
line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the significance of 3
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is how common mark does it
I'm a little wary of how much unique handling of tabs is getting buried in the Lists Tokenizer recently. I'm not sure where, but somehow it seems like some of this stuff should be transformed ahead of time in a universal way so other tokens get the same tab behavior. Does any of that apply here? |
If we try to handle tabs like this we need to make sure it is actually the start of a list item. I think it would be a lot slower to check for list twice to transform the tabs somewhere else. It would be really nice if we could actually handle tabs correctly instead of replacing them with spaces but I feel like that would be a lot of work (and probably slower). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving just for the sake of having the test and then we can revise the implementation later
Marked version: 4.2.4
Description
Contributor
Committer
In most cases, this should be a different person than the contributor.