diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-13 12:37:25 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-13 12:37:25 +0200 |
commit | efdf90959f78d1582da312bffbefaabb79f264b7 (patch) | |
tree | a36c7dfa72ec5cadfdb296d94aed2d06a871b701 /src/content/text.rs | |
parent | 17f4eec55ad0a5f74aedbcff6c2f0119ad52e584 (diff) | |
download | markdown-rs-efdf90959f78d1582da312bffbefaabb79f264b7.tar.gz markdown-rs-efdf90959f78d1582da312bffbefaabb79f264b7.tar.bz2 markdown-rs-efdf90959f78d1582da312bffbefaabb79f264b7.zip |
Add autolinks
Diffstat (limited to '')
-rw-r--r-- | src/content/text.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/content/text.rs b/src/content/text.rs index 2c93b18..a7b40e7 100644 --- a/src/content/text.rs +++ b/src/content/text.rs @@ -5,7 +5,7 @@ //! //! The constructs found in text are: //! -//! * Autolink +//! * [Autolink][crate::construct::autolink] //! * Attention //! * HTML (text) //! * Hard break escape @@ -17,7 +17,8 @@ //! * [Character reference][crate::construct::character_reference] use crate::construct::{ - character_escape::start as character_escape, character_reference::start as character_reference, + autolink::start as autolink, character_escape::start as character_escape, + character_reference::start as character_reference, }; use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; @@ -33,7 +34,7 @@ use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::None => (State::Ok, None), - _ => tokenizer.attempt_2(character_reference, character_escape, |ok| { + _ => tokenizer.attempt_3(character_reference, character_escape, autolink, |ok| { Box::new(if ok { start } else { before_data }) })(tokenizer, code), } @@ -68,7 +69,7 @@ fn in_data(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { (State::Ok, None) } // To do: somehow get these markers from constructs. - Code::Char('&' | '\\') => { + Code::Char('&' | '\\' | '<') => { tokenizer.exit(TokenType::Data); start(tokenizer, code) } |