diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 19:20:43 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 19:20:43 +0200 |
commit | b150a72975d6e75b96298b3d405afe070271d78b (patch) | |
tree | 8f6bd8f1f527f432715f20b2b8d9d2a272224905 /src/compiler.rs | |
parent | acc35758778bfda5cb01951533868eb8baa2e2d2 (diff) | |
download | markdown-rs-b150a72975d6e75b96298b3d405afe070271d78b.tar.gz markdown-rs-b150a72975d6e75b96298b3d405afe070271d78b.tar.bz2 markdown-rs-b150a72975d6e75b96298b3d405afe070271d78b.zip |
Add support for text in heading (atx)
Diffstat (limited to 'src/compiler.rs')
-rw-r--r-- | src/compiler.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index d3d935b..6127231 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -117,7 +117,9 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St buf_tail_mut(buffers).push("<pre><code".to_string()); code_fenced_fences_count = Some(0); } - TokenType::CodeFencedFenceInfo | TokenType::CodeFencedFenceMeta => { + TokenType::AtxHeadingText + | TokenType::CodeFencedFenceInfo + | TokenType::CodeFencedFenceMeta => { buffer(buffers); } TokenType::HtmlFlow => { @@ -139,7 +141,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::AtxHeading | TokenType::AtxHeadingSequence | TokenType::AtxHeadingWhitespace - | TokenType::AtxHeadingText | TokenType::LineEnding | TokenType::ThematicBreak | TokenType::ThematicBreakSequence @@ -297,6 +298,8 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St } } TokenType::AtxHeadingText => { + let result = resume(buffers); + if let Some(ref buf) = atx_heading_buffer { if !buf.is_empty() { buf_tail_mut(buffers).push(encode(buf)); @@ -306,8 +309,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St atx_heading_buffer = Some("".to_string()); } - let slice = encode(&serialize(codes, &from_exit_event(events, index), false)); - buf_tail_mut(buffers).push(slice); + buf_tail_mut(buffers).push(encode(&result)); } TokenType::AtxHeading => { let rank = atx_opening_sequence_size |