Skip to main content

Replace emoji short names with their corresponding emojis.

Project description

Build Status pre-commit Code style: black Imports: isort

emoji-shortname

Replace emoji short names with their corresponding emojis.

Overview

The short names we are familiar with (e.g. the ones used on sites like GitHub) are not inline with the CLDR short names defined in the Unicode standard. This makes mapping short codes to emojis a bit of a challenge. So, I punt on this issue, and defer to the emoji package created by Taehoon Kim and Kevin Wurster. Their wonderful library does the heavy lifting.

This extension amounts to a find-and-replace. Find the short name, replace it with the appropriate emoji. It works with both Markdown and reStructuredText.

Details

Emojis are added to documents by sandwiching their short names between colons. For example, :smile: resolves to :smile:. This syntax conflicts with the way you provide options to directives in Sphinx. And, since the extension ties into the source-read hook, those directives are yet to be resolved. As such, if an option shares the same name as an emoji short code, the option will be replaced by the emoji. Though I am unaware of any case where this happens, be aware that it is a possibility.

Development

The project is managed with poetry.

To contribute to emoji-shortname, first install poetry. Once installed, fetch the project dependencies with poetry install. From here, you can iterate on the code and run the unit tests with poetry run tox pyproject.toml

Usage

Simply install the package with your manager of choice (e.g. poetry, pip, etc) and then add the extension to your sphinx config.py.

extensions = ["emoji_shortname"]

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

emoji-shortname-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

emoji_shortname-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file emoji-shortname-0.1.1.tar.gz.

File metadata

  • Download URL: emoji-shortname-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Darwin/20.5.0

File hashes

Hashes for emoji-shortname-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bbf738ca707f6fa8379c6a667c5cbfaa3eece579e7e82feeaa411e9b2e5ad413
MD5 e6bd83ae1d963c94d2ca536ac3b1c2f5
BLAKE2b-256 51211a9d59598c1fe60d6d79ac695e2ff06367c75a40e87431ca1aa073222ae7

See more details on using hashes here.

File details

Details for the file emoji_shortname-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: emoji_shortname-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Darwin/20.5.0

File hashes

Hashes for emoji_shortname-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56137aa00d54835b2c7769442f548bae109c425c47af011053ef97cc61f1aad9
MD5 f7a47c7c4923774054cbf965b6bcad4f
BLAKE2b-256 da1c3fa794b040705d93d730e9e56911b59a7a15a5a78c9b19f4fdc3a1840813

See more details on using hashes here.

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