Skip to main content

mkdocs-plugin-inline-svg-mod

Reads SVG images referenced from Markdown and replaces them with the SVG file content

Since the SVG is included as part of the plain-text input to MkDocs, this means the default MkDocs search supports searching SVG text, and hyperlinks are also fully functional.

Usage

Install the package with pip:

pip install mkdocs-plugin-inline-svg-mod

Enable the plugin in your mkdocs.yml:

plugins:
    - search
    - inline-svg

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

More information about plugins in the MkDocs documentation

Options

You can filter with the extension to select files to be inline. Useful to mix regular and inlined svgs.:

plugins:
    - search
    - inline-svg:
        extension: ".inline.svg"
        delete: "<regex-string>"

The delete parameter will remove the matching string from the SVG file content. Example:

Sample SVG content

<svg>
<defs>
</defs>
<svg>

YAML config delete: "(?s)<defs>.*</defs>|\n"

SVG content loaded into HTML will become:

<svg></svg>

Credits

I am not really a Python programmer, so I have borrowed plugin setup / utils / inspiration from:

rajguru7 I have cloned this from https://gitlab.com/nicolas.dupont/mkdocs-plugin-inline-svg/-/tree/master which is a fork of https://gitlab.com/craig0990/mkdocs-plugin-inline-svg

Credits to @craig0990 and @nicolar.dupont (GitLab) for the base plugin.

Metadata

Release files for mkdocs-plugin-inline-svg-mod 0.0.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 mkdocs-plugin-inline-svg-mod 0.0.1
File Size Uploaded
mkdocs_plugin_inline_svg_mod-0.0.1.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-plugin-inline-svg-mod 0.0.1
File Interpreter ABI Platform
mkdocs_plugin_inline_svg_mod-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / mkdocs_plugin_inline_svg_mod-0.0.1.tar.gz

Download URL mkdocs_plugin_inline_svg_mod-0.0.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
aa7047c994cec48fa0acc34d5fe363fee33d54310b7f151004a9c21aad696c15
BLAKE2b-256 checksum
How to use checksums
c87abf8efc54023e2417b6a409399e234f71eb531363798833e2dc193b4dca15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / mkdocs_plugin_inline_svg_mod-0.0.1-py3-none-any.whl

Download URL mkdocs_plugin_inline_svg_mod-0.0.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2d7a81cc4fd26379efdcd6f8cfb2b1882cdfa6c53c82640577a483c2ddaf75f
BLAKE2b-256 checksum
How to use checksums
d9674efa4872e29e739da7c3dc5a43e87559dbfeeae90daacc3e40e9307a9951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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