#1496·remark

`--ignore-pattern` comma-split conflicts with gitignore brace expansion syntax

Author: luo2430Created Jul 26, 2026Updated Jul 26, 2026
Labels🤞 phase/open

Initial checklist

Thanks for this great tool! I ran into an issue with --ignore-pattern and wanted to share both the problem and two possible approaches to fix it.

Problem

--ignore-pattern values are parsed through commaParse (comma-separated-tokens), which splits on commas. This makes it impossible to use gitignore brace expansion like {a,b} in patterns.

Reproduction

bash
remark . --ignore-pattern "**/{src,dist}/examples/**"

Expected: ignores src/examples/ and dist/examples/ under all directories.

Actual: nothing is ignored, because commaParse splits the value into two invalid patterns:

"**/{src"           ← broken
"dist}/examples/**" ← broken

Current solutions

Root cause

lib/parse-argv.js line 187-189:

javascript
const ignorePattern =
    parseIfString(joinIfArray(undefinedIfBoolean(config['ignore-pattern']))) ||
    []

The parseIfStringcommaParse roundtrip exists to support --ignore-pattern "a,b" syntax. But --ignore-pattern already supports repeated flags:

bash
--ignore-pattern a --ignore-pattern b  # already works

The comma-split is redundant and actively breaks valid gitignore syntax.

Two possible fixes

Fix A: unified-args (upstream)

Change one line in lib/parse-argv.js:

javascript
const ignorePattern = toArray(undefinedIfBoolean(config['ignore-pattern'])) || []

toArray is already in the file. Single values → [value], repeated flags → [value1, value2], no comma split. This fixes it at the root for all downstream CLI tools (remark-cli, retext-cli, rehype-cli). But it's technically breaking for anyone currently relying on --ignore-pattern "a,b" semantics.

Fix B: remark-cli (downstream workaround)

Pre-expand brace patterns in cli.js before handing off to unified-args:

javascript
// See remarkjs/remark for the full implementation
// --ignore-pattern "**/{a,b}/**"
//   → expands to:
// --ignore-pattern "**/a/**" --ignore-pattern "**/b/**"

No breaking change, no dependency on upstream. But only fixes remark-cli, not other tools that use unified-args.

Proposed solutions

I prefer Fix A:

  1. Fixes the root cause, not the symptom — the parser shouldn't treat commas as delimiters in values where commas are valid gitignore syntax.

  2. The impact is minimal — --ignore-pattern a --ignore-pattern b is already the established idiom (ESLint, Prettier, etc.), and anyone who happens to use the comma form would get a clean break rather than silently broken brace expansion.

  3. Only unified-args needs to change; otherwise every downstream CLI has to carry its own workaround.