From 6e9974c2ef8508b2a0332a0a76819a94d602992a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 19 Sep 2022 15:50:51 +0200 Subject: [PATCH] Escape liquid tags in site docs It is good practice to wrap all dynamic content in `{% raw %}..{% endraw %}` Liquid tags so that no syntax within can mistakenly get interpreted as Liquid tags. Fixes rendering of `gh auth login` help page. --- internal/docs/markdown.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/docs/markdown.go b/internal/docs/markdown.go index 74f505a6b..e33df5f45 100644 --- a/internal/docs/markdown.go +++ b/internal/docs/markdown.go @@ -85,6 +85,7 @@ func GenMarkdown(cmd *cobra.Command, w io.Writer) error { // GenMarkdownCustom creates custom markdown output. func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { + fmt.Fprint(w, "{% raw %}") fmt.Fprintf(w, "## %s\n\n", cmd.CommandPath()) hasLong := cmd.Long != "" @@ -112,6 +113,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) if err := printOptions(w, cmd); err != nil { return err } + fmt.Fprint(w, "{% endraw %}\n") if len(cmd.Example) > 0 { fmt.Fprint(w, "### Examples\n\n{% highlight bash %}{% raw %}\n")