Skip to main content

md-index

Generate markdown index of files in folder for mkdocs.

Install

pip install md-index

Usage

Usage: md-index [OPTIONS]

Options:
  -i, --input-dir PATH        Input directory.
  -o, --output-dir DIRECTORY  Output directory.
  -d, --depth INTEGER         Depth of the file tree to generate, 1 or 2.
  -u, --url-prefix TEXT       Prefix for the URLs in the generated index.
  --help                      Show this message and exit.

The command will generate a folder (default: docs) with a markdown file for each folder in the input directory (default: .). The markdown file will contain a list of files in the folder.

Default depth is 1, which means only the folders in the root of the input directory will be processed. Depth 2 will process the folders in the root and the subfolders. The depth is limited to 2.

Examples

Single level directory

├─folder1
│  ├─file1.txt
│  ├─file2.txt
│  └─file3.txt
├─folder2
│  ├─file1.txt
│  └─file2.txt
└─README.md
md-index

Two-level directory

├─folder1
│  ├─subfolder1
│  │  ├─file1.txt
│  │  ├─file2.txt
│  │  └─file3.txt
│  └─subfolder2
│  │  └─file1.txt
├─folder2
│  ├─subfolder1
│  │  └─file1.txt
│  └─subfolder2
│  │  ├─file1.txt
│  │  └─file2.txt
└─README.md
md-index --depth=2

Github repository download link

md-index --url-prefix=https://raw.githubusercontent.com/{user}/{repo}/{branch}/

Example processing flow

pip install md-index
pip install mkdocs
cd /path/to/project
md-index
mkdocs build

The generated markdown index is in folder docs and the mkdocs site is in folder site. If you don't have a mkdocs.yml file in the root of the input directory, a simple yml file will be auto generated and set the website name File Index and theme readthedocs.

Automatically publishing a GitHub file repository to Github Pages

name: Build and Deploy
on: [push]
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install Python 3.10
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Install md-index
        run: pip install md-index

      - name: Install mkdocs
        run: pip install mkdocs

      - name: Build index
        run: md-index
        working-directory: "./"

      - name: Build website
        run: mkdocs build
        working-directory: "./"

      - name: Upload build folder to gh-pages branch
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: "./site"

Metadata

Release files for md-index 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-index 0.1.1
File Size Uploaded Provenance
md_index-0.1.1.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for md-index 0.1.1
File Interpreter ABI Platform
md_index-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / md_index-0.1.1.tar.gz

Download URL md_index-0.1.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
656c621db41395426053205b3dcee4823cd44083118e2907c92b253d1d71bbdf
BLAKE2b-256 checksum
How to use checksums
8d36568847a3161fd9a85024bcb686f8a92a9c9ed0a6fab108b6c4c5fa0b0f0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Windows/10

Release files / md_index-0.1.1-py3-none-any.whl

Download URL md_index-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
563ede2165fe45e90c429e49297378b6b9b41ff48ed4839f9f01e8a36b24d2b6
BLAKE2b-256 checksum
How to use checksums
7531a3ac98468cd87c1c4351b507a8a5870269b816c56b79fcd27e3742bc2c34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Windows/10

Security for md-index 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page