diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-24 17:57:10 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-24 17:57:10 +0200 |
commit | a3dd207e3b1ebcbcb6cec0f703a695e51ae4ece0 (patch) | |
tree | 7b4bf040da23a03f38efe92a252e187a630a14f6 /src/constant.rs | |
parent | e7b3761c8cd6f0f902dd9927e4fbf2589465ed57 (diff) | |
download | markdown-rs-a3dd207e3b1ebcbcb6cec0f703a695e51ae4ece0.tar.gz markdown-rs-a3dd207e3b1ebcbcb6cec0f703a695e51ae4ece0.tar.bz2 markdown-rs-a3dd207e3b1ebcbcb6cec0f703a695e51ae4ece0.zip |
Add link, images (resource)
This is still some messy code that needs cleaning up, but it adds support for
links and images, of the resource kind (`[a](b)`).
References (`[a][b]`) are parsed and will soon be supported, but need matching.
* Fix bug to pad percent-encoded bytes when normalizing urls
* Fix bug with escapes counting as balancing in destination
* Add `space_or_tab_one_line_ending`, to parse whitespace including up to
one line ending (but not a blank line)
* Add `ParserState` to share codes, definitions, etc
Diffstat (limited to 'src/constant.rs')
-rw-r--r-- | src/constant.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/constant.rs b/src/constant.rs index 8e1acf3..5cb7826 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -193,6 +193,11 @@ pub const HTML_RAW_SIZE_MAX: usize = 8; /// To safeguard performance, labels are capped at a large number: `999`. pub const LINK_REFERENCE_SIZE_MAX: usize = 999; +/// To do. +/// See: <https://spec.commonmark.org/0.30/#link-destination>, +/// <https://github.com/remarkjs/react-markdown/issues/658#issuecomment-984345577>. +pub const LINK_RESOURCE_DESTINATION_BALANCE_MAX: usize = 32; + /// List of protocols allowed, when operating safely, as `href` on `a`. /// /// This list is based on what is allowed by GitHub. @@ -201,8 +206,6 @@ pub const SAFE_PROTOCOL_HREF: [&str; 6] = ["http", "https", "irc", "ircs", "mail /// List of protocols allowed, when operating safely, as `src` on `img`. /// /// This list is based on what is allowed by GitHub. -// To do: image. -#[allow(dead_code)] pub const SAFE_PROTOCOL_SRC: [&str; 2] = ["http", "https"]; /// The number of characters that form a tab stop. |