rustdoc_to_markdown: Support bold and italics (#12501)
This PR extends `rustdoc_to_markdown` with support for bold and italic text. Release Notes: - N/A
This commit is contained in:
parent
279c5ab81f
commit
6fe665ab94
2 changed files with 30 additions and 3 deletions
|
@ -114,7 +114,7 @@ mod tests {
|
|||
let expected = indoc! {"
|
||||
## Serde
|
||||
|
||||
Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.
|
||||
Serde is a framework for _**ser**_ializing and _**de**_serializing Rust data structures efficiently and generically.
|
||||
|
||||
The Serde ecosystem consists of data structures that know how to serialize and deserialize themselves along with data formats that know how to serialize and deserialize other things. Serde provides the layer by which these two groups interact with each other, allowing any supported data structure to be serialized and deserialized using any supported data format.
|
||||
|
||||
|
@ -132,6 +132,25 @@ mod tests {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_styled_text() {
|
||||
let html = indoc! {r#"
|
||||
<p>This text is <strong>bolded</strong>.</p>
|
||||
<p>This text is <em>italicized</em>.</p>
|
||||
"#};
|
||||
let expected = indoc! {"
|
||||
This text is **bolded**.
|
||||
|
||||
This text is _italicized_.
|
||||
"}
|
||||
.trim();
|
||||
|
||||
assert_eq!(
|
||||
convert_rustdoc_to_markdown(html.as_bytes()).unwrap(),
|
||||
expected
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rust_code_block() {
|
||||
let html = indoc! {r#"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue