MarkdownChildrenKit

develop

Swift package for generating a markdown list of files and folders and saving it to a markdown file.
ptrkstr/MarkdownChildrenKit
Markdown Logo with list

MarkdownChildrenKit


Generates a markdown list of children files and folders and saves it to a markdown file.
Useful when wanting an index in a readme.md.
Available as a command line tool here.

Example

GIVEN a readme.md file exists

My favourite things are:
<!-- markdown-children:start -->
<!-- markdown-children:end -->
AND it's in this directory Directory of files and folders
WHEN MarkdownChildrenKit is invoked
try MarkdownChildren().process(.init(
    url: URL(string: "../readme.md",
    nameType: .useH1,
    tagStart: "<!-- markdown-children:start -->",
    tagEnd: "<!-- markdown-children:end -->",
    saver: saver
))

THEN the readme.md turns into:

My favourite things are:
<!-- markdown-children:start -->
- [Animals](animals.md)
- animals
  - pets
    - [Cats](animals/pets/cats.md)
    - [Dogs](animals/pets/dogs.md)
  - zoo
    - [Tiger](animals/zoo/tiger.md)
- [Clothes](clothes.md)
- clothes
  - summer
    - [Dress](clothes/summer/dress.md)
    - [Hat](clothes/summer/hat.md)
  - winter
    - [Jumper](clothes/winter/jumper.md)
    - [Pants](clothes/winter/pants.md)
<!-- markdown-children:end -->

Installation

SPM

Add the following to your project:

https://github.com/ptrkstr/MarkdownChildrenKit

TODO

  • Option - Choose list node (-, * or +)
  • Option - Skip folder if it doesn't contain any markdown files

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 20 2024 00:47:26 GMT-0900 (Hawaii-Aleutian Daylight Time)