Skip to content

fix: preserve markdown fences in fancy reporter#434

Open
MFA-G wants to merge 1 commit into
unjs:mainfrom
MFA-G:fix-preserve-markdown-fences
Open

fix: preserve markdown fences in fancy reporter#434
MFA-G wants to merge 1 commit into
unjs:mainfrom
MFA-G:fix-preserve-markdown-fences

Conversation

@MFA-G

@MFA-G MFA-G commented Jul 3, 2026

Copy link
Copy Markdown

Fixes #380.\n\n### What changed\n- Restrict inline backtick highlighting so it does not match across newlines or consume triple backticks from Markdown code fences.\n- Add a regression test that formats two adjacent fenced code blocks through the fancy reporter.\n\n### Validation\n- pnpm vitest run test/consola.test.ts\n- pnpm lint

Summary by CodeRabbit

  • Bug Fixes
    • Improved inline code highlighting so single backtick snippets are formatted correctly without interfering with fenced code blocks.
    • Preserved Markdown code fences in formatted log output, preventing fenced sections from being altered during display.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a3e1d4a-57a7-44e5-a847-e36c16f0b3a1

📥 Commits

Reviewing files that changed from the base of the PR and between c47faac and 11e5c9d.

📒 Files selected for processing (2)
  • src/reporters/fancy.ts
  • test/consola.test.ts

📝 Walkthrough

Walkthrough

The fancy reporter's inline-code highlighting regex was changed to avoid matching markdown code fence backticks, preventing corruption of fenced code blocks during formatting. A new test verifies that fenced code blocks in log output are preserved correctly.

Changes

Fancy reporter backtick fix

Layer / File(s) Summary
Backtick regex fix with verification test
src/reporters/fancy.ts, test/consola.test.ts
Replaces the backtick-pair highlighting regex with one using negative lookarounds to skip markdown fence patterns, and adds a test confirming fenced code blocks remain intact after FancyReporter.formatLogObj.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Related issues: #380 (Fancy formatter removes backticks)

Suggested labels: bug, reporters

Suggested reviewers: pi0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preserving Markdown fences in the fancy reporter.
Linked Issues check ✅ Passed The regex fix and regression test address issue #380 by preserving fenced code blocks and preventing backticks from being consumed.
Out of Scope Changes check ✅ Passed The changes are narrowly focused on the reporter fix and its regression test, with no obvious unrelated edits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Fancy formatter removes backticks

1 participant