Last 12 weeks · 0 commits
2 of 6 standards met
Summary resolves each link's by rewriting the entire output string on every closing : grows with the input, and rescans it from the start each time, so a document with N links is O(n²). Because Markdown is untrusted input by definition, this is a CPU-exhaustion / DoS vector (CWE-407): a single link-heavy field can block the event loop for seconds. Measured on the current code, input : Fix Instead of rewriting on every , record the offset of each `outnpm test` in the source — output is byte-for-byte identical before and after. Timing is now linear (see table); 128k links parse in ~131 ms. Notes Found and fixed with AI assistance (Claude). Happy to adjust naming/comments or add a regression test if you'd like.
Repository: developit/snarkdown. Description: :smirk_cat: A snarky 1kb Markdown parser written in JavaScript Stars: 2401, Forks: 115. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Homepage: http://jsfiddle.net/developit/828w6t1x/ Topics: javascript, markdown, parser. Latest release: 2.0.0 (6y ago). Open PRs: 11, open issues: 34. Last activity: 3y ago. Community health: 42%. Top contributors: developit, mesqueeb, Jonarod, gribnoysup, greenkeeper[bot], AnandChowdhary, tusbar, anikethsaha, DanielRuf, guywaldman and others.