From 322d19a81fedbf423a047bdf286499d2e25d14be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 27 May 2022 15:19:02 +0200 Subject: [PATCH] Add Markdown as an output format The motivation behind this is not to make it easier to publish Markdown files, as that sounds unusual. This is mainly meant for shortcodes that produces Markdown to be inlined. You would do this by creating shortcodes with `*.md` suffix (e.g. `layouts/shortcodes/myshortcode.md`). This output format is defined as plain text, and will use Go's much more lenient text template parser. Updates #9821 --- hugolib/shortcode_test.go | 33 +++++++++++++++++++++++++++++++++ media/mediaType.go | 4 +++- media/mediaType_test.go | 2 +- output/outputFormat.go | 9 +++++++++ output/outputFormat_test.go | 2 +- 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 7926a8203..372e1be9b 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -909,3 +909,36 @@ outputs: ["html", "css", "csv", "json"] } } + +// #9821 +func TestShortcodeMarkdownOutputFormat(t *testing.T) { + t.Parallel() + + files := ` +-- config.toml -- +-- content/p1.md -- +--- +title: "p1" +--- +{{< foo >}} +-- layouts/shortcodes/foo.md -- +§§§ +