diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-27 15:19:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-30 11:32:55 +0200 |
commit | 322d19a81fedbf423a047bdf286499d2e25d14be (patch) | |
tree | 0bfff44177d7bd6fde36fa84c45597e6069b3c2a /hugolib | |
parent | 7cb484e121da73b63aab231ba29bb644b5f7965e (diff) |
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
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/shortcode_test.go | 33 |
1 files changed, 33 insertions, 0 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 -- +§§§ +<x +§§§ +-- layouts/_default/single.html -- +{{ .Content }} +` + + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + Running: true, + }, + ).Build() + + b.AssertFileContent("public/p1/index.html", ` +<x + `) + +} |