aboutsummaryrefslogtreecommitdiffstats
path: root/src/constant.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-21 16:15:39 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-21 16:15:39 +0200
commit7effd171218fff68f051671f1373cee467a8f921 (patch)
tree904e2ef93375f9cf91b96606983684cf9b6261d0 /src/constant.rs
parent92dbf5f2fd211b236de7ddc69967fedfdd286be9 (diff)
downloadmarkdown-rs-7effd171218fff68f051671f1373cee467a8f921.tar.gz
markdown-rs-7effd171218fff68f051671f1373cee467a8f921.tar.bz2
markdown-rs-7effd171218fff68f051671f1373cee467a8f921.zip
Refactor to move protocols to constants
Diffstat (limited to 'src/constant.rs')
-rw-r--r--src/constant.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/constant.rs b/src/constant.rs
index 9c861be..6ba1638 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -193,6 +193,18 @@ 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;
+/// List of protocols allowed, when operating safely, as `href` on `a`.
+///
+/// This list is based on what is allowed by GitHub.
+pub const SAFE_PROTOCOL_HREF: [&str; 6] = ["http", "https", "irc", "ircs", "mailto", "xmpp"];
+
+/// 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.
///
/// This relates to the number of whitespace characters needed to form certain