mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 21:59:52 -07:00
Interpret newlines as line breaks when converting Markdown to HTML (#74)
This commit is contained in:
parent
953be6a195
commit
ad3b40d538
6 changed files with 442 additions and 42 deletions
|
@ -1027,9 +1027,8 @@ pub mod tests {
|
|||
Span::raw("│"),
|
||||
Span::raw(" "),
|
||||
Span::raw("│"),
|
||||
Span::styled(" ", bold),
|
||||
Span::styled("3", bold),
|
||||
Span::styled(" ", bold),
|
||||
Span::styled(" ", bold),
|
||||
Span::raw("│")
|
||||
]);
|
||||
|
||||
|
@ -1157,4 +1156,21 @@ pub mod tests {
|
|||
assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),]));
|
||||
assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_embedded_newline() {
|
||||
let s = "<p>Hello\nWorld</p>";
|
||||
let tree = parse_matrix_html(s);
|
||||
let text = tree.to_text(15, Style::default(), true);
|
||||
assert_eq!(text.lines.len(), 1);
|
||||
assert_eq!(
|
||||
text.lines[0],
|
||||
Spans(vec![
|
||||
Span::raw("Hello"),
|
||||
Span::raw(" "),
|
||||
Span::raw("World"),
|
||||
Span::raw(" ")
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue