diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-17 17:45:50 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-17 17:45:50 +0200 |
commit | 24fec22e912c1aa2569e95683ca95edf1aafce8b (patch) | |
tree | d4b680ce042b7e1a6884f59f01a29087704f3378 /src/compiler.rs | |
parent | 60ea2fd3a09f10fa28bf48575736b47afebf3221 (diff) | |
download | markdown-rs-24fec22e912c1aa2569e95683ca95edf1aafce8b.tar.gz markdown-rs-24fec22e912c1aa2569e95683ca95edf1aafce8b.tar.bz2 markdown-rs-24fec22e912c1aa2569e95683ca95edf1aafce8b.zip |
Add support for definitions
* Add definitions
* Add partials for label, destination, title
* Add `go`, to attempt something, and do something else on `ok`
Diffstat (limited to 'src/compiler.rs')
-rw-r--r-- | src/compiler.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index 9941fa5..be5d0fe 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -128,6 +128,18 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::CodeTextSequence | TokenType::Content | TokenType::Data + | TokenType::DefinitionLabel + | TokenType::DefinitionLabelMarker + | TokenType::DefinitionLabelData + | TokenType::DefinitionMarker + | TokenType::DefinitionDestination + | TokenType::DefinitionDestinationLiteral + | TokenType::DefinitionDestinationLiteralMarker + | TokenType::DefinitionDestinationRaw + | TokenType::DefinitionDestinationString + | TokenType::DefinitionTitle + | TokenType::DefinitionTitleMarker + | TokenType::DefinitionTitleString | TokenType::HardBreakEscape | TokenType::HardBreakEscapeMarker | TokenType::HardBreakTrailing @@ -148,6 +160,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St } TokenType::CodeFencedFenceInfo | TokenType::CodeFencedFenceMeta + | TokenType::Definition | TokenType::HeadingAtxText | TokenType::HeadingSetextText => { buffer(buffers); @@ -201,6 +214,18 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::CodeIndentedPrefixWhitespace | TokenType::CodeTextSequence | TokenType::Content + | TokenType::DefinitionLabel + | TokenType::DefinitionLabelMarker + | TokenType::DefinitionLabelData + | TokenType::DefinitionMarker + | TokenType::DefinitionDestination + | TokenType::DefinitionDestinationLiteral + | TokenType::DefinitionDestinationLiteralMarker + | TokenType::DefinitionDestinationRaw + | TokenType::DefinitionDestinationString + | TokenType::DefinitionTitle + | TokenType::DefinitionTitleMarker + | TokenType::DefinitionTitleString | TokenType::HardBreakEscapeMarker | TokenType::HardBreakTrailingSpace | TokenType::HeadingSetext @@ -353,6 +378,10 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St TokenType::CodeTextLineEnding => { buf_tail_mut(buffers).push(" ".to_string()); } + TokenType::Definition => { + resume(buffers); + slurp_one_line_ending = true; + } TokenType::HardBreakEscape | TokenType::HardBreakTrailing => { buf_tail_mut(buffers).push("<br />".to_string()); } |