Skip to content

Commit 2c085f0

Browse files
authored
Add markdown output in preparation for llms.txt (#1632)
1 parent e32be01 commit 2c085f0

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

config.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ rdi_current_version = "1.10.0"
8383

8484
# Everything below this are Site Params
8585

86+
# Add markdown output
87+
[outputFormats]
88+
[outputFormats.markdown]
89+
name = "markdown"
90+
baseName = "index.html"
91+
mediaType = "text/markdown"
92+
isPlainText = true
93+
8694
# Comment out if you don't want the "print entire section" link enabled.
8795
[outputs]
88-
section = ["HTML", "RSS"] # print
96+
section = ["HTML", "RSS", "Markdown"] # print
97+
page = ["HTML", "Markdown"]

layouts/_default/section.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# {{ .Title }}
2+
{{ $content := .RawContent }}
3+
4+
{{/* Fix relrefs */}}
5+
{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }}
6+
7+
{{/* Fix images */}}
8+
{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }}
9+
10+
{{/* Remove all shortcodes */}}
11+
{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }}
12+
{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }}
13+
14+
{{ $content }}

layouts/_default/single.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# {{ .Title }}
2+
{{ $content := .RawContent }}
3+
4+
{{/* Fix relrefs */}}
5+
{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }}
6+
7+
{{/* Fix images */}}
8+
{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }}
9+
10+
{{/* Remove all shortcodes */}}
11+
{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }}
12+
{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }}
13+
14+
{{ $content }}

0 commit comments

Comments
 (0)