我开始使用标记来做笔记。
我用标记来查看我的笔记,它很漂亮。
但是随着我的笔记变长,我发现很难找到我想要的东西。
我知道markdown可以创建表,但它是否能够创建目录,跳转到部分,或定义页面部分markdown?
或者,是否有降价阅读器/编辑器可以做这些事情。搜索也是一个不错的功能。
简而言之,我想让它成为我很棒的笔记工具,功能就像写一本书一样。
我开始使用标记来做笔记。
我用标记来查看我的笔记,它很漂亮。
但是随着我的笔记变长,我发现很难找到我想要的东西。
我知道markdown可以创建表,但它是否能够创建目录,跳转到部分,或定义页面部分markdown?
或者,是否有降价阅读器/编辑器可以做这些事情。搜索也是一个不错的功能。
简而言之,我想让它成为我很棒的笔记工具,功能就像写一本书一样。
当前回答
你可以使用DocToc从命令行生成目录:
doctoc /path/to/file
要使链接与Bitbucket生成的锚点兼容,请使用——Bitbucket参数运行它。
其他回答
这里有一个有用的方法。应该在任何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
另一个段落
第二段文字
我不确定,markdown的官方文件是什么? 交叉引用可以只用括号[Heading],也可以用空括号[Heading][]。
两者都使用pandoc进行工作。 所以我创建了一个快速bash脚本,它将用其TOC替换md文件中的$__TOC__。(你需要envsubst,它可能不是你发行版的一部分)
#!/bin/bash
filename=$1
__TOC__=$(grep "^##" $filename | sed -e 's/ /1. /;s/^##//;s/#/ /g;s/\. \(.*\)$/. [\1][]/')
export __TOC__
envsubst '$__TOC__' < $filename
如果您碰巧使用Eclipse,可以使用Ctrl+O(大纲)快捷键,这将显示相当于目录的内容,并允许在节标题中搜索(自动完成)。
您也可以打开大纲视图(窗口->显示视图->大纲),但它没有自动完成搜索。
有两种方法可以在你的降价文档中创建你的TOC(摘要)。
1. 手动
# My Table of content
- [Section 1](#id-section1)
- [Section 2](#id-section2)
<div id='id-section1'/>
## Section 1
<div id='id-section2'/>
## Section 2
2. 以编程方式
例如,你可以使用一个脚本,为你生成摘要,看看我的项目在github - summarizeMD -
我也尝试过其他脚本/npm模块(例如doctoc),但没有人用工作锚重现TOC。
只需要增加幻灯片的数量!它与markdown ioslides和revealjs演示一起工作
## Table of Contents
1. [introduction](#3)
2. [section one](#5)