aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--hugolib/shortcode_test.go33
-rw-r--r--media/mediaType.go4
-rw-r--r--media/mediaType_test.go2
-rw-r--r--output/outputFormat.go9
-rw-r--r--output/outputFormat_test.go2
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 --
+§§§
+<x
+§§§
+-- layouts/_default/single.html --
+{{ .Content }}
+`
+
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ Running: true,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/p1/index.html", `
+<x
+ `)
+
+}
diff --git a/media/mediaType.go b/media/mediaType.go
index 69bb9182a..3ac3123ac 100644
--- a/media/mediaType.go
+++ b/media/mediaType.go
@@ -257,7 +257,8 @@ var (
OpenTypeFontType = newMediaType("font", "otf", []string{"otf"})
// Common document types
- PDFType = newMediaType("application", "pdf", []string{"pdf"})
+ PDFType = newMediaType("application", "pdf", []string{"pdf"})
+ MarkdownType = newMediaType("text", "markdown", []string{"md", "markdown"})
// Common video types
AVIType = newMediaType("video", "x-msvideo", []string{"avi"})
@@ -278,6 +279,7 @@ var DefaultTypes = Types{
SCSSType,
SASSType,
HTMLType,
+ MarkdownType,
JavascriptType,
TypeScriptType,
TSXType,
diff --git a/media/mediaType_test.go b/media/mediaType_test.go
index 34571f7ee..af7123cb5 100644
--- a/media/mediaType_test.go
+++ b/media/mediaType_test.go
@@ -63,7 +63,7 @@ func TestDefaultTypes(t *testing.T) {
}
- c.Assert(len(DefaultTypes), qt.Equals, 33)
+ c.Assert(len(DefaultTypes), qt.Equals, 34)
}
func TestGetByType(t *testing.T) {
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)
}