Skip to content
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
10 changes: 9 additions & 1 deletion crates/engarde/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn html_escape(input: &str) -> String {
let mut result = String::new();
let mut last = 0;
let mut skip = 0;
for (i, c) in input.chars().enumerate() {
for (i, c) in input.char_indices() {
if skip > 0 {
skip -= 1;
continue;
Expand Down Expand Up @@ -99,4 +99,12 @@ mod test {
let output = syntax.format(CODEBLOCK, Some("rust"), Some(""));
assert_eq!(output, CODEBLOCK_RENDERED.to_string());
}

const CODEBLOCK2: &str = r#"// comment with utf-8 你好 😎 <hello>"#;

#[test]
fn codeblock_renders_rust_utf8() {
let syntax = Raw::new();
let _output = syntax.format(CODEBLOCK2, Some("rust"), Some(""));
}
}