【问题标题】:Nikola Table of Contents in Markdown formatMarkdown 格式的 Nikola 目录
【发布时间】:2021-02-09 17:51:42
【问题描述】:

我已经安装了 Nikola (https://getnikola.com/) 并创建了一个可以成功显示为帖子的降价文件。

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

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] 添加到包含一些示例标题的 Markdown 文件中

<!--
.. 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 标题,正如预期的那样 但没有目录。

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

【问题讨论】:

    标签: markdown nikola static-site-generation


    【解决方案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-08-17
    • 2012-03-31
    • 2022-07-15
    • 2018-12-24
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多