GithubHelp home page GithubHelp logo

wangzijian156 / markdown-toc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from houbb/markdown-toc

0.0 1.0 0.0 220 KB

🎄Generate toc for github markdown file.(为 markdown 文件生成 toc 目录)

License: Apache License 2.0

Batchfile 1.77% Shell 4.83% Java 93.40%

markdown-toc's Introduction

Table of Contents

markdown-toc

  _ __ ___   __ _ _ __| | ____| | _____      ___ __       | |_ ___   ___ 
 | '_ ` _ \ / _` | '__| |/ / _` |/ _ \ \ /\ / / '_ \ _____| __/ _ \ / __|
 | | | | | | (_| | |  |   < (_| | (_) \ V  V /| | | |_____| || (_) | (__ 
 |_| |_| |_|\__,_|_|  |_|\_\__,_|\___/ \_/\_/ |_| |_|      \__\___/ \___|
 

Maven Central Build Status Coverage Status

Markdown-toc 可以用来生成 markdown 页面的目录,便于 github 页面展现。

  • 文档

中文说明 | English Readme

备注

对于标题,md 有两种语法 setextatx 模式。

暂时只支持 atx 形式。

变更日志

变更日志

Features

  • Github Markdown 文件一键生成目录

  • 支持 fluent 优雅的写法

  • 支持多次生成

  • 支持重复标题的生成

  • 支持特殊字符的过滤

  • 支持指定不同的文件编码

  • 支持文件夹的文件批量处理(可指定是否包含子文件夹文件)

  • 支持是否写入文件,可返回目录的内容,便于用户自行处理

  • 支持多线程写文件

  • 支持 i18n

  • 支持目录编号生成(1.0.5)

v1.0.8 更新日志

  1. 优化 github 对应的链接地址,修复中文符号 BUG

环境依赖

JDK

1.0.5 及其以前为 jdk8 编译, 请确保 JDK 设置正确。

1.0.6 版本使用 jdk7 编译上传。

后续 1.XX 版本都将支持 jdk7,更便于使用。

Maven

Jar 使用 Maven 进行统一管理。

快速入门

maven 引入

<dependency>
    <groupId>com.github.houbb</groupId>
    <artifactId>markdown-toc</artifactId>
    <version>${maven-version}</version>
</dependency>

md 文件

本项目支持的 md 文件后缀名称为 .md 或者 .markdown

快速开始

  • 单个文件
AtxMarkdownToc.newInstance().genTocFile(path);

其中 path 为 md 文件的路径

  • 指定文件夹
AtxMarkdownToc.newInstance().genTocFile(path);

其中 path 为 md 文件的父类文件夹

属性配置

  • 代码示例
AtxMarkdownToc.newInstance()
                .charset("UTF-8")
                .write(true)
                .subTree(true);

属性说明

序号 属性 默认值 说明
1 charset UTF-8 文件编码
2 write true 是否将 toc 写入文件(默认写入)
3 subTree true 是否包含子文件夹的文件(默认包含)
4 order false 是否生成目录编号(默认不生成,1.0.5以后)

返回值说明

genTocFile() 返回 TocGen,genTocDir() 返回 List

  • TocGen 属性说明
序号 属性 类型 说明
1 filePath String 当前 md 的文件路径
2 tocLines List 当前 md 文件对应的目录内容

测试案例

单个文件-目录生成测试案例

文件夹-目录生成测试案例

其他

Issues & Bugs

markdown-toc's People

Contributors

houbb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.