aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/text.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-18 18:33:10 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-18 18:33:17 +0200
commit25e267afbc0789ea36508d45c3ea3545b84223bb (patch)
tree8dee2a78ad1df29e9df7cf151091a5d265fd7ecb /src/construct/text.rs
parent1dbf02d8c1955316c6cc43a427f506b91c87ef3a (diff)
downloadmarkdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.tar.gz
markdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.tar.bz2
markdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.zip
Add support for GFM autolink literals
Diffstat (limited to '')
-rw-r--r--src/construct/text.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/construct/text.rs b/src/construct/text.rs
index 5c13dba..06ba378 100644
--- a/src/construct/text.rs
+++ b/src/construct/text.rs
@@ -20,6 +20,7 @@
//! > 👉 **Note**: for performance reasons, hard break (trailing) is formed by
//! > [whitespace][crate::construct::partial_whitespace].
+use crate::construct::gfm_autolink_literal::resolve as resolve_gfm_autolink_literal;
use crate::construct::partial_whitespace::resolve_whitespace;
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
@@ -45,7 +46,6 @@ const MARKERS: [u8; 9] = [
/// ^
/// ```
pub fn start(tokenizer: &mut Tokenizer) -> State {
- tokenizer.register_resolver(ResolveName::Text);
tokenizer.tokenize_state.markers = &MARKERS;
State::Retry(StateName::TextBefore)
}
@@ -58,7 +58,11 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
/// ```
pub fn before(tokenizer: &mut Tokenizer) -> State {
match tokenizer.current {
- None => State::Ok,
+ None => {
+ tokenizer.register_resolver(ResolveName::Data);
+ tokenizer.register_resolver(ResolveName::Text);
+ State::Ok
+ }
Some(b'!') => {
tokenizer.attempt(
State::Next(StateName::TextBefore),
@@ -170,4 +174,8 @@ pub fn resolve(tokenizer: &mut Tokenizer) {
tokenizer.parse_state.constructs.hard_break_trailing,
true,
);
+
+ if tokenizer.parse_state.constructs.gfm_autolink_literal {
+ resolve_gfm_autolink_literal(tokenizer);
+ }
}