mkdocs-material-extensions


Namemkdocs-material-extensions JSON
Version 1.3.1 PyPI version JSON
download
home_page
SummaryExtension pack for Python Markdown and MkDocs Material.
upload_time2023-11-22 19:09:45
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords extensions markdown
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Donate via PayPal][donate-image]][donate-link]
[![Build][github-ci-image]][github-ci-link]
[![Coverage Status][codecov-image]][codecov-link]
[![PyPI Version][pypi-image]][pypi-link]
[![PyPI - Python Version][python-image]][pypi-link]
![License][license-image-mit]
# MkDocs Material Extensions

> NOTE: This project is now deprecated as MkDocs for Material now implements this logic directly.
> Users should migrate to using `mkdocs-material`'s `material.extensions.emoji.twemoji` and 
> `material.extensions.emoji.to_svg` in place of the respective `materialx.emoji.twemoji` and `materialx.emoji.to_svg`
> functions provided by this library.

Markdown extension resources for [MkDocs for Material][mkdocs-material]

## Install

Generally, just installing MkDocs Material will automatically install `mkdocs-material-extensions`. But if you had a
need to manually install it, you can use pip.

```
pip install mkdocs-material-extensions
```

But make sure you've also installed MkDocs Material as well as this won't work without it. 

```
pip install mkdocs-material
```

## Inline SVG Icons

MkDocs Material provides numerous icons from Material, FontAwesome, and Octicons, but it does so by inlining the SVG
icons into the source. Currently there is no easy way access these icons and arbitrarily insert them into Markdown
content. Users must include the icon fonts themselves and do it with HTML.

This module allows you to use PyMdown Extensions' [Emoji][emoji] extension to enable easy insertion of MkDocs Material's
SVG assets using simple `:emoji-syntax:`.  This is done by creating our own [emoji index][emoji-index] and
[emoji generator][emoji-generator]. The custom index provides a modified version of the Emoji extensions Twemoji
index.

In addition to the custom index, you must also specify the associated custom generator. This will will find the
appropriate icon and insert it into your Markdown content as an inlined SVG.

Example:

```yaml
markdown_extensions:
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
```

Then, using the folder structure of Material's `.icons` folder, you can specify icons:

```
We can use Material Icons :material-airplane:.

We can also use Fontawesome Icons :fontawesome-solid-ambulance:.

That's not all, we can also use Octicons :octicons-octoface:.
```

## Using Local Custom Icons

In MkDocs, you can override theme assets locally, and even add assets to the theme. Unfortunately, the Markdown parsing
process isn't aware of the MkDocs environment. Luckily, if you are using PyMdown Extensions 7.1, you can pass in custom
icon paths that will be used when constructing the emoji index and include your custom SVG assets. If a folder path of
`theme/my_icons` was given to the index builder, all icons under `my_project/my_icons`, even in sub-folders, would
become part of the index.

```yaml
markdown_extensions:
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
      options:
        custom_icons:
          - theme/my_icons
```

If given an icon at `my_project/my_icons/animals/bird.svg`, the icon would be available using the emoji syntax as
`:animals-bird:`. Notice that the base folder that is provided doesn't contribute to the icon's name. Also, folders
are separated with `-`. Folder names and icon names should be compatible with the emoji syntax, so special characters
should be avoided -- `-` and `_` are okay.

You can provide as many paths as you would like, and they will be evaluated in the order that they are specified. The
Material theme's own icons will be evaluated after all custom paths. This allows a user to override Material's icons if
desired.

If an icon name is already in the index, the icon will not be added. It is recommended to always have your icons in
sub-folders to help namespace them to avoid name collisions. In the example above, `bird` was under `animals` which
created the name `:animals-bird:` and helped create a more unique name with less of a chance of creating a duplicate
name with existing emoji and Material icons.

[emoji]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
[emoji-index]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/#custom-emoji-indexes
[emoji-generator]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/#custom-emoji-generators
[mkdocs-material]: https://github.com/squidfunk/mkdocs-material

[donate-image]: https://img.shields.io/badge/Donate-PayPal-3fabd1?logo=paypal
[donate-link]: https://www.paypal.me/facelessuser
[github-ci-image]: https://github.com/facelessuser/mkdocs-material-extensions/workflows/build/badge.svg?branch=master&event=push
[github-ci-link]: https://github.com/facelessuser/mkdocs-material-extensions/actions?query=workflow%3Abuild+branch%3Amaster
[discord-image]: https://img.shields.io/discord/678289859768745989?logo=discord&logoColor=aaaaaa&color=mediumpurple&labelColor=333333
[discord-link]: https://discord.gg/TWs8Tgr
[codecov-image]: https://img.shields.io/codecov/c/github/facelessuser/mkdocs-material-extensions/master.svg?logo=codecov&logoColor=aaaaaa&labelColor=333333
[codecov-link]: https://codecov.io/github/facelessuser/mkdocs-material-extensions
[pypi-image]: https://img.shields.io/pypi/v/mkdocs-material-extensions.svg?logo=pypi&logoColor=aaaaaa&labelColor=333333
[pypi-link]: https://pypi.python.org/pypi/mkdocs-material-extensions
[python-image]: https://img.shields.io/pypi/pyversions/mkdocs-material-extensions?logo=python&logoColor=aaaaaa&labelColor=333333
[license-image-mit]: https://img.shields.io/badge/license-MIT-blue.svg?labelColor=333333

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mkdocs-material-extensions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "extensions,markdown",
    "author": "",
    "author_email": "Isaac Muse <Isaac.Muse@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/79/9b/9b4c96d6593b2a541e1cb8b34899a6d021d208bb357042823d4d2cabdbe7/mkdocs_material_extensions-1.3.1.tar.gz",
    "platform": null,
    "description": "[![Donate via PayPal][donate-image]][donate-link]\n[![Build][github-ci-image]][github-ci-link]\n[![Coverage Status][codecov-image]][codecov-link]\n[![PyPI Version][pypi-image]][pypi-link]\n[![PyPI - Python Version][python-image]][pypi-link]\n![License][license-image-mit]\n# MkDocs Material Extensions\n\n> NOTE: This project is now deprecated as MkDocs for Material now implements this logic directly.\n> Users should migrate to using `mkdocs-material`'s `material.extensions.emoji.twemoji` and \n> `material.extensions.emoji.to_svg` in place of the respective `materialx.emoji.twemoji` and `materialx.emoji.to_svg`\n> functions provided by this library.\n\nMarkdown extension resources for [MkDocs for Material][mkdocs-material]\n\n## Install\n\nGenerally, just installing MkDocs Material will automatically install `mkdocs-material-extensions`. But if you had a\nneed to manually install it, you can use pip.\n\n```\npip install mkdocs-material-extensions\n```\n\nBut make sure you've also installed MkDocs Material as well as this won't work without it. \n\n```\npip install mkdocs-material\n```\n\n## Inline SVG Icons\n\nMkDocs Material provides numerous icons from Material, FontAwesome, and Octicons, but it does so by inlining the SVG\nicons into the source. Currently there is no easy way access these icons and arbitrarily insert them into Markdown\ncontent. Users must include the icon fonts themselves and do it with HTML.\n\nThis module allows you to use PyMdown Extensions' [Emoji][emoji] extension to enable easy insertion of MkDocs Material's\nSVG assets using simple `:emoji-syntax:`.  This is done by creating our own [emoji index][emoji-index] and\n[emoji generator][emoji-generator]. The custom index provides a modified version of the Emoji extensions Twemoji\nindex.\n\nIn addition to the custom index, you must also specify the associated custom generator. This will will find the\nappropriate icon and insert it into your Markdown content as an inlined SVG.\n\nExample:\n\n```yaml\nmarkdown_extensions:\n  - pymdownx.emoji:\n      emoji_index: !!python/name:materialx.emoji.twemoji\n      emoji_generator: !!python/name:materialx.emoji.to_svg\n```\n\nThen, using the folder structure of Material's `.icons` folder, you can specify icons:\n\n```\nWe can use Material Icons :material-airplane:.\n\nWe can also use Fontawesome Icons :fontawesome-solid-ambulance:.\n\nThat's not all, we can also use Octicons :octicons-octoface:.\n```\n\n## Using Local Custom Icons\n\nIn MkDocs, you can override theme assets locally, and even add assets to the theme. Unfortunately, the Markdown parsing\nprocess isn't aware of the MkDocs environment. Luckily, if you are using PyMdown Extensions 7.1, you can pass in custom\nicon paths that will be used when constructing the emoji index and include your custom SVG assets. If a folder path of\n`theme/my_icons` was given to the index builder, all icons under `my_project/my_icons`, even in sub-folders, would\nbecome part of the index.\n\n```yaml\nmarkdown_extensions:\n  - pymdownx.emoji:\n      emoji_index: !!python/name:materialx.emoji.twemoji\n      emoji_generator: !!python/name:materialx.emoji.to_svg\n      options:\n        custom_icons:\n          - theme/my_icons\n```\n\nIf given an icon at `my_project/my_icons/animals/bird.svg`, the icon would be available using the emoji syntax as\n`:animals-bird:`. Notice that the base folder that is provided doesn't contribute to the icon's name. Also, folders\nare separated with `-`. Folder names and icon names should be compatible with the emoji syntax, so special characters\nshould be avoided -- `-` and `_` are okay.\n\nYou can provide as many paths as you would like, and they will be evaluated in the order that they are specified. The\nMaterial theme's own icons will be evaluated after all custom paths. This allows a user to override Material's icons if\ndesired.\n\nIf an icon name is already in the index, the icon will not be added. It is recommended to always have your icons in\nsub-folders to help namespace them to avoid name collisions. In the example above, `bird` was under `animals` which\ncreated the name `:animals-bird:` and helped create a more unique name with less of a chance of creating a duplicate\nname with existing emoji and Material icons.\n\n[emoji]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/\n[emoji-index]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/#custom-emoji-indexes\n[emoji-generator]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/#custom-emoji-generators\n[mkdocs-material]: https://github.com/squidfunk/mkdocs-material\n\n[donate-image]: https://img.shields.io/badge/Donate-PayPal-3fabd1?logo=paypal\n[donate-link]: https://www.paypal.me/facelessuser\n[github-ci-image]: https://github.com/facelessuser/mkdocs-material-extensions/workflows/build/badge.svg?branch=master&event=push\n[github-ci-link]: https://github.com/facelessuser/mkdocs-material-extensions/actions?query=workflow%3Abuild+branch%3Amaster\n[discord-image]: https://img.shields.io/discord/678289859768745989?logo=discord&logoColor=aaaaaa&color=mediumpurple&labelColor=333333\n[discord-link]: https://discord.gg/TWs8Tgr\n[codecov-image]: https://img.shields.io/codecov/c/github/facelessuser/mkdocs-material-extensions/master.svg?logo=codecov&logoColor=aaaaaa&labelColor=333333\n[codecov-link]: https://codecov.io/github/facelessuser/mkdocs-material-extensions\n[pypi-image]: https://img.shields.io/pypi/v/mkdocs-material-extensions.svg?logo=pypi&logoColor=aaaaaa&labelColor=333333\n[pypi-link]: https://pypi.python.org/pypi/mkdocs-material-extensions\n[python-image]: https://img.shields.io/pypi/pyversions/mkdocs-material-extensions?logo=python&logoColor=aaaaaa&labelColor=333333\n[license-image-mit]: https://img.shields.io/badge/license-MIT-blue.svg?labelColor=333333\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Extension pack for Python Markdown and MkDocs Material.",
    "version": "1.3.1",
    "project_urls": {
        "Homepage": "https://github.com/facelessuser/mkdocs-material-extensions"
    },
    "split_keywords": [
        "extensions",
        "markdown"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b54662a4743aa81d9582ee9339d4ffa3c8fd40a4965e033d77b9da9774d3960",
                "md5": "d9b2d9aa2e56a5e629c47e7ce1a0baec",
                "sha256": "adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31"
            },
            "downloads": -1,
            "filename": "mkdocs_material_extensions-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9b2d9aa2e56a5e629c47e7ce1a0baec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8728,
            "upload_time": "2023-11-22T19:09:43",
            "upload_time_iso_8601": "2023-11-22T19:09:43.465661Z",
            "url": "https://files.pythonhosted.org/packages/5b/54/662a4743aa81d9582ee9339d4ffa3c8fd40a4965e033d77b9da9774d3960/mkdocs_material_extensions-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "799b9b4c96d6593b2a541e1cb8b34899a6d021d208bb357042823d4d2cabdbe7",
                "md5": "017ea4a622cb6c25586ef90f6a5bd3e4",
                "sha256": "10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443"
            },
            "downloads": -1,
            "filename": "mkdocs_material_extensions-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "017ea4a622cb6c25586ef90f6a5bd3e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11847,
            "upload_time": "2023-11-22T19:09:45",
            "upload_time_iso_8601": "2023-11-22T19:09:45.208280Z",
            "url": "https://files.pythonhosted.org/packages/79/9b/9b4c96d6593b2a541e1cb8b34899a6d021d208bb357042823d4d2cabdbe7/mkdocs_material_extensions-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-22 19:09:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "facelessuser",
    "github_project": "mkdocs-material-extensions",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "mkdocs-material-extensions"
}
        
Elapsed time: 0.15500s