Skip to content
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

fix: another quick fix to escape some other chars that make MDX go nuts #3712

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/biome_console/src/write/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ impl<W: io::Write> io::Write for HtmlAdapter<W> {
fn write(&mut self, mut buf: &[u8]) -> io::Result<usize> {
let mut bytes = 0;

const CHARS_TO_CHECK: [u8; 8] = [b'"', b'&', b'<', b'>', b'\n', b'\r', b'{', b'}'];
const CHARS_TO_CHECK: [u8; 10] =
[b'"', b'&', b'<', b'>', b'\n', b'\r', b'{', b'}', b'*', b'_'];
while let Some(idx) = buf.iter().position(|byte| CHARS_TO_CHECK.contains(byte)) {
let (before, after) = buf.split_at(idx);

Expand All @@ -119,6 +120,8 @@ impl<W: io::Write> io::Write for HtmlAdapter<W> {
match *byte {
b'{' => self.0.write_all(b"&#123;")?,
b'}' => self.0.write_all(b"&#125;")?,
b'*' => self.0.write_all(b"&#42;")?,
b'_' => self.0.write_all(b"&#95;")?,
_ => self.0.write_all(&[*byte])?,
}
} else {
Expand Down