From 31e780afa641bb0b67b8f48e873c53273ea50462 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 14 Aug 2020 05:25:37 +0000 Subject: [PATCH] add comrak for Markdown to HTML --- _webi/template.sh | 2 +- comrak/README.md | 118 +++++++++++++++++++++++++++++++++++++++++++++ comrak/install.ps1 | 41 ++++++++++++++++ comrak/install.sh | 36 ++++++++++++++ comrak/releases.js | 20 ++++++++ 5 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 comrak/README.md create mode 100644 comrak/install.ps1 create mode 100644 comrak/install.sh create mode 100644 comrak/releases.js diff --git a/_webi/template.sh b/_webi/template.sh index fc7629a..651ae99 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -319,10 +319,10 @@ if [ -n "$(command -v pkg_get_current_version)" ]; then webi_link + _webi_enable_exec pushd "$WEBI_TMP" 2>&1 >/dev/null [ -n "$(command -v pkg_post_install)" ] && pkg_post_install || webi_post_install popd 2>&1 >/dev/null - _webi_enable_exec pushd "$WEBI_TMP" 2>&1 >/dev/null [ -n "$(command -v pkg_done_message)" ] && pkg_done_message || _webi_done_message diff --git a/comrak/README.md b/comrak/README.md new file mode 100644 index 0000000..7a91282 --- /dev/null +++ b/comrak/README.md @@ -0,0 +1,118 @@ +--- +title: Comrak +homepage: https://github.com/kivikakk/comrak +tagline: | + Comrak is a Rust port of github's cmark-gfm. +--- + +### Updating `comrak` + +`webi comrak@stable` + +Use the `@beta` tag for pre-releases. + +## Cheat Sheet + +> Comrak supports the five extensions to CommonMark defined in the GitHub +> Flavored Markdown Spec: Tables, Task list items, Strikethrough, Autolinks, & +> Disallowed Raw HTML + +```bash +comrak --gfm index.md > index.html +``` + +Here you'll learn how to: + +- Convert Markdown to HTML +- Set Reasonable Defaults +- Safely Render _Untrusted_ HTML +- Render _Trusted_ HTML with Scripts +- Temporarily Ignore Defaults + +## How to Convert Markdown to HTML + +```bash +comrak --gfm --header-ids '' README.md > README.html +``` + +## How to set Reasonable Defaults + +You can update `~/.config/comrak/config` to change Comrak from it's very strict +defaults to always include your favorite options. + +Here's what I suggest: + +```bash +echo "--gfm --header-ids ''" > ~/.config/comrak/config +``` + +See `comrak --help` for other options. + +## How to Render _Untrusted_ HTML + +Comrak does NOT have an option to allow arbitrary HTML while protecting against +unsafe links, such as ``. + +Therefore, you **MUST enable CSP** for comrak-rendered site to disallow unsafe +inline scripts. This can be done via a `` tag or HTTP headers. + +Example: + +```html + +``` + +Then, to sanitize `