aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-30 10:49:02 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-30 10:49:02 +0200
commit8677e0cf761852734da430569638960582e5cd6f (patch)
tree7f13aed624bd7ea80df8771de0ba10abc0234ffd
parent9036ab2c6eb394cc26fc53e7bdce5bb182450bae (diff)
downloadmarkdown-rs-8677e0cf761852734da430569638960582e5cd6f.tar.gz
markdown-rs-8677e0cf761852734da430569638960582e5cd6f.tar.bz2
markdown-rs-8677e0cf761852734da430569638960582e5cd6f.zip
Add docs to image, link, and other media tokens
Diffstat (limited to '')
-rw-r--r--readme.md2
-rw-r--r--src/tokenizer.rs450
2 files changed, 435 insertions, 17 deletions
diff --git a/readme.md b/readme.md
index 7c70905..dd3dd9b 100644
--- a/readme.md
+++ b/readme.md
@@ -124,7 +124,6 @@ cargo doc --document-private-items
- [ ] (1) `space_or_tab_one_line_ending`
- [ ] (1) `ParseState`
-- [ ] (1) Image, Link, and other media token types; `LabelStart`, `Media`
- [ ] (1) Resolvers, push, feed, etc.
- [ ] (1) Go through all bnf
- [ ] (1) Go through all docs
@@ -283,3 +282,4 @@ important.
- [x] (5) Add support for sharing identifiers, references before definitions
- [x] (2) Refactor to externalize handlers of compiler
- [x] (1) Add support for compiling shared references and definitions
+- [x] (1) Add docs to Image, Link, and other media tokens
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index cb02e21..950c935 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -525,7 +525,7 @@ pub enum TokenType {
/// * **Content model**:
/// void
/// * **Construct**:
- /// [`partial_data`][crate::construct::partial_data]
+ /// [`data`][crate::construct::partial_data]
///
/// ## Example
///
@@ -569,7 +569,7 @@ pub enum TokenType {
/// [`LineEnding`][TokenType::LineEnding],
/// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
- /// [`partial_label`][crate::construct::partial_label]
+ /// [`label`][crate::construct::partial_label]
///
/// ## Example
///
@@ -587,7 +587,7 @@ pub enum TokenType {
/// * **Content model**:
/// void
/// * **Construct**:
- /// [`partial_label`][crate::construct::partial_label]
+ /// [`label`][crate::construct::partial_label]
///
/// ## Example
///
@@ -605,7 +605,7 @@ pub enum TokenType {
/// * **Content model**:
/// [string content][crate::content::string]
/// * **Construct**:
- /// [`partial_label`][crate::construct::partial_label]
+ /// [`label`][crate::construct::partial_label]
///
/// ## Example
///
@@ -642,7 +642,7 @@ pub enum TokenType {
/// [`DefinitionDestinationLiteral`][TokenType::DefinitionDestinationLiteral],
/// [`DefinitionDestinationRaw`][TokenType::DefinitionDestinationRaw]
/// * **Construct**:
- /// [`partial_destination`][crate::construct::partial_destination]
+ /// [`destination`][crate::construct::partial_destination]
///
/// ## Example
///
@@ -663,7 +663,7 @@ pub enum TokenType {
/// [`DefinitionDestinationLiteralMarker`][TokenType::DefinitionDestinationLiteralMarker],
/// [`DefinitionDestinationString`][TokenType::DefinitionDestinationString]
/// * **Construct**:
- /// [`partial_destination`][crate::construct::partial_destination]
+ /// [`destination`][crate::construct::partial_destination]
///
/// ## Example
///
@@ -681,7 +681,7 @@ pub enum TokenType {
/// * **Content model**:
/// void
/// * **Construct**:
- /// [`partial_destination`][crate::construct::partial_destination]
+ /// [`destination`][crate::construct::partial_destination]
///
/// ## Example
///
@@ -699,7 +699,7 @@ pub enum TokenType {
/// * **Content model**:
/// [`DefinitionDestinationString`][TokenType::DefinitionDestinationString]
/// * **Construct**:
- /// [`partial_destination`][crate::construct::partial_destination]
+ /// [`destination`][crate::construct::partial_destination]
///
/// ## Example
///
@@ -718,7 +718,7 @@ pub enum TokenType {
/// * **Content model**:
/// [string content][crate::content::string]
/// * **Construct**:
- /// [`partial_destination`][crate::construct::partial_destination]
+ /// [`destination`][crate::construct::partial_destination]
///
/// ## Example
///
@@ -741,7 +741,7 @@ pub enum TokenType {
/// [`LineEnding`][TokenType::LineEnding],
/// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
- /// [`partial_title`][crate::construct::partial_title]
+ /// [`title`][crate::construct::partial_title]
///
/// ## Example
///
@@ -759,7 +759,7 @@ pub enum TokenType {
/// * **Content model**:
/// void
/// * **Construct**:
- /// [`partial_title`][crate::construct::partial_title]
+ /// [`title`][crate::construct::partial_title]
///
/// ## Example
///
@@ -777,7 +777,7 @@ pub enum TokenType {
/// * **Content model**:
/// [string content][crate::content::string]
/// * **Construct**:
- /// [`partial_title`][crate::construct::partial_title]
+ /// [`title`][crate::construct::partial_title]
///
/// ## Example
///
@@ -1055,31 +1055,449 @@ pub enum TokenType {
/// ^^^
/// ```
HtmlTextData,
- /// To do,
+ /// Label start (image).
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Label`][TokenType::Label]
+ /// * **Content model**:
+ /// [`LabelImageMarker`][TokenType::LabelImageMarker],
+ /// [`LabelMarker`][TokenType::LabelMarker]
+ /// * **Construct**:
+ /// [`label_start_image`][crate::construct::label_start_image]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c) d
+ /// ^^
+ /// ```
LabelImage,
- /// To do,
+ /// Label start (image) marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`LabelImage`][TokenType::LabelImage]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`label_start_image`][crate::construct::label_start_image]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c) d
+ /// ^
+ /// ```
LabelImageMarker,
- /// To do,
+ /// Label start (link).
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Label`][TokenType::Label]
+ /// * **Content model**:
+ /// [`LabelMarker`][TokenType::LabelMarker]
+ /// * **Construct**:
+ /// [`label_start_link`][crate::construct::label_start_link]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a [b](c) d
+ /// ^
+ /// ```
LabelLink,
- /// To do,
+ /// Label marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`LabelImage`][TokenType::LabelImage],
+ /// [`LabelLink`][TokenType::LabelLink],
+ /// [`LabelEnd`][TokenType::LabelEnd]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`label_start_image`][crate::construct::label_start_image],
+ /// [`label_start_link`][crate::construct::label_start_link],
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c) d
+ /// ^ ^
+ /// > | a [b](c) d
+ /// ^ ^
+ /// ```
LabelMarker,
+ /// Label end.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Label`][TokenType::Label]
+ /// * **Content model**:
+ /// [`LabelMarker`][TokenType::LabelMarker]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c) d
+ /// ^
+ /// > | a [b](c) d
+ /// ^
+ /// ```
LabelEnd,
+ /// Resource.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Image`][TokenType::Image],
+ /// [`Link`][TokenType::Link]
+ /// * **Content model**:
+ /// [`ResourceMarker`][TokenType::ResourceMarker],
+ /// [`ResourceDestination`][TokenType::ResourceDestination],
+ /// [`ResourceTitle`][TokenType::ResourceTitle],
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab],
+ /// [`LineEnding`][TokenType::LineEnding]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c "d") e
+ /// ^^^^^^^
+ /// > | a [b](c) d
+ /// ^^^
+ /// ```
Resource,
+ /// Resource marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Resource`][TokenType::Resource]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c "d") e
+ /// ^ ^
+ /// ```
ResourceMarker,
+ /// Resource destination.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Resource`][TokenType::Resource]
+ /// * **Content model**:
+ /// [`ResourceDestinationLiteral`][TokenType::ResourceDestinationLiteral],
+ /// [`ResourceDestinationRaw`][TokenType::ResourceDestinationRaw]
+ /// * **Construct**:
+ /// [`destination`][crate::construct::partial_destination]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c "d") e
+ /// ^
+ /// ```
ResourceDestination,
+ /// Resource destination literal.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceDestination`][TokenType::ResourceDestination]
+ /// * **Content model**:
+ /// [`ResourceDestinationLiteralMarker`][TokenType::ResourceDestinationLiteralMarker],
+ /// [`ResourceDestinationString`][TokenType::ResourceDestinationString]
+ /// * **Construct**:
+ /// [`destination`][crate::construct::partial_destination]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^^^
+ /// ```
ResourceDestinationLiteral,
+ /// Resource destination literal marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceDestinationLiteral`][TokenType::ResourceDestinationLiteral]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`destination`][crate::construct::partial_destination]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^ ^
+ /// ```
ResourceDestinationLiteralMarker,
+ /// Resource destination raw.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceDestination`][TokenType::ResourceDestination]
+ /// * **Content model**:
+ /// [`ResourceDestinationString`][TokenType::ResourceDestinationString]
+ /// * **Construct**:
+ /// [`destination`][crate::construct::partial_destination]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](c "d") e
+ /// ^
+ /// ```
ResourceDestinationRaw,
+ /// Resource destination raw.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceDestinationLiteral`][TokenType::ResourceDestinationLiteral],
+ /// [`ResourceDestinationRaw`][TokenType::ResourceDestinationRaw]
+ /// * **Content model**:
+ /// [string content][crate::content::string]
+ /// * **Construct**:
+ /// [`destination`][crate::construct::partial_destination]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^
+ /// > | a ![b](c "d") e
+ /// ^
+ /// ```
ResourceDestinationString,
+ /// Resource title.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Resource`][TokenType::Resource]
+ /// * **Content model**:
+ /// [`ResourceTitleMarker`][TokenType::ResourceTitleMarker],
+ /// [`ResourceTitleString`][TokenType::ResourceTitleString]
+ /// * **Construct**:
+ /// [`title`][crate::construct::partial_title]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^^^
+ /// ```
ResourceTitle,
+ /// Resource title marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceTitle`][TokenType::ResourceTitle]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`title`][crate::construct::partial_title]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^ ^
+ /// ```
ResourceTitleMarker,
+ /// Resource title string.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`ResourceTitle`][TokenType::ResourceTitle]
+ /// * **Content model**:
+ /// [string content][crate::content::string]
+ /// * **Construct**:
+ /// [`title`][crate::construct::partial_title]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b](<c> "d") e
+ /// ^
+ /// ```
ResourceTitleString,
+ /// Reference.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Image`][TokenType::Image],
+ /// [`Link`][TokenType::Link]
+ /// * **Content model**:
+ /// [`ReferenceMarker`][TokenType::ReferenceMarker],
+ /// [`ReferenceString`][TokenType::ReferenceString]
+ /// * **Construct**:
+ /// [`label`][crate::construct::partial_label]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b][c] d
+ /// ^^^
+ /// ```
Reference,
+ /// Reference marker.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Reference`][TokenType::Reference]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`label`][crate::construct::partial_label]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b][c] d
+ /// ^ ^
+ /// ```
ReferenceMarker,
+ /// Reference string.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Reference`][TokenType::Reference]
+ /// * **Content model**:
+ /// [string content][crate::content::string]
+ /// * **Construct**:
+ /// [`label`][crate::construct::partial_label]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b][c] d
+ /// ^
+ /// ```
ReferenceString,
+ /// Link.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [text content][crate::content::text]
+ /// * **Content model**:
+ /// [`Label`][TokenType::Label],
+ /// [`Resource`][TokenType::Resource],
+ /// [`Reference`][TokenType::Reference]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a [b] c
+ /// ^^^
+ /// > | a [b][c] d
+ /// ^^^^^^
+ /// > | a [b](c) d
+ /// ^^^^^^
+ /// ```
Link,
+ /// Image.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [text content][crate::content::text]
+ /// * **Content model**:
+ /// [`Label`][TokenType::Label],
+ /// [`Resource`][TokenType::Resource],
+ /// [`Reference`][TokenType::Reference]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a ![b] c
+ /// ^^^^
+ /// > | a ![b][c] d
+ /// ^^^^^^^
+ /// > | a ![b](c) d
+ /// ^^^^^^^
+ /// ```
Image,
+ /// Label.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Image`][TokenType::Image],
+ /// [`Link`][TokenType::Link]
+ /// * **Content model**:
+ /// [`LabelImage`][TokenType::LabelImage],
+ /// [`LabelLink`][TokenType::LabelLink],
+ /// [`LabelEnd`][TokenType::LabelEnd],
+ /// [`LabelText`][TokenType::LabelText]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a [b] c
+ /// ^^^
+ /// > | a ![b][c] d
+ /// ^^^^
+ /// > | a [b](c) d
+ /// ^^^
+ /// ```
Label,
+ /// Label text.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Label`][TokenType::Label]
+ /// * **Content model**:
+ /// [text content][crate::content::text]
+ /// * **Construct**:
+ /// [`label_end`][crate::construct::label_end]
+ ///
+ /// ## Example
+ ///
+ /// ```markdown
+ /// > | a [b] c
+ /// ^
+ /// > | a ![b][c] d
+ /// ^
+ /// > | a [b](c) d
+ /// ^
+ /// ```
LabelText,
/// Line ending.
///