From 1c3b6e900d9b23e8a1f34f1c5b7b9657bd7c1451 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 7 Jul 2022 17:56:37 +0200 Subject: Add docs for block quote tokens --- src/construct/block_quote.rs | 8 ++--- src/tokenizer.rs | 77 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index 048ff53..a3ffbc7 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -20,9 +20,9 @@ //! ## Tokens //! //! * [`BlockQuote`][TokenType::BlockQuote] -//! * [`BlockQuotePrefix`][TokenType::BlockQuotePrefix] //! * [`BlockQuoteMarker`][TokenType::BlockQuoteMarker] -//! * [`BlockQuotePrefixWhitespace`][TokenType::BlockQuotePrefixWhitespace] +//! * [`BlockQuotePrefix`][TokenType::BlockQuotePrefix] +//! * [`BlockQuoteWhitespace`][TokenType::BlockQuoteWhitespace] //! //! ## References //! @@ -101,9 +101,9 @@ fn cont_before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { fn cont_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::VirtualSpace | Code::Char('\t' | ' ') => { - tokenizer.enter(TokenType::BlockQuotePrefixWhitespace); + tokenizer.enter(TokenType::BlockQuoteWhitespace); tokenizer.consume(code); - tokenizer.exit(TokenType::BlockQuotePrefixWhitespace); + tokenizer.exit(TokenType::BlockQuoteWhitespace); tokenizer.exit(TokenType::BlockQuotePrefix); (State::Ok, None) } diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 069134a..c1a23eb 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -113,10 +113,85 @@ pub enum TokenType { /// ^ /// ``` BlankLineEnding, + /// Whole block quote. + /// + /// ## Info + /// + /// * **Context**: + /// [document content][crate::content::document] + /// * **Content model**: + /// [`BlockQuotePrefix`][TokenType::BlockQuotePrefix], + /// [flow content][crate::content::flow] + /// * **Construct**: + /// [`block_quote`][crate::construct::block_quote] + /// + /// ## Example + /// + /// ```markdown + /// > | > a + /// ^^^ + /// > | b + /// ^ + /// ``` BlockQuote, + /// Block quote marker. + /// + /// ## Info + /// + /// * **Context**: + /// [`BlockQuotePrefix`][TokenType::BlockQuotePrefix] + /// * **Content model**: + /// void + /// * **Construct**: + /// [`block_quote`][crate::construct::block_quote] + /// + /// ## Example + /// + /// ```markdown + /// > | > a + /// ^ + /// | b + /// ``` BlockQuoteMarker, + /// Block quote prefix. + /// + /// ## Info + /// + /// * **Context**: + /// [`BlockQuote`][TokenType::BlockQuote] + /// * **Content model**: + /// [`BlockQuoteMarker`][TokenType::BlockQuoteMarker], + /// [`BlockQuoteWhitespace`][TokenType::BlockQuoteWhitespace] + /// * **Construct**: + /// [`block_quote`][crate::construct::block_quote] + /// + /// ## Example + /// + /// ```markdown + /// > | > a + /// ^^ + /// | b + /// ``` BlockQuotePrefix, - BlockQuotePrefixWhitespace, + /// Block quote white space. + /// + /// ## Info + /// + /// * **Context**: + /// [`BlockQuotePrefix`][TokenType::BlockQuotePrefix] + /// * **Content model**: + /// void + /// * **Construct**: + /// [`block_quote`][crate::construct::block_quote] + /// + /// ## Example + /// + /// ```markdown + /// > | > a + /// ^ + /// | b + /// ``` + BlockQuoteWhitespace, /// Whole character escape. /// /// ## Info -- cgit