diff --git a/config.toml b/config.toml index 51d52fbd8e..09c76e82cb 100644 --- a/config.toml +++ b/config.toml @@ -83,6 +83,15 @@ rdi_current_version = "1.8.0" # Everything below this are Site Params +# Add markdown output +[outputFormats] + [outputFormats.markdown] + name = "markdown" + baseName = "index.html" + mediaType = "text/markdown" + isPlainText = true + # Comment out if you don't want the "print entire section" link enabled. [outputs] -section = ["HTML", "RSS"] # print +section = ["HTML", "RSS", "Markdown"] # print +page = ["HTML", "Markdown"] \ No newline at end of file diff --git a/layouts/_default/section.md b/layouts/_default/section.md new file mode 100644 index 0000000000..8bb56db5e0 --- /dev/null +++ b/layouts/_default/section.md @@ -0,0 +1,14 @@ +# {{ .Title }} +{{ $content := .RawContent }} + +{{/* Fix relrefs */}} +{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} + +{{/* Fix images */}} +{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }} + +{{/* Remove all shortcodes */}} +{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }} +{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }} + +{{ $content }} \ No newline at end of file diff --git a/layouts/_default/single.md b/layouts/_default/single.md new file mode 100644 index 0000000000..8bb56db5e0 --- /dev/null +++ b/layouts/_default/single.md @@ -0,0 +1,14 @@ +# {{ .Title }} +{{ $content := .RawContent }} + +{{/* Fix relrefs */}} +{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} + +{{/* Fix images */}} +{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }} + +{{/* Remove all shortcodes */}} +{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }} +{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }} + +{{ $content }} \ No newline at end of file