我开始使用标记来做笔记。
我用标记来查看我的笔记,它很漂亮。
但是随着我的笔记变长,我发现很难找到我想要的东西。
我知道markdown可以创建表,但它是否能够创建目录,跳转到部分,或定义页面部分markdown?
或者,是否有降价阅读器/编辑器可以做这些事情。搜索也是一个不错的功能。
简而言之,我想让它成为我很棒的笔记工具,功能就像写一本书一样。
我开始使用标记来做笔记。
我用标记来查看我的笔记,它很漂亮。
但是随着我的笔记变长,我发现很难找到我想要的东西。
我知道markdown可以创建表,但它是否能够创建目录,跳转到部分,或定义页面部分markdown?
或者,是否有降价阅读器/编辑器可以做这些事情。搜索也是一个不错的功能。
简而言之,我想让它成为我很棒的笔记工具,功能就像写一本书一样。
当前回答
对于Visual Studio Code用户来说,今天(2020年)使用的最佳选择是Markdown All in One插件(扩展)。
要安装它,启动VS Code快速打开(Control/⌘+P),粘贴以下命令,并按enter。
ext install yzhang.markdown-all-in-one
要生成TOC,打开命令面板(Control/⌘+Shift+P),并选择select Markdown:创建内容表选项。
另一个选择是Markdown TOC插件。
要安装它,启动VS Code快速打开(Control/⌘+P),粘贴以下命令,并按enter。
ext install markdown-toc
要生成TOC,打开命令面板(Control/⌘+Shift+P),并选择Markdown TOC:插入/更新选项或使用Control/⌘+MT。
其他回答
Typora生成的内容表添加[TOC]到您的文档。
MultiMarkdown 4.7有一个{{TOC}}宏,用于插入一个目录表。
正如在其他回答中提到的,有多种方法可以自动生成目录。大多数都是开源软件,可以根据您的需要进行调整。
然而,我所缺少的是,使用Markdown提供的有限选项,在视觉上吸引人的目录格式。我们得出了以下结论:
Code
## Content
**[1. Markdown](#heading--1)**
* [1.1. Markdown formatting cheatsheet](#heading--1-1)
* [1.2. Markdown formatting details](#heading--1-2)
**[2. BBCode formatting](#heading--2)**
* [2.1. Basic text formatting](#heading--2-1)
* [2.1.1. Not so basic text formatting](#heading--2-1-1)
* [2.2. Lists, Images, Code](#heading--2-2)
* [2.3. Special features](#heading--2-3)
----
在你的文档中,你可以像这样放置目标子部分标记:
<div id="heading--1-1"/>
### 1.1. Markdown formatting cheatsheet
根据你在哪里以及如何使用Markdown,以下也应该工作,并提供了更好看Markdown代码:
### 1.1. Markdown formatting cheatsheet <a name="heading--1-1"/>
例子呈现
内容 1. 减价 1.1. 折算格式备忘单 1.2. 折扣价格式细节 2. BBCode格式化 2.1. 基本文本格式 2.1.1. 不是最基本的文本格式 2.2. 列表,图像,代码 2.3. 特殊功能
优势
You can add as many levels of chapters and sub-chapters as you need. In the Table of Contents, these would appear as nested unordered lists on deeper levels. No use of ordered lists. These would create an indentation, would not link the number, and cannot be used to create decimal classification numbering like "1.1.". No use of lists for the first level. Here, using an unordered list is possible, but not necessary: the indentation and bullet just add visual clutter and no function here, so we don't use a list for the first ToC level at all. Visual emphasis on the first-level sections in the table of content by bold print. Short, meaningful subpart markers that look "beautiful" in the browser's URL bar such as #heading--1-1 rather than markers containing transformed pieces of the actual heading. The code uses H2 headings (## …) for sections, H3 headings (### …) for sub-headings etc.. This makes the source code easier to read because ## … provides a stronger visual clue when scrolling through compared to the case where sections would start with H1 headings (# …). It is still logically consistent as you use the H1 heading for the document title itself. Finally, we add a nice horizontal rule to separate the table of contents from the actual content.
有关这项技术以及我们如何在论坛软件Discourse中使用它的更多信息,请参见这里。
对我来说,@Tum提出的解决方案对于2个层次的目录来说非常有效。然而,对于第3个关卡,这种方法却不起作用。它没有像前两层那样显示链接,而是显示纯文本3.5.1。[bla blabla](#blablabla) <br>代替。
我的解决方案是@Tum解决方案(非常简单)的补充,适用于需要3级或以上目录的人。
在第二层,一个简单的制表符将为您正确地完成缩进。但它不支持2个标签。相反,你必须使用一个标签,并添加尽可能多的 根据你自己的需要来正确对齐第三层。
下面是一个使用4个关卡的例子(关卡越高,它就变得越糟糕):
# Table of Contents
1. [Title](#title) <br>
1.1. [sub-title](#sub_title) <br>
1.1.1. [sub-sub-title](#sub_sub_title)
1.1.1.1. [sub-sub-sub-title](#sub_sub_sub_title)
# Title <a name="title"></a>
Heading 1
## Sub-Title <a name="sub_title"></a>
Heading 2
### Sub-Sub-Title <a name="sub_sub_title"></a>
Heading 3
#### Sub-Sub-Sub-Title <a name="sub_sub_sub_title"></a>
Heading 4
这将给出以下结果,其中目录表的每个元素都是到其相应部分的链接。还要注意<br>,以便添加新行,而不是在同一行上。
目录
标题 1.1. 字幕 1.1.1。Sub-Sub-Title 1.1.1.1。Sub-Sub-Sub-Title
标题
标题1
字幕
标题2
Sub-Sub-Title
标题3
Sub-Sub-Sub-Title标题4
只需要增加幻灯片的数量!它与markdown ioslides和revealjs演示一起工作
## Table of Contents
1. [introduction](#3)
2. [section one](#5)