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

fix: non leading-tabs in markdown content (#1559) #2434

Merged
merged 4 commits into from Apr 11, 2022

Conversation

rossipedia
Copy link
Contributor

Marked version:

Markdown flavor: CommonMark

Description

Only replaces tabs at the beginning of a block construct. Tabs in the middle of the item are unaffected.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

Only replaces tabs at the beginning of a block construct. Tabs in the
middle of the item are unaffected.

All tests passing. Tabs in both GFM and CommonMark at 100%

fixes markedjs#1559
@vercel
Copy link

vercel bot commented Apr 8, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

marked-website – ./

🔍 Inspect: https://vercel.com/markedjs/marked-website/D3uTfybfhra66Kx3bbv8kgdEqMw5
✅ Preview: https://marked-website-git-fork-docker-fix-commonmark-tabs-markedjs.vercel.app

markedjs – ./

🔍 Inspect: https://vercel.com/markedjs-legacy/markedjs/A1UvPUv6aE5erAJmpiDKM5my7xeg
✅ Preview: https://markedjs-git-fork-docker-fix-commonmark-tabs-markedjs-legacy.vercel.app

src/Lexer.js Outdated Show resolved Hide resolved
@rossipedia
Copy link
Contributor Author

Does this look good now?

src/Lexer.js Outdated Show resolved Hide resolved
Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! 💯

Copy link
Contributor

@calculuschild calculuschild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Only question is if there might be some other token that needs its rules.js updated to handle tabs?

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did find one example that seems broken.

>	test
// tab between > and test

It is actually currently kind of broken (additional spaces are added to the output) but with this PR it creates a code element in the blockquote.

Looks like https://github.com/markedjs/marked/blob/master/src/Tokenizer.js#L154 might have to be updated to remove a tab after > as well.

@rossipedia
Copy link
Contributor Author

rossipedia commented Apr 10, 2022

Ok seems like that might be a case that's missing a test. I'll see about putting one together for it.

@UziTech
Copy link
Member

UziTech commented Apr 10, 2022

@calculuschild I think this now passes any test I can think of.

Copy link
Contributor

@calculuschild calculuschild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I approve then. I can't think of anything else either.

@UziTech UziTech merged commit 7d19665 into markedjs:master Apr 11, 2022
github-actions bot pushed a commit that referenced this pull request Apr 11, 2022
## [4.0.14](v4.0.13...v4.0.14) (2022-04-11)

### Bug Fixes

* only convert leading tabs to spaces ([#1559](#1559)) ([#2434](#2434)) ([7d19665](7d19665))
@github-actions
Copy link

🎉 This PR is included in version 4.0.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Markdown containing tabs not converted properly to spaces
3 participants