Skip to main content

MkDocs plugin that renders gitsvg git-graph diagrams from fenced code blocks to inline SVG.

Project description

mkdocs-gitsvg

MkDocs plugin that renders gitsvg git-graph diagrams from fenced code blocks to inline SVG at build time.

CI PyPI Python License

No client-side JavaScript: diagrams are rendered server-side at build time, so they work in any browser and in offline / PDF exports.

Installation

pip install mkdocs-gitsvg

Usage

Enable the plugin in mkdocs.yml:

plugins:
  - gitsvg

Then draw a git graph in any page with a ```gitsvg fenced block whose body is a gitsvg JSONL op-stream:

```gitsvg
{"op": "branch", "name": "main", "label_side": "before"}
{"op": "commit", "branch": "main", "id": "c1", "msg": "initial commit", "hash": "auto"}
{"op": "commit", "branch": "main", "id": "c2", "msg": "add README", "hash": "auto"}
```

The block renders to an inline SVG git graph in the built site.

Configuration

The plugin needs no configuration. Available options (with defaults):

plugins:
  - gitsvg:
      fence_name: gitsvg          # fenced-block language tag to intercept
      css_class: gitsvg-diagram   # class on the wrapper <div>
      on_error: warn              # warn | raise | show

on_error controls what happens when a diagram fails to render: warn (default) shows an error box and logs a warning (so mkdocs build --strict fails), raise fails the build immediately, and show shows the box silently. A bundled stylesheet is linked automatically. See the documentation site for the full reference.

License

MIT — see LICENSE.

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_gitsvg-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_gitsvg-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_gitsvg-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_gitsvg-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkdocs_gitsvg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e09311005ecf4e04f7ffb6c349dcba820e65b0480fe6862216554bf65883d66b
MD5 3143eebeb450349003b862546bad8000
BLAKE2b-256 10ec9a19495a82a9019798af4347be3774e29f195f4cee7771b8396c47de889f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_gitsvg-0.1.0.tar.gz:

Publisher: release_tag.yml on bertpl/mkdocs-gitsvg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkdocs_gitsvg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_gitsvg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkdocs_gitsvg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9c000b57a111df5d64e1624ea60f6453c037a911d3258177aa231861fb62b7d
MD5 dfc243ebc4e4f8b2f1df84020634cd72
BLAKE2b-256 7cd080ff2018ab50ace56b9f9357a4977f406d69f160845686b2cb447f47b195

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_gitsvg-0.1.0-py3-none-any.whl:

Publisher: release_tag.yml on bertpl/mkdocs-gitsvg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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