sixarm_ruby_markdown_table_of_contents
SixArm.com → Ruby → Markdown table of contents generator
https://github.com/sixarm/sixarm_ruby_markdown_table_of_contents
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 (9.4%) to scientific vocabulary
Repository
SixArm.com → Ruby → Markdown table of contents generator
Basic Info
- Host: GitHub
- Owner: SixArm
- License: other
- Language: Ruby
- Default Branch: main
- Size: 167 KB
Statistics
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
SixArm.com → Ruby →
Markdown table of contents gem

- Git: https://github.com/SixArm/sixarm_ruby_markdown_table_of_contents
- Doc: http://sixarm.com/sixarm_ruby_markdown_table_of_contents/doc
- Gem: https://rubygems.org/gems/sixarm_ruby_markdown_table_of_contents
- Contact: Joel Parker Henderson, joel@sixarm.com
- Project: changes, license, contributing.
Introduction
Update a markdown file by autogenerating a table of contents based on the markdown headlines.
Syntax:
markdown-table-of-contents [options] <file> ...
Example:
markdown-table-of-contents example.md
Limits:
This processes H2 headlines and lesser; this deliberately does not process H1 headlines.
This needs each headline anchor href to be unique; this deliberately does not do any disambiguation.
Options:
-b --bullet STRING: set the line bullet (default is "*")
-l --line-prefix STRING: set the line prefix (default is "")
--min INTEGER: set the headline minimum level (default is 2, meaning H2 and higher; currently 1 does not work, as is a known issue)
--max INTEGER: set the headline maximum level (default is 3, meaning H3 and lower)
--headline-regex REGEXP: set the headline regular expression
--contents-regex REGEXP: set the contents regular expression
Install
Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_markdown_table_of_contents
Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_markdown_table_of_contents'
Require
To require the gem in your code:
require 'sixarm_ruby_markdown_table_of_contents'
How it works
The command scans Markdown text for each Markdown headline, such as:
## Hello World
The command parses the headline to create a Markdown bullet list item link, such as:
The command processes all the headlines into a Markdown bullet list, such as:
* [Hello World](#hello-world)
* [Your Headline Here](#your-headline-here)
* [Foo Bar](#foo-bar)
The command searches for text that indicates a blank placeholder for a table of contents:
* [](#)
The command replaces the blank placeholder with the Markdown bullet list.
Later on, you can run the command again, and the command will rescan the headlines, create a fresh Markdown bullet list, and replace the existing Markdown bullet list.
Technical specifics
The command does a search/replace for first occurence of this regular expression: ^\* \[.*?\]\(#.*?\)$ and continues until the regular expression doesn't match.
which matches the blank placeholder and also matches an existing Markdown bullet list of links and anchors.
Demo
Demonstration Markdown file text, before the generator:
# My Demo Page
* [](#)
## Alpha
### Bravo
#### Charlie
#### Delta
Example Markdown file text, after the generator:
# My Demo Page
* [Alpha](#alpha)
* [Bravo](#bravo)
* [Charlie](#charlie)
* [Delta](#delta)
## Alpha
### Bravo
#### Charlie
#### Delta
Example of how GitHub renders the file, approximately:
<h1>Demo</h1>
TOC:
<ul>
<li><a href="#alpha">Alpha</a></li>
<li>
<ul>
<li><a href="#bravo">Bravo</a></li>
<li>
<ul>
<li><a href="#charlie">Charlie</a></li>
<li>
<ul>
<li><a href="#Delta">Delta</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2><a class="anchor" href="#alpha" id="user-content-alpha">Alpha</a></h2>
<h3><a class="anchor" href="#bravo" id="user-content-bravo">Bravo</a></h2>
<h4><a class="anchor" href="#charlie" id="user-content-charlie">Charlie</a></h2>
<h5><a class="anchor" href="#delta" id="user-content-delta">Delta</a></h2>
The GitHub automatic rendering typically adds more information, such as an SVG anchor image that shows/hides during hover.
Tracking
- Command: markdown-table-of-contents
- Version: 3.1.0
- Created: 2018-02-04
- Updated: 2018-12-23
- 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: SixArm.com → Ruby → <br> Markdown table of contents gem
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/sixarm_ruby_markdown_table_of_contents/'
description: SixArm.com → Ruby → <br> Markdown table of contents gem
repository-code: 'https://github.com/SixArm/sixarm_ruby_markdown_table_of_contents/'
abstract: >-
SixArm.com → Ruby → <br> Markdown table of contents gem
license: See license file
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Joel Parker Henderson | j****l@j****m | 41 |
| Oliver Kopp | k****v@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 2
- Total pull requests: 2
- Average time to close issues: 18 days
- Average time to close pull requests: about 14 hours
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 4.0
- Average comments per pull request: 1.0
- Merged pull requests: 1
- 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
Top Authors
Issue Authors
- koppor (2)
Pull Request Authors
- koppor (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- flay >= 2.12.0, < 3 development
- flog >= 4.6.2, < 5 development
- minitest >= 5.11.3, < 6 development
- rake >= 12.3.1, < 13 development
- reek >= 4.8.1, < 5 development
- rubocop >= 0.57.2, < 1 development
- rubycritic >= 3.4.0, < 4 development
- simplecov >= 0.16.1, < 2 development
- sixarm_ruby_minitest_extensions >= 1.0.8, < 2 development
- sixarm_ruby_file_rewrite >= 2, < 3
- sixarm_ruby_markdown >= 3.1.0, < 4
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- addressable 2.8.4
- ast 2.4.2
- axiom-types 0.1.1
- bundler 2.3.26
- codeclimate-engine-rb 0.4.2
- coercible 1.0.0
- descendants_tracker 0.0.4
- docile 1.4.0
- equalizer 0.0.11
- erubi 1.12.0
- flay 2.13.0
- flog 4.6.6
- ice_nine 0.11.2
- jaro_winkler 1.5.5
- launchy 2.4.3
- minitest 5.18.0
- parallel 1.23.0
- parser 2.5.3.0
- path_expander 1.1.1
- public_suffix 5.0.1
- rainbow 3.1.1
- rake 12.3.3
- reek 4.8.2
- rubocop 0.68.1
- ruby-progressbar 1.13.0
- ruby_parser 3.20.1
- rubycritic 3.5.2
- sexp_processor 4.17.0
- simplecov 0.22.0
- simplecov-html 0.12.3
- simplecov_json_formatter 0.1.4
- sixarm_ruby_equal_instance_variables 1.0.0
- sixarm_ruby_file_rewrite 2.0.0
- sixarm_ruby_markdown 3.1.0
- sixarm_ruby_markdown_table_of_contents 3.1.0
- sixarm_ruby_minitest_extensions 1.1.1
- thread_safe 0.3.6
- tty-which 0.3.0
- unicode-display_width 1.5.0
- virtus 1.0.5
