Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/minoic/markdown-auto-catalog
GitHub action automatically update folder-based table of contents (TOC) in documents.
https://github.com/minoic/markdown-auto-catalog
bot document markdown toc toc-generator
Last synced: 3 days ago
JSON representation
GitHub action automatically update folder-based table of contents (TOC) in documents.
- Host: GitHub
- URL: https://github.com/minoic/markdown-auto-catalog
- Owner: minoic
- License: gpl-3.0
- Created: 2022-10-14T01:55:50.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-12T15:38:44.000Z (over 1 year ago)
- Last Synced: 2024-04-26T07:00:34.561Z (7 months ago)
- Topics: bot, document, markdown, toc, toc-generator
- Language: Go
- Homepage:
- Size: 1.39 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-auto-catalog
GitHub action automatically update folder-based table of contents in documents.This robot will help you scan the folder and add the directory in the form of a list to the specified location of the specified document.
An example repository using this tool: [minoic/stackoverflow-go-top-qa](https://github.com/minoic/stackoverflow-go-top-qa)
## Usage
Step 1
Add two tags `` to the appropriate location in the document where you want to add the catalog. This way, when the GitHub Action workflow job is completed, the catalog will be automatically added or updated between these two tags.
```markdown
## Catalog```
Step 2
Add workflow in your project by creating workflow file such as `.github/workflows/catalog.yml` with the code below:
```yaml
name: markdown-auto-catalogon:
push:
branches: [ "master" ]
workflow_dispatch:jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: minoic/[email protected]
with:
content-path: 'test/folder'
document-path: 'test/README.md'
filter: '\(.*\).md'
continue-on-error: true
```| Argument | Description | Required | Default |
|---------------|--------|----------|--------|
| content-path | Path of the documents to be listed in catalog. | Yes | |
| document-path | Path of the catalog document. | Yes | |
| filter | Filename Regex filter | Optional | \\(.*\\).md |## Preview
**Code view:**
```markdown
## Catalog- [0-intro.md](folder/0-intro.md)
- 1-chapter1
- [article1.md](folder/1-chapter1/article1.md)
- [article2.md](folder/1-chapter1/article2.md)
- [article3.md](folder/1-chapter1/article3.md)
- sub-catalog
- [sub-catalog.md](folder/1-chapter1/sub-catalog/sub-catalog.md)
- 2-chapter2
- [article4.md](folder/2-chapter2/article4.md)
- [article5.md](folder/2-chapter2/article5.md)
- [article6.md](folder/2-chapter2/article6.md)
- [article7.md](folder/2-chapter2/article7.md)```
**Reader view:**
>## Catalog
>
>
>
> - [0-intro.md](folder/0-intro.md)
> - 1-chapter1
> - [article1.md](folder/1-chapter1/article1.md)
> - [article2.md](folder/1-chapter1/article2.md)
> - [article3.md](folder/1-chapter1/article3.md)
> - sub-catalog
> - [sub-catalog.md](folder/1-chapter1/sub-catalog/sub-catalog.md)
> - 2-chapter2
> - [article4.md](folder/2-chapter2/article4.md)
> - [article5.md](folder/2-chapter2/article5.md)
> - [article6.md](folder/2-chapter2/article6.md)
> - [article7.md](folder/2-chapter2/article7.md)
>
>## Notice
1. When there are no files to change, there will be no PRs.
2. The previous PR is updated when it has not been merged and there are new changes.
3. If you don't like the red × when no files to change, add `continue-on-error: true` below the step.
4. Empty folders or folders containing filtered files are also displayed in the directory, so save unnecessary files in other directories.
5. Tables of contents are sorted in ascending lexicographical order and can be named using a format such as "01 - article title.md" to ensure the table of contents is in the order you want.