Skip to content

fix(docgen): escape MDX-incompatible patterns in Mintlify output#668

Merged
dangrondahl merged 1 commit intomainfrom
fix_mintlify_parsing
Feb 24, 2026
Merged

fix(docgen): escape MDX-incompatible patterns in Mintlify output#668
dangrondahl merged 1 commit intomainfrom
fix_mintlify_parsing

Conversation

@dangrondahl
Copy link
Contributor

@dangrondahl dangrondahl commented Feb 24, 2026

Summary

  • Escape angle-bracket placeholders with pipes (e.g. <hours|days|weeks|months>) and lowercase placeholders (e.g. <fingerprint>, <commit_sha>) that MDX interprets as invalid JSX tags
  • Apply escapeMintlifyProse() to flag section content — previously only the synopsis was escaped, leaving ${{ github.head_ref }} unescaped in flag table descriptions
  • Simplify the angle bracket regex to a single pattern that matches all non-HTML placeholder patterns

Fixed parsing errors

  • kosli_attest_jira.md${{ github.head_ref }} in flag table
  • kosli_diff_snapshots.md / kosli_get_snapshot.md<hours|days|weeks|months>
  • kosli_get_artifact.md<fingerprint>, <commit_sha>

Test plan

  • All existing docgen tests pass
  • Added test cases for lowercase placeholders, pipe patterns, and double curly braces
  • Regenerate docs with kosli docs --mintlify and verify no MDX parsing errors in mint dev

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes MDX parsing errors in Mintlify documentation output by escaping angle-bracket placeholders and curly braces that MDX incorrectly interprets as JSX syntax.

Changes:

  • Extended regex pattern to match lowercase placeholders (e.g., <fingerprint>) and pipe-delimited patterns (e.g., <hours|days|weeks|months>) in addition to uppercase placeholders
  • Applied escapeMintlifyProse() to flag descriptions, fixing unescaped ${{ github.head_ref }} patterns in flag tables
  • Added HTML tag filtering to preserve legitimate HTML tags while escaping placeholders

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/docgen/mintlify.go Updated regex pattern to match all placeholder patterns; added htmlTags map for filtering; applied escaping to flag sections
internal/docgen/mintlify_test.go Added comprehensive test cases for lowercase placeholders, pipe patterns, and double curly braces

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dangrondahl dangrondahl merged commit 030cc31 into main Feb 24, 2026
14 checks passed
@dangrondahl dangrondahl deleted the fix_mintlify_parsing branch February 24, 2026 09:24
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.

3 participants