aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/string.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-14 16:21:42 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-14 16:26:24 +0200
commit74d2688aa329f0a41c2a92034c3454ed9299e71a (patch)
tree9ec8fdc6e40ff7cd40a14408afcc47716990134e /src/construct/string.rs
parent65d4b46c2a3bdecb0493e484473d2de3d124f839 (diff)
downloadmarkdown-rs-74d2688aa329f0a41c2a92034c3454ed9299e71a.tar.gz
markdown-rs-74d2688aa329f0a41c2a92034c3454ed9299e71a.tar.bz2
markdown-rs-74d2688aa329f0a41c2a92034c3454ed9299e71a.zip
Fix to prefer flow over definitions, setext headings
An undocumented part of CommonMark is how to deal with things in definition labels or definition titles (which both can span multiple lines). Can flow (or containers?) interrupt them? They can according to the `cmark` reference parser, so this was implemented here. This adds a new `Content` content type, which houses zero or more definitions, and then zero-or-one paragraphs. Content can be followed by a setext heading underline, which either turns into a setext heading when the content ends in a paragraph, or turns into the start of the following paragraph when it is followed by content that starts with a paragraph, or turns into a stray paragraph.
Diffstat (limited to 'src/construct/string.rs')
-rw-r--r--src/construct/string.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/construct/string.rs b/src/construct/string.rs
index dba1ac1..cf2f222 100644
--- a/src/construct/string.rs
+++ b/src/construct/string.rs
@@ -15,7 +15,9 @@
use crate::construct::partial_whitespace::resolve_whitespace;
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
+use crate::subtokenize::Subresult;
use crate::tokenizer::Tokenizer;
+use alloc::string::String;
/// Characters that can start something in string.
const MARKERS: [u8; 2] = [b'&', b'\\'];
@@ -74,6 +76,8 @@ pub fn before_data(tokenizer: &mut Tokenizer) -> State {
}
/// Resolve whitespace in string.
-pub fn resolve(tokenizer: &mut Tokenizer) {
+pub fn resolve(tokenizer: &mut Tokenizer) -> Result<Option<Subresult>, String> {
resolve_whitespace(tokenizer, false, false);
+
+ Ok(None)
}