Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/reuixiy/hugo-theme-meme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-examples/en/config.toml3
-rw-r--r--config-examples/zh-cn/config.toml3
-rw-r--r--layouts/partials/utils/content.html2
-rw-r--r--layouts/partials/utils/markdownify.html41
4 files changed, 11 insertions, 38 deletions
diff --git a/config-examples/en/config.toml b/config-examples/en/config.toml
index 4676c74..48f54ea 100644
--- a/config-examples/en/config.toml
+++ b/config-examples/en/config.toml
@@ -780,9 +780,6 @@ uglyURLs = false
# Open external links in a new tab?
hrefTargetBlank = true
- # Compatibility with LaTeX?
- compatibleWithLaTeX = false
-
######################################
# Table of Contents
diff --git a/config-examples/zh-cn/config.toml b/config-examples/zh-cn/config.toml
index 6001835..6d1a974 100644
--- a/config-examples/zh-cn/config.toml
+++ b/config-examples/zh-cn/config.toml
@@ -738,9 +738,6 @@ uglyURLs = false
# 在新标签页打开外链?
hrefTargetBlank = true
- # 与 LaTeX 的兼容性?
- compatibleWithLaTeX = false
-
######################################
# 文章目录
diff --git a/layouts/partials/utils/content.html b/layouts/partials/utils/content.html
index 29616ea..8ff8c8d 100644
--- a/layouts/partials/utils/content.html
+++ b/layouts/partials/utils/content.html
@@ -1,5 +1,5 @@
{{- $Deliver := . -}}
-{{- $raw := .RawContent -}}
+{{- $raw := .Content -}}
{{- partial "utils/markdownify.html" (dict "Deliver" . "raw" $raw "isContent" true) -}}
<!-- Link Headings to TOC -->
diff --git a/layouts/partials/utils/markdownify.html b/layouts/partials/utils/markdownify.html
index c6a364a..7c660e8 100644
--- a/layouts/partials/utils/markdownify.html
+++ b/layouts/partials/utils/markdownify.html
@@ -6,29 +6,6 @@
{{- $enableEmoji := replaceRE `enableEmoji = (.+)` `$1` (delimit (readFile "config.toml" | findRE `enableEmoji = (.+)` | uniq) " ") -}}
-<!-- Emoji -->
-{{- $Content := $Deliver.Scratch.Get "Content" -}}
-{{- if eq $enableEmoji "true" -}}
- {{- $Content := $Content | emojify -}}
- {{- $Deliver.Scratch.Set "Content" $Content -}}
-{{- end -}}
-
-<!-- LaTeX -->
-{{- $Content := $Deliver.Scratch.Get "Content" -}}
-{{- if $Deliver.Site.Params.compatibleWithLaTeX -}}
- {{- if or ($Deliver.Params.katex | default $Deliver.Site.Params.enableKaTeX) ($Deliver.Params.mathjax | default $Deliver.Site.Params.enableMathJax) -}}
- {{- $regexLaTeX := `([^\$]|\n)\$([^\$\n]+)\$` -}}
- {{- $replacementLaTeX := `$1<span>$$${2}$$</span>` -}}
- {{- $Content := $Content | replaceRE $regexLaTeX $replacementLaTeX -}}
-
- {{- $regexLaTeX := `\$\$((.|\s)[^\$]+)\$\$` -}}
- {{- $replacementLaTeX := `<div>$$$$${1}$$$$</div>` -}}
- {{- $Content := $Content | replaceRE $regexLaTeX $replacementLaTeX -}}
-
- {{- $Deliver.Scratch.Set "Content" $Content -}}
- {{- end -}}
-{{- end -}}
-
<!-- New Markdown Syntax: Emphasis Point `..text..` -->
{{- $Content := $Deliver.Scratch.Get "Content" -}}
{{- if $Deliver.Site.Params.enableEmphasisPoint -}}
@@ -38,16 +15,18 @@
{{- $Deliver.Scratch.Set "Content" $Content -}}
{{- end -}}
-<!-- Markdown -->
-{{- $Content := $Deliver.Scratch.Get "Content" -}}
-{{- $Content := $Content | markdownify -}}
-{{- $Deliver.Scratch.Set "Content" $Content -}}
-
-<!-- https://github.com/reuixiy/hugo-theme-meme/issues/49 -->
+<!-- Markdownify -->
{{- $Content := $Deliver.Scratch.Get "Content" -}}
-{{- if and (not (strings.HasPrefix $Content "<")) $isContent -}}
- {{- $Content := (printf `<p>%s</p>` $Content) | safeHTML -}}
+{{- if not $isContent -}}
+ {{- $Content := $Content | markdownify -}}
{{- $Deliver.Scratch.Set "Content" $Content -}}
+
+ <!-- Emojify -->
+ {{- $Content := $Deliver.Scratch.Get "Content" -}}
+ {{- if eq $enableEmoji "true" -}}
+ {{- $Content := $Content | emojify -}}
+ {{- $Deliver.Scratch.Set "Content" $Content -}}
+ {{- end -}}
{{- end -}}
<!-- External Links -->