md-index


Namemd-index JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryGenerate markdown index of files in folder for mkdocs.
upload_time2023-03-10 13:29:32
maintainer
docs_urlNone
authormobyw
requires_python>=3.7,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # md-index

Generate markdown index of files in folder for mkdocs.

## Install

```bash
pip install md-index
```

## Usage

```bash
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

```bash
├─folder1
│  ├─file1.txt
│  ├─file2.txt
│  └─file3.txt
├─folder2
│  ├─file1.txt
│  └─file2.txt
└─README.md
```

```bash
md-index
```

### Two-level directory

```bash
├─folder1
│  ├─subfolder1
│  │  ├─file1.txt
│  │  ├─file2.txt
│  │  └─file3.txt
│  └─subfolder2
│  │  └─file1.txt
├─folder2
│  ├─subfolder1
│  │  └─file1.txt
│  └─subfolder2
│  │  ├─file1.txt
│  │  └─file2.txt
└─README.md
```

```bash
md-index --depth=2
```

### Github repository download link

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

### Example processing flow

```bash
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

```yml
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"
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "md-index",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "mobyw",
    "author_email": "mobyw66@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/36/568847a3161fd9a85024bcb686f8a92a9c9ed0a6fab108b6c4c5fa0b0f0e/md_index-0.1.1.tar.gz",
    "platform": null,
    "description": "# md-index\n\nGenerate markdown index of files in folder for mkdocs.\n\n## Install\n\n```bash\npip install md-index\n```\n\n## Usage\n\n```bash\nUsage: md-index [OPTIONS]\n\nOptions:\n  -i, --input-dir PATH        Input directory.\n  -o, --output-dir DIRECTORY  Output directory.\n  -d, --depth INTEGER         Depth of the file tree to generate, 1 or 2.\n  -u, --url-prefix TEXT       Prefix for the URLs in the generated index.\n  --help                      Show this message and exit.\n```\n\nThe 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.\n\nDefault 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.\n\n## Examples\n\n### Single level directory\n\n```bash\n\u251c\u2500folder1\n\u2502  \u251c\u2500file1.txt\n\u2502  \u251c\u2500file2.txt\n\u2502  \u2514\u2500file3.txt\n\u251c\u2500folder2\n\u2502  \u251c\u2500file1.txt\n\u2502  \u2514\u2500file2.txt\n\u2514\u2500README.md\n```\n\n```bash\nmd-index\n```\n\n### Two-level directory\n\n```bash\n\u251c\u2500folder1\n\u2502  \u251c\u2500subfolder1\n\u2502  \u2502  \u251c\u2500file1.txt\n\u2502  \u2502  \u251c\u2500file2.txt\n\u2502  \u2502  \u2514\u2500file3.txt\n\u2502  \u2514\u2500subfolder2\n\u2502  \u2502  \u2514\u2500file1.txt\n\u251c\u2500folder2\n\u2502  \u251c\u2500subfolder1\n\u2502  \u2502  \u2514\u2500file1.txt\n\u2502  \u2514\u2500subfolder2\n\u2502  \u2502  \u251c\u2500file1.txt\n\u2502  \u2502  \u2514\u2500file2.txt\n\u2514\u2500README.md\n```\n\n```bash\nmd-index --depth=2\n```\n\n### Github repository download link\n\n```bash\nmd-index --url-prefix=https://raw.githubusercontent.com/{user}/{repo}/{branch}/\n```\n\n### Example processing flow\n\n```bash\npip install md-index\npip install mkdocs\ncd /path/to/project\nmd-index\nmkdocs build\n```\n\nThe 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`.\n\n### Automatically publishing a GitHub file repository to Github Pages\n\n```yml\nname: Build and Deploy\non: [push]\njobs:\n  build-and-deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n\n      - name: Install Python 3.10\n        uses: actions/setup-python@v4\n        with:\n          python-version: \"3.10\"\n\n      - name: Install md-index\n        run: pip install md-index\n\n      - name: Install mkdocs\n        run: pip install mkdocs\n\n      - name: Build index\n        run: md-index\n        working-directory: \"./\"\n\n      - name: Build website\n        run: mkdocs build\n        working-directory: \"./\"\n\n      - name: Upload build folder to gh-pages branch\n        uses: peaceiris/actions-gh-pages@v3\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          publish_dir: \"./site\"\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate markdown index of files in folder for mkdocs.",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7531a3ac98468cd87c1c4351b507a8a5870269b816c56b79fcd27e3742bc2c34",
                "md5": "e3b4084f57b2cf9a7964f2e83b9519e9",
                "sha256": "563ede2165fe45e90c429e49297378b6b9b41ff48ed4839f9f01e8a36b24d2b6"
            },
            "downloads": -1,
            "filename": "md_index-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3b4084f57b2cf9a7964f2e83b9519e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 4980,
            "upload_time": "2023-03-10T13:29:30",
            "upload_time_iso_8601": "2023-03-10T13:29:30.751715Z",
            "url": "https://files.pythonhosted.org/packages/75/31/a3ac98468cd87c1c4351b507a8a5870269b816c56b79fcd27e3742bc2c34/md_index-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d36568847a3161fd9a85024bcb686f8a92a9c9ed0a6fab108b6c4c5fa0b0f0e",
                "md5": "c58c537ff72c7d70b75ff066046667f7",
                "sha256": "656c621db41395426053205b3dcee4823cd44083118e2907c92b253d1d71bbdf"
            },
            "downloads": -1,
            "filename": "md_index-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c58c537ff72c7d70b75ff066046667f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 4173,
            "upload_time": "2023-03-10T13:29:32",
            "upload_time_iso_8601": "2023-03-10T13:29:32.845117Z",
            "url": "https://files.pythonhosted.org/packages/8d/36/568847a3161fd9a85024bcb686f8a92a9c9ed0a6fab108b6c4c5fa0b0f0e/md_index-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-10 13:29:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "md-index"
}
        
Elapsed time: 0.15741s