From e9db93b428bc3da7c1fa3bcf8acf166012cf18c8 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 28 Jun 2022 15:15:26 +0200 Subject: Add docs for label start (image, link) --- readme.md | 2 +- src/construct/label_start_image.rs | 31 ++++++++++++++++++++++++++++++- src/construct/label_start_link.rs | 30 +++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 9dd546f..1250ab6 100644 --- a/readme.md +++ b/readme.md @@ -124,7 +124,6 @@ cargo doc --document-private-items #### Docs -- [ ] (1) `label_start_image`, `label_start_link` - [ ] (1) `label_end` - [ ] (1) `space_or_tab_one_line_ending` - [ ] (1) `ParseState` @@ -284,3 +283,4 @@ important. - [x] (1) Add module docs to parser - [x] (1) Add improved docs in compiler - [x] (1) Add docs for `RESOURCE_DESTINATION_BALANCE_MAX` +- [x] (1) Add docs for `label_start_image`, `label_start_link` diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index 2e96977..97231e0 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -1,4 +1,33 @@ -//! To do +//! Label start (image) is a construct that occurs in the [text][] content +//! type. +//! +//! It forms with the following BNF: +//! +//! ```bnf +//! label_start_image ::= '!' '[' +//! ``` +//! +//! Label start (images) relates to the `` element in HTML. +//! See [*§ 4.8.3 The `img` element*][html-img] in the HTML spec for more info. +//! +//! Whether it contributes an image depends on whether it is followed by a +//! valid [label end][label_end] or not. +//! Without an end, the characters (`![`) are output. +//! +//! ## Tokens +//! +//! * [`LabelImage`][TokenType::LabelImage] +//! * [`LabelImageMarker`][TokenType::LabelImageMarker] +//! * [`LabelMarker`][TokenType::LabelMarker] +//! +//! ## References +//! +//! * [`label-start-image.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/label-start-image.js) +//! * [*§ 6.4 Images* in `CommonMark`](https://spec.commonmark.org/0.30/#images) +//! +//! [text]: crate::content::text +//! [label_end]: crate::construct::label_end +//! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element use super::label_end::resolve_media; use crate::tokenizer::{Code, LabelStart, State, StateFnResult, TokenType, Tokenizer}; diff --git a/src/construct/label_start_link.rs b/src/construct/label_start_link.rs index 35c9dcd..677fb50 100644 --- a/src/construct/label_start_link.rs +++ b/src/construct/label_start_link.rs @@ -1,4 +1,32 @@ -//! To do +//! Label start (link) is a construct that occurs in the [text][] content +//! type. +//! +//! It forms with the following BNF: +//! +//! ```bnf +//! label_start_link ::= '[' +//! ``` +//! +//! Label start (link) relates to the `` element in HTML. +//! See [*§ 4.5.1 The `a` element*][html-a] in the HTML spec for more info. +//! +//! Whether it contributes a link depends on whether it is followed by a +//! valid [label end][label_end] or not. +//! Without an end, the characters (`[`) are output. +//! +//! ## Tokens +//! +//! * [`LabelLink`][TokenType::LabelLink] +//! * [`LabelMarker`][TokenType::LabelMarker] +//! +//! ## References +//! +//! * [`label-start-link.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/label-start-link.js) +//! * [*§ 6.3 Links* in `CommonMark`](https://spec.commonmark.org/0.30/#links) +//! +//! [text]: crate::content::text +//! [label_end]: crate::construct::label_end +//! [html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element use super::label_end::resolve_media; use crate::tokenizer::{Code, LabelStart, State, StateFnResult, TokenType, Tokenizer}; -- cgit