Skip to content

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

Merged
UziTech merged 4 commits intomarkedjs:masterfrom
docker-archive-public:fix-commonmark-tabs
Apr 11, 2022
Merged

fix: non leading-tabs in markdown content (#1559)#2434
UziTech merged 4 commits intomarkedjs:masterfrom
docker-archive-public:fix-commonmark-tabs

Conversation

@rossipedia
Copy link
Copy Markdown
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
Copy Markdown

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

Comment thread src/Lexer.js Outdated
@rossipedia
Copy link
Copy Markdown
Contributor Author

Does this look good now?

Comment thread src/Lexer.js Outdated
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

UziTech commented Apr 10, 2022

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

Copy link
Copy Markdown
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
Copy Markdown

🎉 This PR is included in version 4.0.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rossipedia rossipedia deleted the fix-commonmark-tabs branch April 11, 2022 01:45
Logiclayer1111 pushed a commit to Logiclayer1111/marked that referenced this pull request Apr 20, 2026
## [4.0.14](markedjs/marked@v4.0.13...v4.0.14) (2022-04-11)

### Bug Fixes

* only convert leading tabs to spaces ([#1559](markedjs/marked#1559)) ([#2434](markedjs/marked#2434)) ([1103690](markedjs/marked@1103690))
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