🎄Generate toc for github markdown file.(为 markdown 文件生成 toc 目录)
APACHE-2.0 License
_ __ ___ __ _ _ __| | ____| | _____ ___ __ | |_ ___ ___
| '_ ` _ \ / _` | '__| |/ / _` |/ _ \ \ /\ / / '_ \ _____| __/ _ \ / __|
| | | | | | (_| | | | < (_| | (_) \ V V /| | | |_____| || (_) | (__
|_| |_| |_|\__,_|_| |_|\_\__,_|\___/ \_/\_/ |_| |_| \__\___/ \___|
Markdown-to-toc can be used to generate a directory of the Markdown page for github page rendering.
note
For the title, there are two kinds of md grammar [setext] (http://docutils.sourceforge.net/mirror/setext.html) And [atx] (http://www.aaronsw.com/2002/atx/) mode.
atx form is only supported temporarily.
Github Markdown file one click to generate the directory
fluent and elegant writing is supported
support multiple generation
support the generation of duplicate titles
supports filtering of special characters
supports specifying different file codes
supports batch processing of files in folders (you can specify whether subfolder files are included)
supports writing to files, returns contents of the directory, and allows users to process by themselves
support multi-threads for directory files.
support i18n
support gen toc number
JDK8+, make sure the JDK is set up correctly.
Note: If you are use jdk7,download this code and compile by yourself.
Jars are managed uniformly using Maven.
Change log
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>markdown-toc</artifactId>
<version>${maven-version}</version>
</dependency>
The project for the support of md file name suffix .md
or .markdown
AtxMarkdownToc.newInstance().genTocFile(path);
Where path is the path of md file
AtxMarkdownToc.newInstance().genTocFile(path);
Where path is the parent class folder of the md file
AtxMarkdownToc.newInstance()
.charset("UTF-8")
.write(true)
.subTree(true);
序号 | 属性 | 默认值 | 说明 |
---|---|---|---|
1 | charset | UTF-8 |
file charset |
2 | write | true |
will toc written to the file (default write) |
3 | subTree | true |
does it include subfolders(default includes) |
3 | order | false |
does it gen toc order num(default false, since 1.0.5) |
genTocFile()
returns TocGen, genTocDir()
returns List
序号 | 属性 | 类型 | 说明 |
---|---|---|---|
1 | filePath | String | current md filePath |
2 | tocLines | List | current md file toc content |
a single file - directory to generate test cases
folder - directory to generate test cases
[Issues & Bugs] (https://github.com/houbb/markdown-toc/issues)