An mkdocs plugin that injects snippets from a file in a git repository
Project description
# mkdocs-snippet-plugin
An mkdocs plugin that injects snippets from a file in a git repository.
## Installation
> **Note:** This package requires MkDocs version 0.17 or higher.
Install the package with pip:
```bash
pip install mkdocs-snippet-plugin
```
Enable the plugin in your `mkdocs.yml`:
```yaml
plugins:
- snippet:
base_path: docs
```
The `base_path` entry should point to the root of your documentation site, usually defaulted to `docs`.
## How to use it
If you have a markdown file in a remote Git repostory, and you want to extract a sections from it, add the following to your documentation markdown in mkdocs:
```
{{ snippet('git@github.com:mprivat/mkdocs-snippet-plugin.git', 'README.md', '## Installation') }}
```
It will download the file you specify from the Git URL, extract the section you ask for (including its subsections) and inject that into your mkdocs file at render time.
If the remote file has references to images, those will also be downloaded and placed in a `_gen` folder in the mkdocs hierarchy. You will probably want to include `**/gen_` in your `.gitignore` file so you don't put those into your git repository unless you want them there.
An mkdocs plugin that injects snippets from a file in a git repository.
## Installation
> **Note:** This package requires MkDocs version 0.17 or higher.
Install the package with pip:
```bash
pip install mkdocs-snippet-plugin
```
Enable the plugin in your `mkdocs.yml`:
```yaml
plugins:
- snippet:
base_path: docs
```
The `base_path` entry should point to the root of your documentation site, usually defaulted to `docs`.
## How to use it
If you have a markdown file in a remote Git repostory, and you want to extract a sections from it, add the following to your documentation markdown in mkdocs:
```
{{ snippet('git@github.com:mprivat/mkdocs-snippet-plugin.git', 'README.md', '## Installation') }}
```
It will download the file you specify from the Git URL, extract the section you ask for (including its subsections) and inject that into your mkdocs file at render time.
If the remote file has references to images, those will also be downloaded and placed in a `_gen` folder in the mkdocs hierarchy. You will probably want to include `**/gen_` in your `.gitignore` file so you don't put those into your git repository unless you want them there.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for mkdocs-snippet-plugin-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a885313d45f6f7f8636af1ace52fa6614366762514e5543e420f67d437c90be |
|
MD5 | 587597a1f4de29da3b045df22c50ca04 |
|
BLAKE2b-256 | de4a73b2f69025777264e6031be75a2d3d15ca445a546128a3b29798520e5248 |
Close
Hashes for mkdocs_snippet_plugin-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 941f844c9b46ebce517bb75856fcaf6e1f3e7fe21adeba70e4dc4d5c679c2e37 |
|
MD5 | df49b7d4364bc889dec93ebb643cf696 |
|
BLAKE2b-256 | 35a0d63db855dc9865263fa44f24c65e4b9c1df3df9af6f9d05cb92db97cd5e3 |