aboutsummaryrefslogtreecommitdiffstats
path: root/src/content
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-04 12:16:51 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-04 12:16:58 +0200
commitfaca28020f4894bdfcf5a4b164ebbc75864d8776 (patch)
tree93377413ae8c355e2d804f7e700241693b228e70 /src/content
parente1cae8c705e66669d043f5269e9f58c09c7b0eaa (diff)
downloadmarkdown-rs-faca28020f4894bdfcf5a4b164ebbc75864d8776.tar.gz
markdown-rs-faca28020f4894bdfcf5a4b164ebbc75864d8776.tar.bz2
markdown-rs-faca28020f4894bdfcf5a4b164ebbc75864d8776.zip
Add support for attention (emphasis, strong)
Diffstat (limited to '')
-rw-r--r--src/content/text.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/content/text.rs b/src/content/text.rs
index c3f4e1b..ecb6ae1 100644
--- a/src/content/text.rs
+++ b/src/content/text.rs
@@ -1,12 +1,13 @@
//! The text content type.
//!
-//! **Text** contains phrasing content such as attention (emphasis, strong),
-//! media (links, images), and actual text.
+//! **Text** contains phrasing content such as
+//! [attention][crate::construct::attention] (emphasis, strong),
+//! [code (text)][crate::construct::code_text], and actual text.
//!
//! The constructs found in text are:
//!
+//! * [Attention][crate::construct::attention]
//! * [Autolink][crate::construct::autolink]
-//! * Attention
//! * [HTML (text)][crate::construct::html_text]
//! * [Hard break (escape)][crate::construct::hard_break_escape]
//! * [Hard break (trailing)][crate::construct::hard_break_trailing]
@@ -18,9 +19,9 @@
//! * [Character reference][crate::construct::character_reference]
use crate::construct::{
- autolink::start as autolink, character_escape::start as character_escape,
- character_reference::start as character_reference, code_text::start as code_text,
- hard_break_escape::start as hard_break_escape,
+ attention::start as attention, autolink::start as autolink,
+ character_escape::start as character_escape, character_reference::start as character_reference,
+ code_text::start as code_text, hard_break_escape::start as hard_break_escape,
hard_break_trailing::start as hard_break_trailing, html_text::start as html_text,
label_end::start as label_end, label_start_image::start as label_start_image,
label_start_link::start as label_start_link, partial_data::start as data,
@@ -28,16 +29,18 @@ use crate::construct::{
};
use crate::tokenizer::{Code, State, StateFnResult, Tokenizer};
-const MARKERS: [Code; 10] = [
+const MARKERS: [Code; 12] = [
Code::VirtualSpace, // `whitespace`
Code::Char('\t'), // `whitespace`
Code::Char(' '), // `hard_break_trailing`, `whitespace`
Code::Char('!'), // `label_start_image`
Code::Char('&'), // `character_reference`
+ Code::Char('*'), // `attention`
Code::Char('<'), // `autolink`, `html_text`
Code::Char('['), // `label_start_link`
Code::Char('\\'), // `character_escape`, `hard_break_escape`
Code::Char(']'), // `label_end`
+ Code::Char('_'), // `attention`
Code::Char('`'), // `code_text`
];
@@ -55,6 +58,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
Code::None => (State::Ok, None),
_ => tokenizer.attempt_n(
vec![
+ Box::new(attention),
Box::new(autolink),
Box::new(character_escape),
Box::new(character_reference),