Skip to main content

Plugin to extend MkDocs Material theme.

Project description

MkDocs Pymdownx Material Extras

A plugin for MkDocs -- specifically the MkDocs Material Theme.

Adds additional resources that are used in the PyMdown Extensions documentation, and other @facelessuser projects.

While this is not specifically meant for outside consumption, and was originally written for @facelessuser projects, it can be freely used if desired.

Files are copied from the pymdown-extensions project.

Instructions

This is bound to specific versions of MkDocs Material and PyMdown Extensions. It may sometimes be tied to betas.

Installation:

pip install mkdocs_pymdownx_material_extras

Add it to your your mkdocs.yml plugins. It is assuming you are using MkDocs Material. When doing so, remember to add back the search plugin as it doesn't append to the plugins, but overrides the plugins:

plugins:
  - search
  - mkdocs_pymdownx_material_extras

Setup your theme as follows:

theme:
  name: material # Must use Material theme
  custom_dir: docs/theme # If you have overrides, specify where to find them
  palette:
    scheme: dracula # This is how to enables the Dracula theme for dark. For light, it will use default Material with some tweaks.
    primary: deep purple # Primary colors
    accent: deep purple # accent color

The following Material primary/accent colors map to actual Dracula colors:

Material Dracula
red red
pink pink
purple purple
deep-purple purple
blue blue
indigo blue
light-blue blue
cyan cyan
teal cyan
green green
light-green green
lime green
yellow yellow
amber yellow
orange orange
deep-orange orange

Sponsor Footer Link

If you'd like to add the sponsor heart in the footer, add your sponsor link under the MkDocs theme options like so.

theme:
  pymdownx:
    sponsor: "https://github.com/sponsors/facelessuser"

Mermaid Support

Mermaid support is baked in. Simply add the Mermaid script to your MkDocs config:

extra_javascript:
  - https://unpkg.com/mermaid@8.8.4/dist/mermaid.min.js

If you do not like our default setup, you are free to modify it. Simply provide a script file before before you include Mermaid with the new config:

extra_javascript:
  - my_mermaid_config.js
  - https://unpkg.com/mermaid@8.8.4/dist/mermaid.min.js

Also, setup your Mermaid diagrams:

markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
        # Mermaid diagrams
        - name: diagram
          class: diagram
          format: !!python/name:pymdownx.superfences.fence_code_format

Then you can specify your Mermaid diagrams in diagram code blocks:

```diagram
...
```

Mermaid setups are provided per scheme. You can see the setup here. if you are trying to override them.

MathJax/KaTeX

Again, MathJax and KaTeX support is baked in. Simply add the MathJax script(s) to your MkDocs config:

MathJax:

extra_javascript:
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

KaTeX:

extra_javascript:
  - https://cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js

Lastly, setup Arithmatex:

markdown_extensions:
  - pymdownx.arithmatex:
      generic: true # Must use generic mode
      block_tag: 'pre' # We wrap block math in `<pre>` to avoid issues with MkDocs minify HTML plugin: https://github.com/byrnereese/mkdocs-minify-plugin

If you do not like the default MathJax setup, add your own config before MathJax script:

extra_javascript:
  - my_mathjax_config.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

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_pymdownx_material_extras-2.0.2.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file mkdocs_pymdownx_material_extras-2.0.2.tar.gz.

File metadata

  • Download URL: mkdocs_pymdownx_material_extras-2.0.2.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.13

File hashes

Hashes for mkdocs_pymdownx_material_extras-2.0.2.tar.gz
Algorithm Hash digest
SHA256 b00f7687510f1e7f30306104a29ec6a67af5ed9cc96e9ddb245d7dd8bb19f559
MD5 f9cfe4b05a0d4e842359209fb9b38f3f
BLAKE2b-256 63e0c2f2eb626462e990650de379f7df6db77c08eede389ade754e2b116e114f

See more details on using hashes here.

Provenance

File details

Details for the file mkdocs_pymdownx_material_extras-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_pymdownx_material_extras-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.13

File hashes

Hashes for mkdocs_pymdownx_material_extras-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c51e09c8b304d1f4fe0acdf746f6c01ad64f43603554a6a9a437c0d6ac9256b
MD5 52debd44b1a92802bd68555a35ab0e58
BLAKE2b-256 d19f2f9fa1e49ffb456e4a377707e28b479f3d08c3bd6a06c498fb68648c0a7f

See more details on using hashes here.

Provenance

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