markdownlint takes absurdly long to parse a 27,000 line table due to work for each inline incorrectly processing the entire table
See original GitHub issueSTR:
- Install both Text Power Tools (TPT) and markdownlint.
- Open a long MD document. I was viewing this one.
- Ctrl+P, and choose any of the TPT commands. I use “filter lines including a string”
*Note: I see this bug even without opening an MD file. But a long MD file is what makes it easier to reproduce.
Expected a popup from TPT to ask you to input query
Observed It shows “activating extensions…” at status bar for a while, then nothing happens. No popup. If I click “activating extensions” during the time, it shows mardownlint is “unresponsive”.
Afterwards, markdownlint freezes (no longer recognize lighting errors) until restarting.
Tested on newest stable VS Code and Insiders
Version: 1.62.2 (system setup)
Commit: 3a6960b964327f0e3882ce18fcebd07ed191b316
Date: 2021-11-11T20:56:38.428Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 6.1.7601
----------------
Version: 1.63.0-insider
Commit: 4e303fcc52269ab578affa6cb1eb455eacab445f
Date: 2021-11-22T05:28:15.683Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 6.1.7601
See also: https://github.com/qcz/vscode-text-power-tools/issues/29
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
markdownlint/RULES.md at main - GitHub
This document contains a description of all rules, what they are checking for, as well as an examples of documents that break the...
Read more >How to handle wide markdown tables and line-length checks ...
Approach I. First I tried to include a ignore MD013 (line length check) in the relevant section of the Markdown table, however, Markdown...
Read more >Markdownlint - Visual Studio Marketplace
Introduction. The Markdown markup language is designed to be easy to read, write, and understand. It succeeds - and its flexibility is both ......
Read more >Linting Markdown And Documentation - Earthly Blog
Many linting, code formatting, and static analysis tools exist for code. You can use eslint, gofmt, or many other static analysis tools, ...
Read more >New Feature: Table Support - Meta Stack Exchange
All sites across Stack Exchange are now able to use tables. Thanks for all the feedback. We'll keep monitoring this question and we'll...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! Your trace shows an unreasonable amount of time being spent in markdownlint’s
helpers.emphasisMarkersInContent
function which is used exclusively byMD037
/no-space-in-emphasis
. It doesn’t seem to be stuck, but rather spending all its time in the “search code spans” phase splitting code withnewLineRe
and runningemphasisMarkersRe
.Interestingly, if I weren’t looking at your issue, I was going to be looking at this function anyway because it relates to a commit I did yesterday. I’ll see if I can reproduce the issue using the file you link to above.
Oh no… The pattern of calling
forEachInlineCodeSpan(tokenLines.join("\n"), ...)
is very problematic at the moment. In this case,token
corresponds to one of the cells of the table andtokenLines
includes all 26695 lines of the table. Each line contains 2-4 tokens depending on the scenario, and the entire table is re-scanned for every token. Not good. This is fixable, but it’s an issue with the library and I’ll transfer the issue there.