Unicode Emojis for Python-Markdown
Converts defined emoticon symbols to Unicode emojis, supported on a variety of devices 1.
Usage:
>>> from __future__ import print_function
>>> from markdown import markdown
>>> text = 'I <3 you! :P'
>>> print(markdown(text, ['mdx_unimoji'])) # doctest: +NORMALIZE_WHITESPACE
<p>I <span class="emoji" style="color:red">❤</span> you! <span class="emoji">😛</span></p>
NOTE: The emojis are only replaced when whitespace-delimited on both sides!
The following options are accepted:
emoji, the emoticon-to-list-of-aliases mapping,span_class, the class name of the encompassing<span>element (default: 'emoji'). No element is created ifNone.
An example with these custom settings:
>>> from mdx_unimoji import UnimojiExtension
>>> img_heart = '<img alt="love" src="heart.png"/>'
>>> img_tongue = '<img alt=":P" src="tongue.png"/>'
>>> overrides = UnimojiExtension.EMOJI
>>> overrides.update({img_heart: ['<3'],
... img_tongue: ':p :P :-p :-P'.split()})
>>> print(markdown(text,
... extensions=[UnimojiExtension(span_class='other',
... emoji=overrides)]))
... # doctest: +NORMALIZE_WHITESPACE
<p>I <img alt="love" class="other" src="heart.png" /> you! \
<img alt=":P" class="other" src="tongue.png" /></p>
You can use the span_class value in your CSS, e.g.:
.emoji {
font-family: "Apple Color Emoji", "Segoe UI Emoji",
"Noto Color Emoji", EmojiSymbols, "DejaVu Sans", Symbola;
}
Install
To install and make available to Markdown, you can issue:
pip install mdx_unimoji
or
pip install --upgrade git+git://github.com/kernc/mdx_unimoji.git
Then use the above provided examples to figure your way around.
HF!
Metadata
Release files for mdx-unimoji 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mdx_unimoji-1.1.tar.gz | 4.2 kB | Without provenance | Details for mdx_unimoji-1.1.tar.gz |
Release files / mdx_unimoji-1.1.tar.gz
| Download URL | mdx_unimoji-1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ef04cd0a40340a31c24ce664a24c02bd4bb5b44ee70b784979efaf52e87e90b
|
|
BLAKE2b-256 checksum How to use checksums |
2ed5abbfb4db7610837fab0134c70a17fb06c9c4366b1a13b984e3f180a068f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Security for mdx-unimoji 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.