aboutsummaryrefslogtreecommitdiffstats
path: root/src/content/text.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-15 18:17:01 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-15 18:17:01 +0200
commitacc35758778bfda5cb01951533868eb8baa2e2d2 (patch)
tree82ded1c1f88d04a1c37e40822ad7e5a6bba8a717 /src/content/text.rs
parent75dcb48f78a8a798fde525d2d39e20cffec48e50 (diff)
downloadmarkdown-rs-acc35758778bfda5cb01951533868eb8baa2e2d2.tar.gz
markdown-rs-acc35758778bfda5cb01951533868eb8baa2e2d2.tar.bz2
markdown-rs-acc35758778bfda5cb01951533868eb8baa2e2d2.zip
Add code (text)
Diffstat (limited to 'src/content/text.rs')
-rw-r--r--src/content/text.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/content/text.rs b/src/content/text.rs
index 433d030..9d510cb 100644
--- a/src/content/text.rs
+++ b/src/content/text.rs
@@ -9,7 +9,7 @@
//! * Attention
//! * [HTML (text)][crate::construct::html_text]
//! * Hard break escape
-//! * Code (text)
+//! * [Code (text)][crate::construct::code_text]
//! * Line ending
//! * Label start (image)
//! * Label start (link)
@@ -18,7 +18,8 @@
use crate::construct::{
autolink::start as autolink, character_escape::start as character_escape,
- character_reference::start as character_reference, html_text::start as html_text,
+ character_reference::start as character_reference, code_text::start as code_text,
+ html_text::start as html_text,
};
use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer};
@@ -34,11 +35,12 @@ 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_4(
+ _ => tokenizer.attempt_5(
character_reference,
character_escape,
autolink,
html_text,
+ code_text,
|ok| Box::new(if ok { start } else { before_data }),
)(tokenizer, code),
}
@@ -80,7 +82,7 @@ fn in_data(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
(State::Ok, None)
}
// To do: somehow get these markers from constructs.
- Code::CarriageReturnLineFeed | Code::Char('\r' | '\n' | '&' | '\\' | '<') => {
+ Code::CarriageReturnLineFeed | Code::Char('\r' | '\n' | '&' | '<' | '\\' | '`') => {
tokenizer.exit(TokenType::Data);
start(tokenizer, code)
}