Coder Social home page Coder Social logo

mdtoc's Introduction

Markdown Table of Contents Generator

mdtoc is a utility for generating a table-of-contents for markdown files.

Only github-flavored markdown is currently supported, but I am open to accepting patches to add other formats.

Table of Contents

Generated with mdtoc --inplace README.md

Usage

Usage: mdtoc [OPTIONS] [FILE]... Generate a table of contents for a markdown file (github flavor).

TOC may be wrapped in a pair of tags to allow in-place updates:

<!-- toc -->
generated TOC goes here
<!-- /toc -->

TOC indentation is normalized, so the shallowest header has indentation 0.

Options:

--dryrun - Whether to check for changes to TOC, rather than overwriting. Requires --inplace flag. Exit code 1 if there are changes.

--inplace - Whether to edit the file in-place, or output to STDOUT. Requires toc tags to be present.

--skip-prefix - Whether to ignore any headers before the opening toc tag. (default true)

For example, with --skip-prefix=false the TOC for this file becomes:

- [Markdown Table of Contents Generator](#markdown-table-of-contents-generator)
- [Table of Contents](#table-of-contents)
  - [Usage](#usage)
  - [Installation](#installation)

Installation

On linux, simply download and run the standalone release binary

# Optional: Verify the file integrity - check the release notes for the expected value.
$ sha256sum $BINARY
$ chmod +x $BINARY

Or, if you have a go development environment set up:

go get sigs.k8s.io/mdtoc

Community, discussion, contribution, and support

Learn how to engage with the Kubernetes community on the community page.

You can reach the maintainers of this project at:

Code of conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.

mdtoc's People

Contributors

cpanato avatar dependabot[bot] avatar k8s-ci-robot avatar puerco avatar saschagrunert avatar tallclair avatar thockin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mdtoc's Issues

Limit Header depth for TOC?

kubernetes/enhancements#2407

I'd like to still use markdown for PRR questions, but I don't want some headers to show up in the TOC.

I'd propose something like --max-header-depth (defaults to 6 as per markdown). We could set that to 5 in enhancements, and use ###### Question text instead of <h4>Question text</h4>.

Thoughts?

Binary missing since version v1.0.1

I've noticed that since version v1.0.1, the binary file is no longer available for download.

However, the documentation suggests that you only need to download this binary to use the software.

Would it be possible to make this file available again? Manual compilation can be quite tedious, and I think the availability of the binary would make installation much easier for many users.

Thanks in advance

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.