markdown-file-toc-generator
Markdown Table Of Contents generator script
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.0%) to scientific vocabulary
Repository
Markdown Table Of Contents generator script
Basic Info
- Host: GitHub
- Owner: SixArm
- License: other
- Language: Ruby
- Default Branch: main
- Size: 13.7 KB
Statistics
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
Markdown TOC generator
Update a markdown file by autogenerating a table of contents based on the markdown headlines.
Syntax:
markdown-toc-generator <file>
Example:
markdown-toc-generator example.md
Limits:
This does H2 headlines and lesser; this does not do H1 headlines.
This needs each headline anchor href to be unique; this does not auto-number them.
Install
This command uses Ruby.
Verify you have Ruby version 2.2 or better:
ruby -v
Copy this command to somewhere on your path such as:
curl https://raw.githubusercontent.com/SixArm/markdown-toc-generator/master/markdown-toc-generator --output /usr/local/bin/markdown-toc-generator
TODO: transition this to a gem, then to Rust.
How it works
The command parses the Markdown file using GitHub's HTML pipeline.
Example Markdown headline:
## Hello World
The pipeline generates a headline anchor href string:
hello-world
The command creates a markdown list item:
* [Hello World](#hello-world)
The command searches the text for the abbreviation "TOC:" that starts a line, and is on the line by itself.
TOC:
The command replaces successive non-blank lines with the markdown list items:
TOC:
* [Hello World](#hello-world)
Demo
Demonstration Markdown file text, before the generator:
# Demo
TOC:
## Alpha
Lorem ipsum...
## Bravo
Lorem ipsum...
## Charlie
Lorem ipsum...
Example Markdown file text, after the generator:
# Demo
TOC:
* [Alpha](#alpha)
* [Bravo](#bravo)
* [Charlie](#charlie)
## Alpha
Lorem ipsum...
## Bravo
Lorem ipsum...
## Charlie
Lorem ipsum...
Example of how GitHub renders the file, approximately:
<h1>Demo</h1>
TOC:
<ul>
<li><a href="#alpha">Alpha</a></li>
<li><a href="#bravo">Bravo</a></li>
<li><a href="#charlie">Charlie</a></li>
</ul>
<h2><a class="anchor" href="#alpha" id="user-content-alpha">Alpha</a></h2>
Lorem ipsum...
<h2><a class="anchor" href="#bravo" id="user-content-bravo">Bravo</a></h2>
Lorem ipsum...
<h2><a class="anchor" href="#charlie" id="user-content-bravo">Charlie</a></h2>
Lorem ipsum...
The GitHub automatic rendering typically adds more information, such as an SVG anchor image that shows/hides during hover.
Tracking
- Command: markdown-toc-generator
- Version: 1.6.0
- Created: 2018-02-04
- Updated: 2018-02-06
- License: Open source as described in the file LICENSE.md
- Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)
Owner
- Name: SixArm
- Login: SixArm
- Kind: organization
- Email: sixarm@sixarm.com
- Location: San Francisco
- Website: http://sixarm.com
- Twitter: sixarm
- Repositories: 580
- Profile: https://github.com/SixArm
SixArm Software
Citation (CITATION.cff)
cff-version: 1.2.0
title: Markdown TOC generator
message: >-
If you use this work and you want to cite it,
then you can use the metadata from this file.
type: software
authors:
- given-names: Joel Parker
family-names: Henderson
email: joel@joelparkerhenderson.com
affiliation: joelparkerhenderson.com
orcid: 'https://orcid.org/0009-0000-4681-282X'
identifiers:
- type: url
value: 'https://github.com/SixArm/markdown-file-toc-generator/'
description: Markdown TOC generator
repository-code: 'https://github.com/SixArm/markdown-file-toc-generator/'
abstract: >-
Markdown TOC generator
license: See license file
GitHub Events
Total
- Push event: 2
Last Year
- Push event: 2
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Joel Parker Henderson | j****l@j****m | 11 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0