Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 2.12 KB

README.md

File metadata and controls

67 lines (48 loc) · 2.12 KB

mdit-py-emoji

Emoji plugin for markdown-it-py. Ported from https://github.com/markdown-it/markdown-it-emoji

PyPI Python Version Code style: black Imports: isort License pdm-managed codecov

Installation

Choose your favorite!

pip install mdit-py-emoji
pdm add mdit-py-emoji
poetry add mdit-py-emoji

Usage

Use it just like other plugins!

from markdown_it import MarkdownIt
from mdit_py_emoji import emoji_plugin

md = MarkdownIt().use(emoji_plugin)

print(md.renderInline(":star: mdit-py-emoji! :star:"))
# ⭐ mdit-py-emoji! ⭐
print(md.renderInline("Is shortcut supported too :/? :white_check_mark:"))
# Is shortcut supported too 😕? ✅

Customization

Pass defs and shortcuts and that's it!

from markdown_it import MarkdownIt
from mdit_py_emoji import emoji_plugin

md = MarkdownIt().use(
    emoji_plugin,
    shortcuts={
        "arrow_up": [":up_arrow:", ":up_arr:"],
        "arrow_down": [":down_arrow:", ":down_arr:"],
    },
)  # Some tricks like `false = False`
print(md.renderInline(":down_arr: Go Down :down_arrow:"))
# ⬇️ Go Down ⬇️

Wondering about the defaults? Check data.py !

Note: twemoji shortcuts are enabled by default. pass shortcuts={} to disable it.

License

This project is licensed under MIT License.