diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-22 11:50:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-22 11:50:42 +0200 |
commit | 351c69644bdbdf52c95e322904273657892920b5 (patch) | |
tree | 114a93ff760b522232f9f7290bc6f632b7250095 /src/construct/text.rs | |
parent | 5e6829c2fb79c2b7f59e38f924e2b2900c52b5d5 (diff) | |
download | markdown-rs-351c69644bdbdf52c95e322904273657892920b5.tar.gz markdown-rs-351c69644bdbdf52c95e322904273657892920b5.tar.bz2 markdown-rs-351c69644bdbdf52c95e322904273657892920b5.zip |
Add support for GFM strikethrough
Diffstat (limited to 'src/construct/text.rs')
-rw-r--r-- | src/construct/text.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/construct/text.rs b/src/construct/text.rs index 06ba378..9d40585 100644 --- a/src/construct/text.rs +++ b/src/construct/text.rs @@ -27,7 +27,7 @@ use crate::state::{Name as StateName, State}; use crate::tokenizer::Tokenizer; /// Characters that can start something in text. -const MARKERS: [u8; 9] = [ +const MARKERS: [u8; 10] = [ b'!', // `label_start_image` b'&', // `character_reference` b'*', // `attention` @@ -37,6 +37,7 @@ const MARKERS: [u8; 9] = [ b']', // `label_end` b'_', // `attention` b'`', // `code_text` + b'~', // `attention` (w/ `gfm_strikethrough`) ]; /// Start of text. @@ -77,7 +78,7 @@ pub fn before(tokenizer: &mut Tokenizer) -> State { ); State::Retry(StateName::CharacterReferenceStart) } - Some(b'*' | b'_') => { + Some(b'*' | b'_' | b'~') => { tokenizer.attempt( State::Next(StateName::TextBefore), State::Next(StateName::TextBeforeData), @@ -171,11 +172,16 @@ pub fn before_data(tokenizer: &mut Tokenizer) -> State { pub fn resolve(tokenizer: &mut Tokenizer) { resolve_whitespace( tokenizer, - tokenizer.parse_state.constructs.hard_break_trailing, + tokenizer.parse_state.options.constructs.hard_break_trailing, true, ); - if tokenizer.parse_state.constructs.gfm_autolink_literal { + if tokenizer + .parse_state + .options + .constructs + .gfm_autolink_literal + { resolve_gfm_autolink_literal(tokenizer); } } |