143 Commits
Author SHA1 Message Date
奶油芝士脆脆鲨 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
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
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
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 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
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
奶油芝士脆脆鲨 0460f98b7e fix: parse links generated by inline tokenizers (#4204) 2026-11-16 09:28:27 -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
lfhwnqe b81a00a2e3 fix: preserve zero from named extension renderers (#4199) 2026-11-09 08:17:04 -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
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
RRFZ c38704c2fa fix: await promise arrays from walkTokens extensions (#4153)
* fix: await promise arrays from walkTokens extensions

* fix: declare promise arrays for walkTokens extensions
2026-11-02 07:52:48 -07:00
fading 9470e8f719 fix(cli): honor defaults and config when outputting tokens (#4146)
* fix(cli): honor defaults and config when outputting tokens

* fix(cli): share configured options between lexer and parser
2026-11-02 07:50:30 -07:00
YIOYIO 3a11ad1483 fix(cli): await config functions before parsing (#4138) 2026-10-25 23:39:11 -06:00
Huanyi Xie 379be9d656 fix: honor per-call async options when composing hooks (#4139) 2026-10-25 23:38:05 -06:00
Wahid Rizka Fathurrohman 38c7e55207 fix: keep lazy lines after a list in a nested blockquote (#4137) 2026-10-25 23:36:02 -06:00
Huanyi Xie e7c4f64c43 fix(cli): create no-clobber output files atomically (#4135) 2026-10-25 23:34:24 -06:00
Afonso Ribeiro f0fd3e0e22 perf: ~16% faster parsing by skipping em/strong masking for runs without *, _ or ~ (#4142) 2026-10-25 23:30:35 -06:00
Wahid Rizka Fathurrohman 2784acce37 fix: keep duplicate link definitions in the tokens (#4132) 2026-10-25 23:29:11 -06:00
Ihab Khattab 627d9ae4e5 fix: make walkTokens linear by appending values in place (#4121)
* fix: make walkTokens linear by appending values in place

Marked.walkTokens collected callback results with
`values = values.concat(...)` for every token, copying the whole array
each time, so parsing with any walkTokens extension took quadratic time
in document size. Append in place instead, flattening one level like
concat did, so the returned values are unchanged. The combined
walkTokens function built in use() gets the same change.

Fixes #4120

* fix: copy walkTokens callback arrays by index like concat
2026-10-06 08:59:29 -06:00
hhangandYour Name ec3a4e511a fix(cli): honor an explicitly empty string input (#4113)
Co-authored-by: Your Name <you@example.com>
2026-10-06 08:56:05 -06:00
pengboyu-dev c61543ed0f fix: load CLI configs with top-level await (#4100) 2026-09-28 21:03:58 -06:00
Tony Brix 23c82ad02b chore: update deps (#4108) 2026-09-22 00:06:36 -06:00
Evgeny Ponomarev 7f7a49670c fix: support GFM protocol autolinks (#4067) 2026-09-20 21:01:28 -06:00
Miodrag Obradovic 8f432f0ef2 fix: escape character references in autolink destinations (#4053) 2026-09-03 23:58:48 -06:00
Haïm Dimer e250e31f3e fix: do not nest a link inside a link (#4051)
CommonMark: "Links may not contain other links, at any level of nesting."
marked emitted nested <a> elements instead, which is invalid HTML.

outputLink now rejects a link whose text tokenized into a link, so the
lexer falls through to inlineText and the inner link is the one kept.
Images stay exempt, since their text is flattened into an alt attribute.

Fixes CommonMark examples 518, 519 and 532.
2026-08-18 10:36:01 -06:00
Sarath Francis e1b6139fec fix: fall back to default checkbox renderer when extension returns false (#4023)
A renderer extension named after a built-in token can return false to
fall back to the default renderer. The Parser decides that from a list
of built-in token type names, and 'checkbox' was never added to either
the block or the inline list when the checkbox token was introduced.

The result is that a `checkbox` renderer extension returning false
emits nothing instead of falling back, so the checkbox silently
disappears from the task item.
2026-07-23 22:37:40 -06:00
Tony Brix 11adb697ee fix: fix cli not reading stdin (#3967) 2026-05-18 23:14:06 -06:00
a37983f188 fix: cache list indentation regexes (#3969)
* Cache list indentation regexes

* Handle zero indent in cached regexes

* Update src/rules.ts

Co-authored-by: Steven <steven@ceriously.com>

---------

Co-authored-by: Tony Brix <tony@brix.ninja>
Co-authored-by: Steven <steven@ceriously.com>
2026-05-18 23:13:54 -06:00
Hafez 1731d387f7 refactor(test): move task list output coverage to specs (#3963) 2026-05-02 08:51:24 -06:00
Hafez 2608e810c0 fix: avoid task checkbox for setext heading text (#3960)
* test: cover task marker before setext heading

* fix: avoid task checkbox for setext heading text

* test: cover loose setext task candidate

* fix: preserve loose list detection for demoted tasks

* test: move setext task output coverage to specs
2026-05-01 08:18:12 -06:00
Tony Brix b70895f47b fix: trim blank lines from block tokens (#3939)
BREAKING CHANGE: trim trailing blank lines from block tokens
2026-04-06 23:32:53 -06:00
Pushkar GuptaandPushkar Gupta 40f266560a fix: prevent GFM table tokens from greedily capturing trailing newlines (#3926)
Co-authored-by: Pushkar Gupta <your_email@example.com>
2026-04-06 22:14:37 -06:00
Pushkar Gupta b379e3e571 fix: prevent heading and def tokens from greedily capturing multiple newlines (#3925) 2026-04-06 22:12:50 -06:00
Jerry Chen 6e96fa7bbc fix: avoid race condition in async parallel parse/parseInline with hooks (#3924) 2026-04-05 00:01:25 -06:00
Nandan 73e1f3f88e fix(cli): use file URL for config import (#3923) 2026-04-05 00:00:49 -06:00
Nandan a1c2617a37 fix(cli): honor positional input file (#3922) 2026-04-05 00:00:28 -06:00
Veer Shah f3a3ec05cb fix: re-assign tokenizer.lexer and renderer.parser at start of each parse call (#3907) 2026-03-20 09:07:37 -06:00
Veer Shah 288349d9b6 test: add heading edge case tests (#3919) 2026-03-20 09:06:27 -06:00
Veer Shah 3ea7e88e15 fix: trim trailing whitespace from lheading text (#3920) 2026-03-20 09:06:07 -06:00
Tony Brix 7b192315b2 fix: only create tokens inside tokenizers (#3755)
BREAKING CHANGE:
- Change how consecutive text tokens work in lists
- Simplify listItem renderer
- Checkbox token is added in list tokenizer
- Checkbox token add type and raw property
- Change loose list text tokens to paragraph type in the list tokenizer
2025-11-06 23:33:11 -07:00
Tony Brix 09577e569b feat: Add async provideParser provideLexer (#3756) 2025-10-06 21:22:04 -06:00
Jonatan Schroeder cd2b5f4797 feat: add emStrongMask hook (#3749)
* Add hook to mask input for em/strong processing in extension

* Use passthrough hook instead of tokenizer-specific hook

* Remove deprecated items

* Ensure passthrough hook does not create promise

* Add test for combining hooks and async
2025-09-14 08:27:27 -06:00
Tony Brix 07691248df feat: add def token in tokens and renderer (#3745)
* feat: add def token in tokens and renderer

* fix tests
2025-08-17 18:52:26 -06:00