aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-16 11:34:35 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-16 11:34:35 +0200
commit58ba69452a25c3d4b2059c01cc6cd837159d2f90 (patch)
tree7f6d49449f564ec8606cc3881210d8b27df11961 /src/compiler.rs
parent7875ada79cea1194dc9e15acee36ed0700be70e6 (diff)
downloadmarkdown-rs-58ba69452a25c3d4b2059c01cc6cd837159d2f90.tar.gz
markdown-rs-58ba69452a25c3d4b2059c01cc6cd837159d2f90.tar.bz2
markdown-rs-58ba69452a25c3d4b2059c01cc6cd837159d2f90.zip
Add support for hard break escape
Diffstat (limited to '')
-rw-r--r--src/compiler.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index 6127231..3aacca0 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -150,6 +150,8 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::BlankLineEnding
| TokenType::BlankLineWhitespace
| TokenType::Whitespace
+ | TokenType::HardBreakEscape
+ | TokenType::HardBreakEscapeMarker
| TokenType::HtmlFlowData
| TokenType::HtmlTextData
| TokenType::CodeFencedFence
@@ -192,6 +194,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::CharacterEscapeMarker
| TokenType::CharacterReference
| TokenType::CharacterReferenceMarkerSemi
+ | TokenType::HardBreakEscapeMarker
| TokenType::Autolink
| TokenType::AutolinkMarker => {}
TokenType::HtmlFlow | TokenType::HtmlText => {
@@ -208,6 +211,9 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
TokenType::Paragraph => {
buf_tail_mut(buffers).push("</p>".to_string());
}
+ TokenType::HardBreakEscape => {
+ buf_tail_mut(buffers).push("<br />".to_string());
+ }
TokenType::CodeIndented | TokenType::CodeFenced => {
let seen_data =
code_flow_seen_data.expect("`code_flow_seen_data` must be defined");