xianmin/hugo-theme-jane

使用 hugo.exe v0.74.3 版本生成blog,大部分的 shortcodes 都出现了异常情况。

MrBenWang opened this issue · 3 comments

我下载最新的 hugo-theme-jane ,使用里面的 demo ,测试结果如下图。

左侧是 v0.74.3 在 localhost:1313 ; 右侧是 hugo-theme-jane 的 demo 在 https://www.xianmin.org/hugo-theme-jane/

pic1

notice

high-lighting

如果使用 hugo.exe v0.58 版本测试则正常,符合预期。我尝试修复问题,发现比较困难。目前只能退回到 hugo.exe 的低版本。

最後 syntax highlighting 的部份
似乎在 config 啟用以下幾行就能解決

PygmentsCodeFences = true # Enable syntax highlighting with GitHub flavoured code fences
PygmentsUseClasses = true # Use CSS classes to format highlighted code
PygmentsOptions = "linenos=table"

[markup]
  defaultMarkdownHandler = "goldmark"
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = true

在 config.toml 配置这个有效,但是 会在 shortcodes 代码中额外生成其他的 html 标签

{{% notice note "标题" %}}

1. 内容abc  
2. 内容222  
{{% /notice %}}


<div class="shortcode-notice {{ .Get 0 }}">
  <div class="shortcode-notice-title {{ .Get 0 }}">
    {{ if len .Params | eq 2 }}
      {{ .Get 1 }}
    {{ else }}
      {{ .Get 0 }}
    {{ end }}
  </div>
  <p>{{ .Inner }}</p>
</div>

生成的 html 会出现混乱

<div class="shortcode-notice note">
  <div class="shortcode-notice-title note">
<pre><code>  标题
</code></pre>
  </div>
  <p>
</p><ol>
<li>内容abc</li>
<li>内容222</li>
</ol>
<p></p>
</div>