diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-15 16:00:19 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-15 16:00:19 +0200 |
commit | 58173eb2cca599686611f2676378271de1116448 (patch) | |
tree | 63c3ee2f5b600dd2def66992db37a58a0b07c9ac | |
parent | b7ec5d868bf9d4688fb16dd73f8fe05b3426b86c (diff) | |
download | markdown-rs-58173eb2cca599686611f2676378271de1116448.tar.gz markdown-rs-58173eb2cca599686611f2676378271de1116448.tar.bz2 markdown-rs-58173eb2cca599686611f2676378271de1116448.zip |
Add docs to non-lazy continuation
Diffstat (limited to '')
-rw-r--r-- | src/construct/partial_non_lazy_continuation.rs | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/construct/partial_non_lazy_continuation.rs b/src/construct/partial_non_lazy_continuation.rs index 7964de3..37e9ce3 100644 --- a/src/construct/partial_non_lazy_continuation.rs +++ b/src/construct/partial_non_lazy_continuation.rs @@ -1,23 +1,45 @@ -//! To do. +//! Non-lazy continuation. +//! +//! This is a tiny helper that [flow][] constructs can use to make sure that +//! the following line is not lazy. +//! For example, [html (flow)][html_flow] and code ([fenced][code_fenced], +//! [indented][code_indented]), stop when next line is lazy. +//! +//! [flow]: crate::content::flow +//! [code_fenced]: crate::construct::code_fenced +//! [code_indented]: crate::construct::code_indented +//! [html_flow]: crate::construct::html_flow use crate::token::Token; use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; -/// To do. +/// Start of continuation. +/// +/// ```markdown +/// > | * ```js +/// ^ +/// | b +/// ``` pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => { tokenizer.enter(Token::LineEnding); tokenizer.consume(code); tokenizer.exit(Token::LineEnding); - (State::Fn(Box::new(non_lazy_after)), None) + (State::Fn(Box::new(after)), None) } _ => (State::Nok, None), } } -/// To do. -fn non_lazy_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +/// After line ending. +/// +/// ```markdown +/// | * ```js +/// > | b +/// ^ +/// ``` +fn after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { if tokenizer.lazy { (State::Nok, None) } else { |