aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-28 17:11:04 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-28 17:12:37 +0200
commit7bb1008f508f61b51dd80086a91ada347be36c68 (patch)
tree05a652df5d4230c756ed551df37fe3346a9447d5
parent6e9447b5ec7f1823b7d08ed8f51eed23d3856cce (diff)
downloadmarkdown-rs-7bb1008f508f61b51dd80086a91ada347be36c68.tar.gz
markdown-rs-7bb1008f508f61b51dd80086a91ada347be36c68.tar.bz2
markdown-rs-7bb1008f508f61b51dd80086a91ada347be36c68.zip
Add some more crosslinks to docs
Diffstat (limited to '')
-rw-r--r--readme.md7
-rw-r--r--src/construct/autolink.rs5
-rw-r--r--src/construct/definition.rs23
-rw-r--r--src/construct/label_end.rs6
-rw-r--r--src/construct/partial_destination.rs2
-rw-r--r--src/construct/partial_label.rs16
-rw-r--r--src/construct/partial_title.rs5
-rw-r--r--src/util/normalize_identifier.rs5
8 files changed, 33 insertions, 36 deletions
diff --git a/readme.md b/readme.md
index 4f7d4a0..155e71c 100644
--- a/readme.md
+++ b/readme.md
@@ -149,11 +149,8 @@ cargo doc --document-private-items
`heading_atx`, `heading_setext`, `html_flow`, `misc_soft_break`,
`misc_tabs`, `thematic_break`)
- [ ] (3) Interrupting (html flow complete)
-- [ ] (5) labels\
- test (`character_escape`, `character_reference`, `definition`)\
- link link reference (definition)\
- link label end (destination, label, title)\
- link label start (label)
+- [ ] (5) label end (reference)\
+ test (`character_escape`, `character_reference`, `definition`)
- [ ] (5) attention\
test (`character_reference`, `hard_break_escape`, `hard_break_trailing`,
`heading_atx`, `heading_setext`, `html_flow`, `thematic_break`)\
diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs
index e94066b..6486a2d 100644
--- a/src/construct/autolink.rs
+++ b/src/construct/autolink.rs
@@ -62,8 +62,8 @@
//! are not considered HTML.
//!
//! While `CommonMark` restricts links from occurring in other links in the
-//! case of bracketed links, this restriction is not in place for autolinks
-//! inside autolinks:
+//! case of labels (see [label end][label_end]), this restriction is not in
+//! place for autolinks inside labels:
//!
//! ```markdown
//! [<https://example.com>](#)
@@ -95,6 +95,7 @@
//! * [*§ 6.4 Autolinks* in `CommonMark`](https://spec.commonmark.org/0.30/#autolinks)
//!
//! [text]: crate::content::text
+//! [label_end]: crate::construct::label_end
//! [autolink_scheme_size_max]: crate::constant::AUTOLINK_SCHEME_SIZE_MAX
//! [autolink_domain_size_max]: crate::constant::AUTOLINK_DOMAIN_SIZE_MAX
//! [sanitize_uri]: crate::util::sanitize_uri
diff --git a/src/construct/definition.rs b/src/construct/definition.rs
index 6a3aceb..5e80a93 100644
--- a/src/construct/definition.rs
+++ b/src/construct/definition.rs
@@ -5,22 +5,20 @@
//! ```bnf
//! definition ::= label ':' whitespace destination [ whitespace title ] [ space_or_tab ]
//!
-//! whitespace ::= eol *whitespace | 1*space_or_tab [ eol *whitespace ]
-//! space_or_tab ::= ' ' | '\t'
+//! ; See the `destination`, `title`, and `label` constructs for the BNF of
+//! ; those parts.
//! ```
//!
-//! See [`destination`][destination], [`title`][title], and [`label`][label]
+//! See [`destination`][destination], [`label`][label], and [`title`][title]
//! for grammar, notes, and recommendations.
//!
//! Definitions in markdown do not, on their own, relate to anything in HTML.
-//! When matched with a link (reference), they together relate to the `<a>`
-//! element in HTML.
-//! The definition forms its `href`, and optionally `title`, attributes.
-//! See [*§ 4.5.1 The `a` element*][html-a] in the HTML spec for more info.
-//! Definitions can also match with image (reference), in which case they
-//! form an `<img>` element, where the definition contributes the `src`, and
-//! optionally `title`, attributes.
-//! See [*§ 4.8.3 The `img` element*][html-img] in the HTML spec for more info.
+//! When matched with a [label end (reference)][label_end], they together
+//! relate to the `<a>` or `<img>` elements in HTML.
+//! The definition forms its `href` or `src`, and optionally `title`,
+//! attributes.
+//! See [*§ 4.5.1 The `a` element*][html-a] and
+//! [*§ 4.8.3 The `img` element*][html-img] in the HTML spec for more info.
//!
//! The `label`, `destination`, and `title` parts are interpreted as the
//! [string][] content type.
@@ -86,6 +84,7 @@
//! [string]: crate::content::string
//! [character_escape]: crate::construct::character_escape
//! [character_reference]: crate::construct::character_reference
+//! [label_end]: crate::construct::label_end
//! [destination]: crate::construct::partial_destination
//! [title]: crate::construct::partial_title
//! [label]: crate::construct::partial_label
@@ -93,8 +92,6 @@
//! [normalize_identifier]: crate::util::normalize_identifier
//! [html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
//! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element
-//!
-//! <!-- To do: link link/image (reference) -->
use crate::construct::{
partial_destination::{start as destination, Options as DestinationOptions},
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs
index 05c7635..581e5e9 100644
--- a/src/construct/label_end.rs
+++ b/src/construct/label_end.rs
@@ -13,7 +13,7 @@
//! ; those parts.
//! ```
//!
-//! See [`destination`][destination], [`title`][title], and [`label`][label]
+//! See [`destination`][destination], [`label`][label], and [`title`][title]
//! for grammar, notes, and recommendations.
//!
//! Label end does not, on its own, relate to anything in HTML.
@@ -95,8 +95,8 @@
//!
//! This limiation is imposed because links in links is invalid according to
//! HTML.
-//! Technically though, it is possible by using an [autolink][] in a link,
-//! but you definitely should not do that.
+//! Technically though, it is still possible to construct them by using an
+//! [autolink][] in a link, but you definitely should not do that.
//!
//! ## Tokens
//!
diff --git a/src/construct/partial_destination.rs b/src/construct/partial_destination.rs
index 71e26df..8b281c7 100644
--- a/src/construct/partial_destination.rs
+++ b/src/construct/partial_destination.rs
@@ -1,4 +1,4 @@
-//! Destination occurs in [definition][] and [label end][].
+//! Destination occurs in [definition][] and [label end][label_end].
//!
//! They’re formed with the following BNF:
//!
diff --git a/src/construct/partial_label.rs b/src/construct/partial_label.rs
index dd8ee84..2e8e950 100644
--- a/src/construct/partial_label.rs
+++ b/src/construct/partial_label.rs
@@ -37,9 +37,11 @@
//! > `y`.
//! >
//! > The thing that contains `x` is not a single thing when parsing markdown,
-//! > but instead constists of an opening (label start (image) or label start
-//! > (link)) and a closing (label end), so as to allow further phrasing such
-//! > as code (text) or attention.
+//! > but instead constists of an opening
+//! > ([label start (image)][label_start_image] or
+//! > [label start (link)][label_start_link]) and a closing
+//! > ([label end][label_end]), so as to allow further phrasing such as
+//! > [code (text)][code_text] or attention.
//!
//! ## References
//!
@@ -49,11 +51,13 @@
//! [string]: crate::content::string
//! [character_escape]: crate::construct::character_escape
//! [character_reference]: crate::construct::character_reference
+//! [label_start_image]: crate::construct::label_start_image
+//! [label_start_link]: crate::construct::label_start_link
+//! [label_end]: crate::construct::label_end
+//! [code_text]: crate::construct::code_text
//! [link_reference_size_max]: crate::constant::LINK_REFERENCE_SIZE_MAX
//!
-//! <!-- To do: link label end, label starts. -->
-
-// To do: pass token types in.
+//! <!-- To do: link attention. -->
use super::partial_space_or_tab::{
space_or_tab_one_line_ending_with_options, OneLineEndingOptions,
diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs
index b102f7e..044a8db 100644
--- a/src/construct/partial_title.rs
+++ b/src/construct/partial_title.rs
@@ -1,4 +1,4 @@
-//! Title occurs in [definition][] and label end.
+//! Title occurs in [definition][] and [label end][label_end].
//!
//! They’re formed with the following BNF:
//!
@@ -28,8 +28,7 @@
//! [string]: crate::content::string
//! [character_escape]: crate::construct::character_escape
//! [character_reference]: crate::construct::character_reference
-//!
-//! <!-- To do: link label end. -->
+//! [label_end]: crate::construct::label_end
use super::partial_space_or_tab::{
space_or_tab_one_line_ending_with_options, OneLineEndingOptions,
diff --git a/src/util/normalize_identifier.rs b/src/util/normalize_identifier.rs
index c287e1a..4753f7b 100644
--- a/src/util/normalize_identifier.rs
+++ b/src/util/normalize_identifier.rs
@@ -1,6 +1,6 @@
//! Utility to normalize identifiers.
-/// Normalize an identifier, as found in references and
+/// Normalize an identifier, as found in [references][label_end] and
/// [definitions][definition], so it can be compared when matching.
///
/// This collapsed whitespace found in markdown (`\t`, `\r`, `\n`, and ` `)
@@ -30,8 +30,7 @@
/// * [`micromark-util-normalize-identifier` in `micromark`](https://github.com/micromark/micromark/tree/main/packages/micromark-util-normalize-identifier)
///
/// [definition]: crate::construct::definition
-///
-/// <!--To do: link resource.-->
+/// [label_end]: crate::construct::label_end
pub fn normalize_identifier(value: &str) -> String {
let mut codes = vec![];
let mut at_start = true;