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

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

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

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

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

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


当前回答

MultiMarkdown 4.7有一个{{TOC}}宏,用于插入一个目录表。

其他回答

只需要增加幻灯片的数量!它与markdown ioslides和revealjs演示一起工作

## Table of Contents

 1. [introduction](#3)
 2. [section one](#5)

这是一个简短的PHP代码,我用来生成TOC,并丰富任何标题与锚:

$toc = []; //initialize the toc to an empty array
$markdown = "... your mardown content here...";

$markdown = preg_replace_callback("/(#+)\s*([^\n]+)/",function($matches) use (&$toc){
    static $section = [];
    $h = strlen($matches[1]);

    @$section[$h-1]++;
    $i = $h;
    while(isset($section[$i])) unset($section[$i++]);

    $anchor = preg_replace('/\s+/','-', strtolower(trim($matches[2])));

    $toc[] = str_repeat('  ',$h-1)."* [".implode('.',$section).". {$matches[2]}](#$anchor)";
    return str_repeat('#',$h)." <strong>".implode('.',$section).".</strong> ".$matches[2]."\n<a name=\"$anchor\"></a>\n";
}, $markdown);

然后你可以打印经过处理的markdown和toc:

   print(implode("\n",$toc));
   print("\n\n");
   print($markdown);

你可以使用DocToc从命令行生成目录:

doctoc /path/to/file

要使链接与Bitbucket生成的锚点兼容,请使用——Bitbucket参数运行它。

根据您的工作流程,您可能想要查看捷联式

这是原始版本(http://strapdownjs.com)的一个分支,它添加了目录的生成。

在repo上有一个apache配置文件(可能还没有正确更新)来包装简单的markdown,如果你不喜欢写在html文件中。

你可以试一试。

# 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)