我开始使用标记来做笔记。

我用标记来查看我的笔记,它很漂亮。

但是随着我的笔记变长,我发现很难找到我想要的东西。

我知道markdown可以创建表,但它是否能够创建目录,跳转到部分,或定义页面部分markdown?

或者,是否有降价阅读器/编辑器可以做这些事情。搜索也是一个不错的功能。

简而言之,我想让它成为我很棒的笔记工具,功能就像写一本书一样。


当前回答

这里有一个有用的方法。应该在任何MarkDown编辑器中产生可点击的引用。

# Table of contents
1. [Introduction](#introduction)
2. [Some paragraph](#paragraph1)
    1. [Sub paragraph](#subparagraph1)
3. [Another paragraph](#paragraph2)

## This is the introduction <a name="introduction"></a>
Some introduction text, formatted in heading 2 style

## Some paragraph <a name="paragraph1"></a>
The first paragraph text

### Sub paragraph <a name="subparagraph1"></a>
This is a sub paragraph, formatted in heading 3 style

## Another paragraph <a name="paragraph2"></a>
The second paragraph text

生产:

目录

简介 一些段落 子段 另一个段落

这是介绍

一些介绍文本,格式为标题2的风格

一些段落

第一段文字

子段

这是一个子段落,格式为标题3

另一个段落

第二段文字

其他回答

只需使用带有插件的文本编辑器。

你的编辑器很可能有一个包/插件来为你处理这个问题。例如,在Emacs中,可以安装markdown-toc TOC生成器。然后在编辑时,只需反复调用M-x markdown-toc-generate-or-refresh-toc。如果你想经常这样做,那就值得一个键绑定。它擅长生成一个简单的TOC,而不会用HTML锚污染您的文档。

其他编辑器也有类似的插件,所以流行的列表是这样的:

器name: markdown-toc Vim: markdown-toc Atom: markdown-toc VSCode: markdown-toc

你可以试一试。

# Table of Contents
1. [Example](#example)
2. [Example2](#example2)
3. [Third Example](#third-example)
4. [Fourth Example](#fourth-examplehttpwwwfourthexamplecom)


## Example
## Example2
## Third Example
## [Fourth Example](http://www.fourthexample.com) 

如果你的Markdown文件要在bitbucket.org上的回购中显示,你应该在你想要你的目录的位置添加[TOC]。然后它将自动生成。更多信息:

https://confluence.atlassian.com/bitbucket/add-a-table-of-contents-to-a-wiki-221451163.html

作为手工制作链接列表的替代方案,让我们概述所有可用的开箱即用的解决方案来插入目录(请评论和扩展以保持最新):

在咕噜5版本中,markdown支持这一点:

<!-- assure you have a blank line before -->
[[_TOC_]]

这也适用于Azure DevOps wiki。


由于Gitlab将降价引擎从Redcarpet切换到Kramdown,他们现在支持以下语法

- TOC
{:toc}

看到https://about.gitlab.com/handbook/markdown-guide/ table-of-contents-toc


MultiMarkdown在4.7有一个下面的宏:

{{TOC}}

根据Jannik的回答: 如果你的Markdown文件是显示在bitbucket.org上的回购,你可以在你想要你的目录(更多信息在这里)的位置使用以下:

[TOC]

根据Paul Jurczak的回答: 当您在文档中写入[TOC]时,Markdown编辑器Typora也会生成一个目录。


我知道,我的回答有点晚了。然而,我自己却错过了这样一个概述。我对尼古拉斯·特里的回答进行了编辑,将其扩展为概述,但被拒绝了。

# Table of Contents
1. [Example](#example)
2. [Example2](#example2)
3. [Third Example](#third-example)

## Example [](#){name=example}
## Example2 [](#){name=example2}
## [Third Example](#){name=third-example}

如果您使用markdown extra,不要忘记您可以为链接、标题、代码围栏和图像添加特殊属性。 https://michelf.ca/projects/php-markdown/extra/#spe-attr