A MkDocs plugin that inlines SVG images matching a pattern into the output without inlining Materials theme icons.
Project description
mkdocs-plugin-inline-select-svg
A MkDocs plugin that inlines SVG images matching a pattern into the output without inlining Materials theme icons.
This operates post HTML generation looking for img
elements like
<img src="foo.svg" ...>
When the src is a path-local URL with a path component that ends
with .svg
and it matches the configured pattern then the file is
read from the local file system and inlined in place.
Alt text is ignored in favour of any SVG <title>
element.
If the SVG contains any elements marked with class="do-not-inline"
,
they will not be included in the inlined content.
This is useful when your SVG images contain <style>
elements that
you do not want to bleed into the containing scope, and your Mkdocs
configuration includes extra CSS stylesheets that suffice.
Usage
To download and install this module, run:
pip install mkdocs-inline-select-svg-plugin
Enable the plugin in your mkdocs.yml by adding inline-select-svg
as a list item under the plugins section. Since that section will almost certainly include search you might end up with something like this:
plugins:
- search
- inline-select-svg
If you want to filter which SVGs to inline, by path, you can specify a regular expression using the pattern config option thus:
plugins:
- search
- inline-select-svg:
pattern: "[.]inline[.]svg$"
With that configuration, <img src="../foo.inline.svg">
would be
inlined but <img src="../foo.svg">
would not.
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
Hashes for mkdocs_inline_select_svg_plugin-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2cfa3c79f6809fd86c778adfb7b8da9c6c101c98acf50b3de7169fcbc8d3daf |
|
MD5 | 5e44885166e0c67eb66f9896a8cd97bf |
|
BLAKE2b-256 | d9d4ba1f0fba644e541701fa40e24124a983126e6b205afb7b2ab6e53f246f83 |
Hashes for mkdocs_inline_select_svg_plugin-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35e242a0d51c844576b75258e15a29f05b8aaeaf871b209368df2e880fcaf5b |
|
MD5 | e05ebfba07cc06e7ea2d09fd9d8b00a8 |
|
BLAKE2b-256 | 83cca3cb392357c65563a5208b3b430a6569bd400aff7a1683451ab96eed3249 |