Serve Markdown when requested (#2181)

* Add support for rendering each page as md

* On md pages, change relative links to go to md version

* Netlify: respond with md if accept header equals text/markdown

* Render shortcodes

* Remove netlify accept header functionality
This commit is contained in:
Abdon Pijpelink
2026-03-04 14:09:05 +01:00
committed by GitHub
parent 96e837001a
commit 0725a70f05
5 changed files with 80 additions and 0 deletions
@@ -0,0 +1,8 @@
# {{ .Title }}
{{- $content := .RenderShortcodes -}}
{{- /* Rewrite internal absolute links: ](/path/to/page/) → ](/path/to/page/index.md) */}}
{{- $content = replaceRE `\]\((/[^):]*/)` `](${1}index.md` $content -}}
{{- /* Rewrite internal relative links: ](../page/) or (./page/) → same with index.md */}}
{{- $content = replaceRE `\]\((\.\.?/[^):]*/)` `](${1}index.md` $content -}}
{{ $content }}