Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kernc/mdx_unimoji
Python-Markdown extension that replaces common smileys with their Unicode emoji emoticons.
https://github.com/kernc/mdx_unimoji
emoji extension markdown python-markdown
Last synced: 2 months ago
JSON representation
Python-Markdown extension that replaces common smileys with their Unicode emoji emoticons.
- Host: GitHub
- URL: https://github.com/kernc/mdx_unimoji
- Owner: kernc
- Created: 2014-12-31T20:55:58.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T16:37:02.000Z (over 1 year ago)
- Last Synced: 2024-10-03T03:27:18.815Z (3 months ago)
- Topics: emoji, extension, markdown, python-markdown
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 5
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Unicode Emojis for Python-Markdown
==================================Converts defined emoticon symbols to Unicode emojis, supported on a
variety of devices [1].[1]: http://apps.timwhitlock.info/emoji/tables/unicode#block-1-emoticons
Usage:
```python
>>> from __future__ import print_function
>>> from markdown import markdown
>>> text = 'I <3 you! :P'
>>> print(markdown(text, ['mdx_unimoji'])) # doctest: +NORMALIZE_WHITESPACEI ❤ you! 😛
```**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 `` element
(default: 'emoji'). No element is created if `None`.An example with these custom settings:
```python
>>> from mdx_unimoji import UnimojiExtension
>>> img_heart = ''
>>> img_tongue = ''
>>> 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_WHITESPACEI you! \
```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!