All Projects → bkuhlmann → tocer

bkuhlmann / tocer

Licence: other
A command line interface for generating table of contents for Markdown files.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to tocer

tocdown
A table of contents generator for markdown
Stars: ✭ 11 (-75%)
Mutual labels:  table-of-contents, toc
markedpp
Preprocessor for markdown files
Stars: ✭ 21 (-52.27%)
Mutual labels:  table-of-contents, toc
Github Markdown Toc
Easy TOC creation for GitHub README.md
Stars: ✭ 2,734 (+6113.64%)
Mutual labels:  table-of-contents, toc
markdown-index
Generate a global index for multiple markdown files recursively
Stars: ✭ 15 (-65.91%)
Mutual labels:  table-of-contents, toc
Norepeat
The norepeat package contains some magical function, tools
Stars: ✭ 111 (+152.27%)
Mutual labels:  toc
Jekylltheme Projectgaia
Jekyll Theme Project Gaia. V2 Beta Released !! Check it out ->
Stars: ✭ 111 (+152.27%)
Mutual labels:  toc
Hexo Toc
📖 Insert a markdown TOC before posts be rendered.
Stars: ✭ 106 (+140.91%)
Mutual labels:  toc
medium-toc
Easily create a table of contents for your Medium articles in just one click. ✨
Stars: ✭ 33 (-25%)
Mutual labels:  table-of-contents
Tocbot
Build a table of contents from headings in an HTML document.
Stars: ✭ 862 (+1859.09%)
Mutual labels:  toc
tw5-locator
TiddlyWiki plugin: Discover and search by context, related tags
Stars: ✭ 38 (-13.64%)
Mutual labels:  table-of-contents
Toc Org
toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
Stars: ✭ 202 (+359.09%)
Mutual labels:  toc
Toc Generator
GitHub Actions to generate TOC (Table of Contents)
Stars: ✭ 120 (+172.73%)
Mutual labels:  toc
indices
Indices creates a Table of Contents sidebar for Medium articles, and enables you to skip around
Stars: ✭ 16 (-63.64%)
Mutual labels:  table-of-contents
vim-eightheader
Vim plugin: Easily create custom headlines, foldtext, toc, etc
Stars: ✭ 17 (-61.36%)
Mutual labels:  table-of-contents
toctoc
Generates and maintain a Table of Content for your README.md.
Stars: ✭ 16 (-63.64%)
Mutual labels:  table-of-contents
Remark Toc
plugin to generate a Table of Contents (TOC)
Stars: ✭ 165 (+275%)
Mutual labels:  toc
Markdown Toc
Generate a markdown TOC (table of contents) for a README or any markdown files, using remarkable. Used by assemble, verb, and lots of other projects on GitHub. API and CLI.
Stars: ✭ 1,185 (+2593.18%)
Mutual labels:  toc
markdown-github-bear-toc
Autogenerated Table of Contents for Github Markdown or Bear Notes
Stars: ✭ 79 (+79.55%)
Mutual labels:  table-of-contents
md-toc
Automatically generate a compliant table of contents for a markdown file to improve document readability
Stars: ✭ 18 (-59.09%)
Mutual labels:  table-of-contents
Markdown Toc
🎄Generate toc for github markdown file.(为 markdown 文件生成 toc 目录)
Stars: ✭ 144 (+227.27%)
Mutual labels:  toc

Tocer

Tocer (a.k.a. Table of Contenter) is a command line interface for generating table of contents for Markdown files. Use this tool to automatically manage and update your documentation with minimal effort. Works on single files or multiple files within nested directory structures.

Features

  • Supports Markdown ATX-style headers. Example: # Header.

    • Does not support header suffixes. Example: # Header #.

    • Does not support header prefixes without spaces. Example: #Header.

  • Supports table of contents generation for single or multiple files.

  • Supports custom label. Default: ## Table of Contents.

  • Supports file list filtering. Default: "README.md".

  • Prepends table of contents to Markdown documents that don’t have table of contents.

  • Rebuilds Markdown documents that have existing table of contents.

Requirements

  1. A UNIX-based system.

  2. Ruby.

Setup

To install, run:

gem install tocer

Usage

Command Line Interface (CLI)

From the command line, run: tocer --help

USAGE:
  -c, --config ACTION                      Manage gem configuration: edit or view.
  -h, --help                               Show this message.
  -i, --insert [PATH]                      Insert/update table of contents. Default: ".".
  -v, --version                            Show gem version.

OPTIONS:
      --includes [a,b,c]                   Add include patterns. Default: ["README.md"].
      --label [LABEL]                      Add label. Default: "## Table of Contents".

To generate the table of contents at a specific position within your Markdown files, add the following lines to your file(s) prior to generation:

<!-- Tocer[start] -->
<!-- Tocer[finish] -->

In the case that Tocer has auto-generated a table of contents for a Markdown file; the existing table of contents has become stale; or placement of the table of contents has changed, you can re-run Tocer on that file to auto-update it with new table of contents.

Customization

This gem can be configured via a global configuration: ~/.config/tocer/configuration.yml.

It can also be configured via XDG environment variables.

The default configuration is as follows:

:label: "## Table of Contents"
:includes:
  - "README.md"
:root_dir: "."

Feel free to take this default configuration, modify, and save as your own custom configuration.yml.

The configuration.yml file can be configured as follows:

  • label: The header label for the table of contents.

  • includes: The list of included files.

  • root_dir: The root path to use for processing files.

There are multiple ways the include list can be defined. Here are some examples:

# Use an empty array to ignore all files:
:includes: []

# Use an array of wildcards for groups of files with similar extensions:
:includes:
  - "*.md"
  - "*.mkd"
  - "*.markdown"

# Use a mix of wild cards and relative names/paths to customized as necessary:
:includes:
  - "README.md"
  - "docs/*.md"
  - "*.markdown"

# Use a recursive glob to traverse and update all sub-directories:
:includes:
  - "**/*.md"

Rake

You can add Rake support by adding the following to your Rakefile:

begin
  require "tocer/rake/register"
rescue LoadError => error
  puts error.message
end

Tocer::Rake::Register.call

Once required and registered, the following tasks will be available (i.e. bundle exec rake -T):

rake toc[label,includes]   # Insert/Update Table of Contents

You can invoke the task as follows (quotes are only necessary if spaces are used):

rake toc["## Example, *.md"]

Development

To contribute, run:

git clone https://github.com/bkuhlmann/tocer
cd tocer
bin/setup

You can also use the IRB console for direct access to all objects:

bin/console

Tests

To test, run:

bin/rake

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].