824 Commits
Author SHA1 Message Date
simple-mindedandGeneralTony007 fe0d3496e9 fix: preserve Unicode whitespace in inline link destinations (#4249)
* fix: preserve Unicode whitespace in inline link destinations

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: preserve Unicode whitespace in inline link destinations

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: preserve Unicode whitespace in inline link destinations

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: migrate reviewed regression to native fixture

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: migrate reviewed regression to native fixture

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: migrate reviewed regression to native fixture

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: migrate reviewed regression to native fixture

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove superseded regression after native fixture migration

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove superseded regression after native fixture migration

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove unrelated ASCII-tab link destination fixture

Remove the input identified in review. The existing parser mismatch is outside this Unicode-whitespace change; the corresponding expected output is removed in the companion commit.

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: align link destination output with removed ASCII-tab case

Remove only the expected output corresponding to the reviewed ASCII-tab input. Unicode cases remain unchanged; this does not fix the separate parser mismatch. Full local npm test passed: 2039 specs and 256 unit tests.

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-27 15:18:02 -07:00
奶油芝士脆脆鲨 f3bfaf6699 fix: normalize line endings for inline parsing (#4283)
Prepared with Codex assistance.
2026-11-27 11:49:24 -07:00
Ragib MRB dd9fbbe8e4 fix: keep --option=value values attached to their option and check own defaults in CLI (#4265) 2026-11-27 09:14:27 -07:00
FFspiky 393e1dc2ac fix: strip indentation from tilde fence contents (#4281) 2026-11-25 14:11:37 -07:00
Lê Văn Xuân Hoàn 8e298c1d2f fix: preserve literal entities in image alt autolinks (#4275) 2026-11-25 13:27:29 -07:00
Taha Ahmed 201bfce495 feat: add inBlockquote to lexer state (#4222)
* fix: measure tabs after a block quote marker from the start of the line

- Expand tabs in block quote markers and the indentation after them with tab stops from the start of the line, nested markers included
- Keep tabs literal inside fenced code in a block quote (#4184)
- Keep the old handling inside list items, where the marker's column is unknown

Fixes #4221

* fix: keep the existing tab handling from a list item in a block quote on

- Return lines as written from the first list item on, since its columns and fences are not tracked
- Expand columns only in the outermost block quote, including the nested continuation path
- Add exact and structural specs for a fence and a lazy line in a list item under a block quote
2026-11-23 18:42:42 -07:00
Ragib MRB c57230757e fix: check own properties on extensions.renderers in Parser (#4271) 2026-11-23 18:21:05 -07:00
Ragib MRB 283f74f24b fix: skip missing optional childTokens properties in walkTokens (#4262) 2026-11-22 23:31:24 -07:00
Umut f5ffd221ba fix: avoid quadratic scan on adjacent inline links (#4274) 2026-11-22 22:26:15 -07:00
Zhenxian Liangand梁镇贤 6c2a5ab48d fix: wait for CLI error output before exiting (#4263)
Co-authored-by: 梁镇贤 <251972984+xiaoyao-666-coder@users.noreply.github.com>
2026-11-20 19:20:48 -07:00
Ragib MRB 502e658115 fix: reject CLI options missing their values (#4261) 2026-11-20 00:44:08 -07:00
generaltony007andGeneralTony007 1e1190241b fix: allow trailing tabs after closing code fences (#4241)
* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove duplicate CommonMark fence output

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove duplicate CommonMark fence input

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-19 00:06:06 -07:00
generaltony007andGeneralTony007 04f1c6e518 fix: preserve literal entities in image alt text (#4232)
* fix: preserve literal entities in image alt text

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: cover image literal entities and text renderer compatibility

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: add image alt literal entity inputs

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: assert literal entity image alt output

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-17 08:38:15 -07:00
generaltony007andGeneralTony007 171f177a42 perf: skip paragraph lookahead for initial quoted code (#4233)
* fix: skip paragraph lookahead for initial quoted code

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: preserve quoted paragraph continuation boundary

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: cover alternating indented code and quoted code

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-17 08:37:23 -07:00
generaltony007andGeneralTony007 a1ddc722e7 fix: honor the CLI end-of-options marker (#4230)
* fix: honor the CLI end-of-options marker

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: cover hyphen-prefixed input files after --

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* docs: document the CLI option terminator

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-17 08:24:41 -07:00
Gss c6b22e89ba fix: avoid quadratic time on long local part before @ in GFM text (#4225) 2026-11-16 11:20:08 -07:00
Jay Hemnani b9e3824233 fix: keep an indented code block after a list item paragraph (#4198)
* fix: keep an indented code block after a list item paragraph

In a list item, a paragraph line indented four or more spaces is lexed
as indented code and then merged back into the paragraph. The code
token also ran across the following blank line, so a real indented
code block after it was merged into the paragraph too.

* fix: continue list item text over indented lines in the text tokenizer
2026-11-16 11:03:07 -07:00
generaltony007andgeneraltony007 a0925cca02 perf: avoid scanning table bodies for header-only decisions (#4213)
* perf: reject mismatched table headers before scanning body rows

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

* perf: share header-only GFM table lookahead

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: cover table header rejection before body matching

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-16 10:53:17 -07:00
generaltony007andGeneralTony007 1c5969e395 fix: keep rejected table candidates in the preceding paragraph (#4218)
* fix: keep rejected table candidates in the preceding paragraph

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: preserve inline queue and custom paragraph tokenizers

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: cover rejected GFM table candidates and valid controls

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: record reference HTML for rejected table continuation

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-16 09:34:42 -07:00
kevin d2c6f736f3 fix: keep tabs that are code content under a block quote (#4217)
* fix: keep tabs that are code content under a block quote

After ">", an optional space is part of the marker; tabs after that
space belong to the line content (e.g. fenced code) and must not be
expanded. Tabs with no leading space are still expanded so indented
code under a quote keeps working.

Fixes #4184

* test: move the block quote tab case to a renderExact spec
2026-11-16 09:33:49 -07:00
Afonso Ribeiro 59024421a4 fix: remove a task item's checkbox marker from its own text (#4215) 2026-11-16 09:32:48 -07:00
generaltony007andgeneraltony007 5e35708f3f fix(types): preserve custom output types in tokenizer overrides (#4214)
* fix(types): preserve custom output types in tokenizer overrides

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

* test(types): cover generic tokenizer context and string defaults

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-16 09:31:17 -07:00
yash de71210d42 fix: reject a link destination in angle brackets with an unescaped < or > (#4206) 2026-11-16 09:29:19 -07:00
奶油芝士脆脆鲨 0460f98b7e fix: parse links generated by inline tokenizers (#4204) 2026-11-16 09:28:27 -07:00
yash 06e1d10903 fix: let a mid-run opener close against a delimiter that can also open (#4203) 2026-11-16 09:27:25 -07:00
lfhwnqe 7499eb3a23 fix: preserve trailing blank lines in fenced code (#4200) 2026-11-16 09:26:02 -07:00
Panda Xiongandpandaxiong0729 b535046bf5 fix(cli): wait for stdout before exiting (#4197)
Co-authored-by: pandaxiong0729 <239575197+pandaxiong0729@users.noreply.github.com>
2026-11-16 09:25:08 -07:00
Alperen Manas 72d0fec9b5 fix: let an autolink or inline html line start or continue a setext heading (#4191) 2026-11-16 09:22:40 -07:00
Wei-Lun LiandClaude Opus 5.5 e2f77b4b72 fix: end a block quote at a lazy line after an empty list item (#4178)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:20:44 -07:00
Vadim Toptunov 0b8b3b3386 perf: close residual O(n²) parse time on unmatched emphasis/strikethrough delimiter runs (follow-up to #4099 / #4103) (#4196)
* perf: skip dead emphasis/strikethrough delim runs in inline pass

Follow-up to #4099 / #4103. When an input line contains a long run of `*`,
`_` or `~` with no closer anywhere ahead in maskedSrc, every opener
position in Tokenizer.emStrong / Tokenizer.del was correctly early-returning
via the lastPossibleCloserIndex guard introduced by #4103, but the outer
inline loop still advanced one character at a time through the run. The
`^\*+` greedy anchor in emStrongLDelim re-scans the whole run on each
call, so the inline pass remains O(n^2) even though the inner closer scan
is now O(1).

Measured on master before this change:

```
**` x 20000 + 'x'   8.73 s
__` x 20000 + 'x'  11.30 s
*`  x 40000 + 'x'   8.73 s
_`  x 40000 + 'x'  11.30 s
```

With this change the same inputs render in ~0.001 s. The CommonMark
spec test suite (1983 cases) and the project's unit tests (242 cases)
continue to pass. A new fixture `em_strong_unmatched_delim_run`
documents the behavior for closer-less `*`, `_`, and `~` runs.

The fix checks the cached last-possible-closer index that #4103
already maintains; when no closer exists after the current position,
the entire run of same-delim characters is consumed as literal text in
one step. Behavior is unchanged (runs without a closer have always
rendered as literal text); only the time to reach that result changes.

* test(redos): regression test for closer-less delimiter run quadratic

Mirrors the quadratic_em_mask.cjs / quadratic_br.cjs style. Each of the
four cases fails on 18.1.3 baseline (times out around 2.3-3.0s per case
in test:specs) and passes in 5-7ms with the fix.

- '**' x 10000 + 'x' -> <p>**...**x</p>
- '__' x 10000 + 'x' -> <p>__...__x</p>
- '*'  x 20000 + 'x' -> <p>*...*x</p>
- '_'  x 20000 + 'x' -> <p>_..._x</p>

Requested by @UziTech in review of #4196.
2026-11-16 09:11:21 -07:00
generaltony007andgeneraltony007 9a26ae9cee fix: Fix bracket escapes inside code spans in link text being stripped (#4205)
* Fix bracket escapes inside code spans in link text being stripped

The link label matcher consumes backslash-escaped brackets, and outputLink then removes those escapes from the label text. It did so over the whole label, so a backslash-escaped bracket inside a code span also lost its backslash even though code span content is literal: [`\]`] rendered <code>]</code> instead of <code>\]</code>.

Scan the label and copy code spans through verbatim, unescaping brackets only outside of them.

Refs #4176

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

* Add spec tests for bracket escapes in link text code spans

Refs #4176

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

* Add expected HTML for bracket escapes in link text code spans

Refs #4176

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-13 11:22:38 -07:00
Alperen Manas ac2256e113 fix: end a list item before a lazy line after an empty or non-paragraph nested block (#4183) 2026-11-13 11:21:00 -07:00
yash 8a578e4c0c fix: continue a block quote paragraph with a lazy line that starts an html tag (#4202)
* fix: continue a block quote paragraph with a lazy line that starts an html tag

A lazy continuation line in a block quote that is only an html tag, like
`</span>` or `<a href="bar">`, was lexed as an html block, which ended the
paragraph. An html block of type 7 cannot interrupt a paragraph, so the
line continues the paragraph, as in CommonMark.

* refactor: move the lazy html paragraph check to the tokenizer
2026-11-13 11:19:55 -07:00
yash 738ebebc83 fix: allow tabs between the tag name and attributes of an html block (#4207) 2026-11-10 21:13:02 -07:00
Aarav Guptaandusesprocket[bot] 2d3b47fa21 fix: keep a tab after the block quote marker's space literal (#4208)
Co-authored-by: usesprocket[bot] <306702232+usesprocket[bot]@users.noreply.github.com>
2026-11-10 21:11:38 -07:00
vidigoatandClaude Opus 5.5 e4ab77f6e4 feat: add lastToken to lexer state (#4160)
* fix: only let a non-empty list starting with 1 interrupt a paragraph in a list item

Inside a list item, paragraph lines are lexed as text tokens, and the list
tokenizer ran before the text tokenizer without checking whether the list
may interrupt the paragraph, so `14.` or an empty `*` on the next line
started a nested list. Apply the same rule as the paragraph interrupt: only
a non-empty list starting with a bullet or 1 can interrupt a paragraph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: move the list interrupt check into the list tokenizer

The lexer passes its tokens to `list(src, tokens)`, and the tokenizer
checks the last one, so `list(src)` overrides keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: keep the block tokens in the lexer state for the list tokenizer

`blockTokens` sets `this.lexer.state.tokens` to the tokens it is lexing
and restores the outer ones when it returns, so `list(src)` keeps its
signature and checks the token before it from the state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: keep only the last block token in the lexer state

`blockTokens` records the last token of the run it is lexing in
`this.lexer.state.lastToken` before each tokenizer runs, and restores the
outer one when a nested call returns, so the list tokenizer checks
`state.lastToken` instead of the whole token list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 15:39:58 -07:00
Shaurya Kesarwani 219492a64e fix: let emphasis open after the other delimiter character (#4169) 2026-11-09 15:35:38 -07:00
lfhwnqe b81a00a2e3 fix: preserve zero from named extension renderers (#4199) 2026-11-09 08:17:04 -07:00
kevin 7bfa1f70e8 fix: let emphasis open and close in angle brackets that are not html (#4190) 2026-11-08 11:11:08 -07:00
yash 4cb767a966 fix: text after a heading or code block in a nested list item is pulled into the outer item (#4179)
fix: end a list item before a lazy line after a nested block

A line with less indentation than a list item is only a lazy
continuation when it continues a paragraph. The list tokenizer checked
the previous line for a fence, heading or hr, but it used the regexes
scaled to the item indent on a line that is already relative to the
item content, and it did not look inside a nested list item or
blockquote on that line. So text after `- - # heading`, `- > ***`, or a
fenced code block in a nested item was pulled into the outer item.
2026-11-08 11:09:29 -07:00
Lim Jooyoung ed54c541ef fix: keep hard line breaks in image alt text (#4187) 2026-11-08 11:07:15 -07:00
Wei-Lun LiandClaude Opus 5.5 1d7272f9ca fix: keep a block quote open after a lazy line in a nested block quote (#4175)
After a lazy continuation line in a nested block quote, a following line
that starts with ">" but does not continue the inner paragraph (a blank
">", a heading, a thematic break, a list item, ...) started a new
top-level block quote. It belongs to the outer block quote, as in
CommonMark.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:02:32 -07:00
Tony Brix 2d4a23c50e perf: fix backtracking in padantic html (#4173) 2026-11-02 08:01:25 -07:00
GroguandMinjung 5cb03bd9a2 fix: isolate extension names from Object.prototype (#4177)
Co-authored-by: Minjung <minjungsung@users.noreply.github.com>
2026-11-02 08:00:49 -07:00
f3d21af070 fix: do not allow a blank line inside a link reference definition label (#4165)
Co-authored-by: aman <aman@pronnel.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 07:58:15 -07:00
1d4d8fe6f5 fix: only close a code fence with the opening fence character (#4164)
Co-authored-by: aman <aman@pronnel.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 07:57:23 -07:00
CyberNative AI LLC 64a299def9 fix: recognize task list items when a tab follows the checkbox (#4163) 2026-11-02 07:56:49 -07:00
Y Micker e43ceef44a fix: preserve zero-valued custom renderer results (#4162)
Assisted-by: OpenAI GPT-6 <noreply@openai.com>
2026-11-02 07:56:08 -07:00
Ngo Quoc Viet e7dcf52ddb fix: end blockquote before a lazy line after a table (#4161) 2026-11-02 07:55:25 -07:00
Alperen 7ba42f445c fix: end a list item before a lazy line after an html block (#4159) 2026-11-02 07:54:02 -07:00