feat: add option to include pages using the include shortcode (#92)
BREAKING CHANGE: The include shortcode will render files as Markdown instead of HTML by default now. While the Markdown renderer should be able to render HTML as well this might still work as before. BREAKING CHANGE: The include shortcode option markdown was replaces by a generic type option that could be used to specify special include types.
This commit is contained in:
parent
9129b07d2f
commit
1ace505d27
7 changed files with 94 additions and 44 deletions
|
@ -1,10 +1,17 @@
|
|||
{{ $file := .Get "file" }}
|
||||
{{ $page := .Site.GetPage $file }}
|
||||
{{ $type := .Get "type" }}
|
||||
{{ $language := .Get "language" }}
|
||||
{{ $options :=.Get "options" }}
|
||||
|
||||
<div class="gdoc-include">
|
||||
{{- if eq (.Get "markdown") "true" -}}
|
||||
{{- $file | readFile | $.Page.RenderString -}}
|
||||
{{- else if (.Get "language") -}}
|
||||
{{- highlight ($file | readFile) (.Get "language") (default "linenos=table" (.Get "options")) -}}
|
||||
{{- if (.Get "language") -}}
|
||||
{{- highlight ($file | readFile) $language (default "linenos=table" $options) -}}
|
||||
{{- else if eq $type "html" -}}
|
||||
{{- $file | readFile | safeHTML -}}
|
||||
{{- else if eq $type "page" -}}
|
||||
{{- with $page }}{{ .Content }}{{ end -}}
|
||||
{{- else -}}
|
||||
{{ $file | readFile | safeHTML }}
|
||||
{{- $file | readFile | $.Page.RenderString -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue