Giter VIP home page Giter VIP logo

tocgen's Introduction

tocgen

Produce a Table of Contents from a Markdown (.md) document.

Table of Contents

Introduction

This simple shell script reads a file that is in markdown format and extracts all the headers. From this it produces a small snippet of markdown which constitutes a table of contents of links.

Dependencies

This is a shell script. Uses sed and awk and of course /bin/sh. Oh and it uses grep. No other dependencies.

Files

  • tocgen.sh - this is the shell script to run
  • SAMPLE.md - this is a sample file
  • SAMPLE_TOC.md - this is the output of the script.

Usage

Standard Usage:
	$ ./tocgen.sh README.md > toc.md

Split Usage:
	$ ./tocgen.sh pass1 README.md > tmp.txt

Review the file tmp.txt for errors:
	$ ./tocgen.sh pass2 tmp.txt > toc.md

Example

This is just made up stuff. The table of contents for the README.md file was produced using this script.

Stuff A

Stuff A goes here.

Stuff B

Stuff B goes here. Now we have more sub stuff:

B.1

Here is the first subdivision of Stuff B

B.2

Here is the second subdivision of Stuff B

B.3

Here is the third subdivision of Stuff B

Stuff C

Stuff C goes here.

History

In 2023 I was writting a large README.md file. I wanted to have a nice table of contents for it. I searched github for a solution. The solutions all were convoluted pieces of crap. Over designed junk. They didn't work! Standard crappy software by standard crappy developers.

Author

Ken Stauffer

tocgen's People

Contributors

kjs452 avatar

Watchers

 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.