InkSoul/themes/meme_cdn/layouts/partials/utils/markdownify.html

31 lines
1.1 KiB
HTML

{{- $ := index . "$" -}}
{{- $Content := .raw -}}
{{- $isContent := .isContent -}}
<!-- New Markdown Syntax: Emphasis Point `..text..` -->
{{- if $.Site.Params.enableEmphasisPoint -}}
{{- $regexPatternEmphasisPoint := `([^\.\x60])\.\.([^\.\s\n\/\\]+)\.\.([^\.\x60])` -}}
{{- $regexReplacementEmphasisPoint := `$1<em class="emphasis-point">$2</em>$3` -}}
{{- $Content = $Content | replaceRE $regexPatternEmphasisPoint $regexReplacementEmphasisPoint -}}
{{- end -}}
<!-- Markdownify -->
{{- if not $isContent -}}
{{- $Content = $Content | markdownify -}}
<!-- Emojify -->
{{- if (fileExists "config.toml") -}}
{{- $enableEmoji := replaceRE `enableEmoji = (.+)` `$1` (delimit (readFile "config.toml" | findRE `enableEmoji = (.+)` | uniq) " ") -}}
{{- if eq $enableEmoji "true" -}}
{{- $Content = $Content | emojify -}}
{{- end -}}
{{- end -}}
{{- end -}}
<!-- External Links -->
{{- if $.Site.Params.hrefTargetBlank -}}
{{- $Content = replaceRE `(<a href="https?:[^"]+")` `$1 target="_blank" rel="noopener"` $Content -}}
{{- end -}}
{{- $Content | safeHTML -}}