aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/label_start_image.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-28 15:15:26 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-28 15:15:26 +0200
commite9db93b428bc3da7c1fa3bcf8acf166012cf18c8 (patch)
treef3998ce57afcd1c148967713899436a4213a6ca7 /src/construct/label_start_image.rs
parent769e7011d37a2ad54630aeebdb0b0163a0825f75 (diff)
downloadmarkdown-rs-e9db93b428bc3da7c1fa3bcf8acf166012cf18c8.tar.gz
markdown-rs-e9db93b428bc3da7c1fa3bcf8acf166012cf18c8.tar.bz2
markdown-rs-e9db93b428bc3da7c1fa3bcf8acf166012cf18c8.zip
Add docs for label start (image, link)
Diffstat (limited to '')
-rw-r--r--src/construct/label_start_image.rs31
1 files changed, 30 insertions, 1 deletions
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 `<img>` 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};