浏览代码

Update markup configs

Track3 4 年之前
父节点
当前提交
7db6d303be

+ 10 - 4
config.toml

@@ -3,8 +3,6 @@ languageCode = "zh-hans"
 title = "Track3's Blog"
 staticDir = ["static", "content-static"]
 
-pygmentsCodefences  = true
-pygmentsUseClasses  = true
 hasCJKLanguage = true
 rssLimit = 10
 copyright = "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License."
@@ -13,8 +11,16 @@ googleAnalytics = "UA-125057333-1"
 [author]
   name = "Track3"
 
-[blackfriday]
-  hrefTargetBlank = true
+[markup]
+  defaultMarkdownHandler = "goldmark"
+
+  [markup.highlight]
+    codeFences = true
+    guessSyntax = false
+    noClasses = false
+
+  [markup.blackFriday]
+    hrefTargetBlank = true
 
 [taxonomies]
   tag = "tags"

+ 1 - 0
layouts/_default/_markup/render-heading.html

@@ -0,0 +1 @@
+<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg></a></h{{ .Level }}>

+ 1 - 0
layouts/_default/_markup/render-link.html

@@ -0,0 +1 @@
+<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>

+ 1 - 1
layouts/_default/single.html

@@ -19,7 +19,7 @@
 	<main class="site-main section-inner thin animated fadeIn faster">
 		<h1>{{ .Title }}</h1>
 		<div class="content">
-			{{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg></a>${3}` | safeHTML }}
+			{{ .Content }}
 		</div>
 		{{ with .Params.comments -}}
 		{{ partialCached "comments.html" . }}

+ 1 - 1
layouts/posts/single.html

@@ -23,7 +23,7 @@
 				<h1>{{ .Title }}</h1>
 			</header>
 			<div class="content">
-				{{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg></a>${3}` | safeHTML }}
+				{{ .Content }}
 			</div>
 			<hr class="post-end">
 			<footer class="post-info">