diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-06-22 10:27:47 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-06-22 10:27:47 -0700 |
commit | 54b377278187f02621a60b3585de4ec02399234a (patch) | |
tree | c8ab8d17b4f4180244aee0a0e2ab6b9c0676225e | |
parent | 2215e79323a09ecc70ea2fa8b8b6da170bac8e21 (diff) |
Re-add `--safe` command-line option as a no-op.
See #344.
-rw-r--r-- | man/man1/cmark.1 | 12 | ||||
-rw-r--r-- | src/main.c | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/man/man1/cmark.1 b/man/man1/cmark.1 index 71db059..0771400 100644 --- a/man/man1/cmark.1 +++ b/man/man1/cmark.1 @@ -49,14 +49,18 @@ be rendered as curly quotes, depending on their position. \f[C]\-\-\-\f[] will be rendered as an em-dash. \f[C]...\f[] will be rendered as ellipses. .TP 12n -.B \-\-unsafe -Render raw HTML or potentially dangerous URLs. -By default, raw HTML is replaced by a placeholder comment +.B \-\-safe +Omit raw HTML and potentially dangerous URLs (default). +Raw HTML is replaced by a placeholder comment and potentially dangerous URLs are replaced by empty strings. -Dangerous URLs are those that begin with `javascript:`, +Potentially dangerous URLs are those that begin with `javascript:`, `vbscript:`, `file:`, or `data:` (except for `image/png`, `image/gif`, `image/jpeg`, or `image/webp` mime types). .TP 12n +.B \-\-unsafe +Render raw HTML or potentially dangerous URLs, overriding +the default (\-\-safe) behavior. +.TP 12n .B \-\-help Print usage information. .TP 12n @@ -37,6 +37,7 @@ void print_usage() { printf(" --sourcepos Include source position attribute\n"); printf(" --hardbreaks Treat newlines as hard line breaks\n"); printf(" --nobreaks Render soft line breaks as spaces\n"); + printf(" --safe Omit raw HTML and dangerous URLs\n"); printf(" --unsafe Render raw HTML and dangerous URLs\n"); printf(" --smart Use smart punctuation\n"); printf(" --validate-utf8 Replace invalid UTF-8 sequences with U+FFFD\n"); @@ -111,6 +112,8 @@ int main(int argc, char *argv[]) { options |= CMARK_OPT_NOBREAKS; } else if (strcmp(argv[i], "--smart") == 0) { options |= CMARK_OPT_SMART; + } else if (strcmp(argv[i], "--safe") == 0) { + options |= CMARK_OPT_SAFE; } else if (strcmp(argv[i], "--unsafe") == 0) { options |= CMARK_OPT_UNSAFE; } else if (strcmp(argv[i], "--validate-utf8") == 0) { |