diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-16 12:55:50 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-16 12:55:50 +0200 |
commit | 7350acc692a79d9d4cf56afbc53ac3c9f2a6237c (patch) | |
tree | 02f8b83230a40b509adf4b4872e313544c7fc80f /src/construct/hard_break_escape.rs | |
parent | 58ba69452a25c3d4b2059c01cc6cd837159d2f90 (diff) | |
download | markdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.tar.gz markdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.tar.bz2 markdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.zip |
Add support for hard break (trailing)
Diffstat (limited to 'src/construct/hard_break_escape.rs')
-rw-r--r-- | src/construct/hard_break_escape.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/construct/hard_break_escape.rs b/src/construct/hard_break_escape.rs index a7712d6..51da953 100644 --- a/src/construct/hard_break_escape.rs +++ b/src/construct/hard_break_escape.rs @@ -1,4 +1,4 @@ -//! Hard break escapes are a construct that occurs in the [text][] content +//! Hard break (escape) is a construct that occurs in the [text][] content //! type. //! //! They’re formed with the following BNF: @@ -8,6 +8,15 @@ //! ; instead of ending it). //! hard_break_escape ::= '\\' //! ``` +//! +//! Hard breaks in markdown relate to the HTML element `<br>`. +//! See [*§ 4.5.27 The `br` element* in the HTML spec][html] for more info. +//! +//! It is also possible to create a hard break with a +//! [hard break (trailing)][hard_break_trailing]. +//! That construct is not recommended because trailing spaces are typically +//! invisible in editors, or even automatically removed, making them to use. +//! //! It is also possible to escape punctuation characters with a similar //! construct: a [character escape][character_escape] is a backslash followed //! by an ASCII punctuation character. @@ -22,12 +31,12 @@ //! [text]: crate::content::text //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference -//! -//! <!-- To do: link `hard_break_escape` --> +//! [hard_break_trailing]: crate::construct::hard_break_trailing +//! [html]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-br-element use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; -/// Start of a hard break escape. +/// Start of a hard break (escape). /// /// ```markdown /// a|\ @@ -45,7 +54,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { } } -/// At the end of a hard break escape, after `\`. +/// At the end of a hard break (escape), after `\`. /// /// ```markdown /// a\| |