mustache-parser-maintenance
Perform maintenance tasks for @markuplint/mustache-parser: modify ignoreTags configuration,
add new Mustache/Handlebars tag types, and update parser behavior.
Input
$ARGUMENTS specifies the task. Supported tasks:
| Task | Description |
|---|---|
modify-ignoretag | Modify or add an ignoreTags entry |
fix-parsing | Fix a parsing issue with Mustache/Handlebars |
update-tests | Add or update test cases |
If omitted, defaults to modify-ignoretag.
Reference
Before executing any task, read docs/maintenance.md (or docs/maintenance.ja.md)
for the full guide. The recipes there are the source of truth for procedures.
Also read:
- •
ARCHITECTURE.md-- Package overview, ignoreTags configuration, and integration points - •
src/parser.ts-- MustacheParser class (source of truth for ignoreTags)
Task: modify-ignoretag
Modify or add an ignoreTags entry. Follow recipe #1 in docs/maintenance.md.
Step 1: Understand the current configuration
- •Read
src/parser.tsand review the existingignoreTagsarray - •Understand the matching order: more specific patterns must come before less specific ones
Step 2: Make the change
- •Add or modify the entry in the
ignoreTagsarray in theMustacheParserconstructor - •Ensure correct ordering (e.g.,
{{{before{{,{{!before{{) - •Each entry needs
type,start, andendproperties
Step 3: Verify
- •Build:
yarn build --scope @markuplint/mustache-parser - •Add test cases to
src/index.spec.tsfor the new tag type - •Test:
yarn test --scope @markuplint/mustache-parser
Task: fix-parsing
Fix a parsing issue with Mustache/Handlebars templates. Follow recipe #2 in docs/maintenance.md.
Step 1: Reproduce the issue
- •Create a minimal HTML template that demonstrates the parsing problem
- •Write a failing test case in
src/index.spec.ts
Step 2: Investigate
- •Read
src/parser.tsto check if the issue is in the ignoreTags configuration - •If the issue is in the base parser, check
@markuplint/html-parser(HtmlParser)
Step 3: Fix and verify
- •Apply the fix
- •Build:
yarn build --scope @markuplint/mustache-parser - •Test:
yarn test --scope @markuplint/mustache-parser
Task: update-tests
Add or update test cases. Follow recipe #3 in docs/maintenance.md.
Step 1: Understand the testing pattern
- •Read
src/index.spec.tsto understand the existing test structure - •Tests use
nodeListToDebugMapsfrom@markuplint/parser-utilsfor assertions
Step 2: Write the tests
- •Use
parser.parse()to parse the template - •Assert against
nodeListToDebugMaps(doc.nodeList)for node structure - •Assert against
doc.nodeList[n]?.nodeNamefor individual node names
Step 3: Verify
- •Test:
yarn test --scope @markuplint/mustache-parser
Rules
- •Maintain ignoreTags ordering -- more specific patterns (
{{{,{{!) must appear before the general{{pattern. - •Keep the parser minimal -- this package only configures
ignoreTags; HTML parsing logic belongs in@markuplint/html-parser. - •Add JSDoc comments to all new public exports.
- •Test all tag types when modifying the ignoreTags configuration.