1

我已经安装了 Nikola ( https://getnikola.com/ ) 并创建了一个 markdown 文件,该文件成功显示为帖子。

在我的 conf.py 中,安装后我的降价扩展看起来像这样。

MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.codehilite', 'markdown.extensions.extra']

似乎默认情况下应该包含目录,所以我启用了它

MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.codehilite', 'markdown.extensions.extra','markdown.extensions.toc']

然后将文本 [TOC] 添加到我的降价文件中,该文件有一些示例标题

<!--
.. title: Witness the Quickness
.. slug: witness-the-quickness
.. date: 2020-10-26 18:46:36 UTC
.. tags: 
.. category: 
.. link: 
.. description: 
.. type: text
-->


[TOC]
Sample text with some headings below

# Well, Well well

## Duppy guides my hand

### The smiles on their faces

在生成的 html 文件中,它只显示 [TOC] 文本。它确实将 #Headings 转换为 html 标题,正如预期的那样,但没有目录。

是否需要更改/启用其他设置才能使其正常工作?

4

1 回答 1

1

[TOC]必须在自己的段落中。添加换行符,如下所示:

<!--
.. title: Witness the Quickness
.. slug: witness-the-quickness
.. date: 2020-10-26 18:46:36 UTC
.. tags: 
.. category: 
.. link: 
.. description: 
.. type: text
-->


[TOC]

Sample text with some headings below

# Well, Well well

## Duppy guides my hand

### The smiles on their faces
于 2020-10-27T19:03:23.383 回答