Skip to main content

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:

pip install mkdocs-snippet-plugin

Enable the plugin in your mkdocs.yml:

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-snippet-plugin-1.0.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

mkdocs_snippet_plugin-1.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-snippet-plugin-1.0.2.tar.gz.

File metadata

  • Download URL: mkdocs-snippet-plugin-1.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

File hashes

Hashes for mkdocs-snippet-plugin-1.0.2.tar.gz
Algorithm Hash digest
SHA256 df14858d648e8bd90736d02e2c202194d4ccb25e783fdf5e6d10afebd4eceae9
MD5 11da592bcbfd582e54f68bf59f61ee26
BLAKE2b-256 8d1a3d2b0861f47792efb18b5c77848398db75acdd6a677acb6d30b7a2f6cc78

See more details on using hashes here.

File details

Details for the file mkdocs_snippet_plugin-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_snippet_plugin-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

File hashes

Hashes for mkdocs_snippet_plugin-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8436a989464b7b5636697cfa2c469ce8e5efaa14e138ab77f526ec293d2a111
MD5 fca38e42ad40019d55da0e15b922d944
BLAKE2b-256 55142b7e88ab9ae3a2f2a78bebe4e60e9133a5adf855a73f7eb29dd3851a4783

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page