-
-
Notifications
You must be signed in to change notification settings - Fork 781
fix(console): escape backquotes in MDX context #7956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
I would skip a changeset because we don't support any direct usages of our internal crates, and there are no user-facing interface that emits a markup for MDX. |
WalkthroughThe change modifies the HTML output writer in the console crate to properly escape backtick characters when MDX mode is enabled. Previously, backticks were left unescaped in MDX output; now they are emitted as Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_console/src/write/html.rs (1)
122-122: LGTM! Backtick escaping correctly added.The change properly escapes backticks in MDX mode using the correct HTML entity. This matches the existing pattern for other MDX-specific escapes and directly addresses the documentation rendering issue.
However, consider adding a test case to verify backtick escaping works correctly, similar to the existing tests for curly braces and newlines.
Example test to add at the end of the test module:
#[test] fn escape_backticks() { let mut buf = Vec::new(); let mut writer = super::HTML(&mut buf, false).with_mdx(); let mut formatter = Formatter::new(&mut writer); formatter .write_markup(markup! { "Template literal: `foo`" }) .unwrap(); assert_eq!( String::from_utf8(buf).unwrap(), "Template literal: `foo`" ); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/biome_console/src/write/html.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{rs,toml}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Format Rust and TOML files before committing (e.g., via
just f)
Files:
crates/biome_console/src/write/html.rs
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Document rules, assists, and their options with inline rustdoc in the Rust source
Files:
crates/biome_console/src/write/html.rs
🧠 Learnings (1)
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use `dbg_write!` to debug and inspect the emitted IR during formatting
Applied to files:
crates/biome_console/src/write/html.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: autofix
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
Summary
Fixes biomejs/website#1391
Backquotes (
`) were needed to be escaped in MDX, otherwise it may cause invisible backquotes or broken markups.Test Plan
Used the updated biome_console crate in the website repository to see if it works on my machine.
Docs
N/A