diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-05-27 15:19:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-05-30 11:32:55 +0200 |
commit | 322d19a81fedbf423a047bdf286499d2e25d14be (patch) | |
tree | 0bfff44177d7bd6fde36fa84c45597e6069b3c2a /output | |
parent | 7cb484e121da73b63aab231ba29bb644b5f7965e (diff) | |
download | hugo-322d19a81fedbf423a047bdf286499d2e25d14be.tar.gz hugo-322d19a81fedbf423a047bdf286499d2e25d14be.zip |
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 'output')
-rw-r--r-- | output/outputFormat.go | 9 | ||||
-rw-r--r-- | output/outputFormat_test.go | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/output/outputFormat.go b/output/outputFormat.go index 1f1556eaf..722079df9 100644 --- a/output/outputFormat.go +++ b/output/outputFormat.go @@ -133,6 +133,14 @@ var ( Weight: 10, } + MarkdownFormat = Format{ + Name: "MARKDOWN", + MediaType: media.MarkdownType, + BaseName: "index", + Rel: "alternate", + IsPlainText: true, + } + JSONFormat = Format{ Name: "JSON", MediaType: media.JSONType, @@ -183,6 +191,7 @@ var DefaultFormats = Formats{ CSVFormat, HTMLFormat, JSONFormat, + MarkdownFormat, WebAppManifestFormat, RobotsTxtFormat, RSSFormat, diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go index a150dbe7c..c5c4534bf 100644 --- a/output/outputFormat_test.go +++ b/output/outputFormat_test.go @@ -68,7 +68,7 @@ func TestDefaultTypes(t *testing.T) { c.Assert(RSSFormat.NoUgly, qt.Equals, true) c.Assert(CalendarFormat.IsHTML, qt.Equals, false) - c.Assert(len(DefaultFormats), qt.Equals, 10) + c.Assert(len(DefaultFormats), qt.Equals, 11) } |