From 8249ccd7690679c835c9351e2861246b7a9b0b04 Mon Sep 17 00:00:00 2001 From: Martyn Welch <martyn.welch@collabora.com> Date: Mon, 27 Jul 2020 16:03:09 +0100 Subject: [PATCH] Tweak HTML rendering to allow HTML elements in Markdown By default the Goldmark renderer used by Hugo won't render HTML elements that are present in the markdown, even though this is allowed in the CommonMark Spec that it claims to implement: https://spec.commonmark.org/0.29/#html-blocks We can get this to work by turning on "unsafe" mode, which means: By default, Goldmark does not render raw HTMLs and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on. As we have such elements and we can guarantee what's being rendered, turn this on. Signed-off-by: Martyn Welch <martyn.welch@collabora.com> --- config.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.toml b/config.toml index 1c3b9b07c..4216d9c23 100644 --- a/config.toml +++ b/config.toml @@ -84,3 +84,12 @@ languageCode = "en-us" [mediaTypes] [mediaTypes."html/pdf-in"] suffixes = ["pdf-in"] + +# By default Goldmark does not render raw HTMLs and potentially dangerous +# links. As we have HTML tables in places (that can't readily be implemented +# in pure Markdown due to large cells with complex content) and can be sure +# of the content being rendered, switch "unsafe" on to allow these HTML +# elements to be created. +[markup] + [markup.goldmark.renderer] + unsafe = true -- GitLab