Skip to content

Commit

Permalink
fix: another quick fix to escape some other chars that make MDX go nu…
Browse files Browse the repository at this point in the history
…ts (#3712)
  • Loading branch information
ematipico authored Aug 25, 2024
1 parent bb1ff1c commit 0924a5e
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 0924a5e

Please sign in to comment.