Skip to content

fix: prevent markdown horizontal rules from being parsed as frontmatter#30

Open
jeffutter wants to merge 1 commit into
wedow:masterfrom
jeffutter:fix-query-horizontal-rules
Open

fix: prevent markdown horizontal rules from being parsed as frontmatter#30
jeffutter wants to merge 1 commit into
wedow:masterfrom
jeffutter:fix-query-horizontal-rules

Conversation

@jeffutter

Copy link
Copy Markdown

The query command was incorrectly treating markdown content after horizontal rules (---) as YAML frontmatter fields, producing invalid JSON with extra fields from the markdown body.

The awk script toggled in_front on every --- line, but should only process the first two (opening and closing of frontmatter block).

Track frontmatter completion with frontmatter_done flag to ignore subsequent --- markers in markdown content. Add test case with horizontal rules and YAML-like content to prevent regression.

The query command was incorrectly treating markdown content after
horizontal rules (---) as YAML frontmatter fields, producing invalid
JSON with extra fields from the markdown body.

The awk script toggled in_front on every --- line, but should only
process the first two (opening and closing of frontmatter block).

Track frontmatter completion with frontmatter_done flag to ignore
subsequent --- markers in markdown content. Add test case with
horizontal rules and YAML-like content to prevent regression.
Nathan-Schwartz added a commit to Nathan-Schwartz/ticket that referenced this pull request Mar 26, 2026
Port upstream PRs wedow#30 and wedow#28 to plugins/ticket-query:
- Prevent markdown horizontal rules (---) from re-entering frontmatter
  parsing mode by tracking a frontmatter_done flag after the second ---
- Strip existing quotes from YAML array items before re-quoting for
  JSON output, fixing double-quoted tags like ""tag""

Bump ticket-query to 1.0.1.
strefethen added a commit to strefethen/ticket that referenced this pull request Apr 26, 2026
The awk parser toggled in_front on every --- line, so markdown
horizontal rules in a ticket body re-entered frontmatter mode and
parsed body prose as YAML fields, producing invalid JSON.

Replace the boolean toggle with an explicit three-state machine
(before/inside/after). Once the closing --- is seen, subsequent
--- markers are ignored.

Upstream-PR: wedow#30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant