mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
rustdoc: HTML escape codeblocks which fail syntax highlighting
This commit is contained in:
parent
31dd4f4acb
commit
baf2921ebc
@ -65,7 +65,7 @@ pub fn render_with_highlighting(
|
||||
Err(()) => {
|
||||
// If errors are encountered while trying to highlight, just emit
|
||||
// the unhighlighted source.
|
||||
write!(out, "<pre><code>{}</code></pre>", src).unwrap();
|
||||
write!(out, "<pre><code>{}</code></pre>", Escape(src)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,3 +25,11 @@ pub fn quux() {}
|
||||
/// \_
|
||||
/// ```
|
||||
pub fn ok() {}
|
||||
|
||||
// @has bad_codeblock_syntax/fn.escape.html
|
||||
// @has - '//*[@class="docblock"]/pre/code' '\_ <script>alert("not valid Rust");</script>'
|
||||
/// ```
|
||||
/// \_
|
||||
/// <script>alert("not valid Rust");</script>
|
||||
/// ```
|
||||
pub fn escape() {}
|
||||
|
Loading…
Reference in New Issue
Block a user