1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-09 14:05:53 +00:00

FEP-9098: Update proposal (#652)

- Added definition of custom emoji.
- Clarified description of `updated`.
- Added note about `icon` aspect ratio.
- Specified reserved HTML characters.
- Don't replace inside `<code>` and `<pre>`.

Reviewed-on: https://codeberg.org/fediverse/fep/pulls/652
Co-authored-by: silverpill <silverpill@firemail.cc>
Co-committed-by: silverpill <silverpill@firemail.cc>
This commit is contained in:
silverpill
2025-07-11 17:51:34 +02:00
committed by silverpill
parent 73906ec8ea
commit 0d219c7801
+9 -2
View File
@@ -11,6 +11,8 @@ trackingIssue: https://codeberg.org/fediverse/fep/issues/648
## Summary
A custom emoji is a small image used to express an idea or emotion. Custom emojis are different from Unicode emojis, which are sequences of characters.
This document describes how custom emojis are implemented in [ActivityPub] network.
## History
@@ -28,11 +30,14 @@ Custom emojis are represented as `Emoji` objects (the full type IRI is `http://j
- `id` (RECOMMENDED): the unique identifier of the custom emoji. Some implementations omit this property (i.e. the object is anonymous).
- `type` (REQUIRED): the `Emoji` string.
- `name` (REQUIRED): the [shortcode][Shortcode] of the custom emoji (the name of the emoji, enclosed in colons).
- `updated` (OPTIONAL): the date when custom emoji was updated, formatted as [RFC-3339] timestamp.
- `updated` (OPTIONAL): the date when custom emoji was updated, formatted as [RFC-3339] date and time string.
- `icon` (REQUIRED): `Image` object describing emoji image.
- `type` (REQUIRED): the `Image` string.
- `url` (REQUIRED): the URL of the emoji image.
>[!NOTE]
>The definition of the `icon` property in ActivityStreams Vocabulary recommends an aspect ratio of one to one, but in practice custom emojis have varied aspect ratios.
Example:
```json
@@ -102,12 +107,14 @@ Applications typically replace custom emoji shortcodes with `<img>` HTML tags an
To prevent [Cross-Site Scripting (XSS)][XSS] attacks, implementers MUST ensure that:
- Emoji names, descriptions, URLs and other strings that are used in replacements do not contain reserved HTML characters.
- Emoji names, descriptions, URLs and other strings that are used in replacements do not contain reserved HTML characters (`&<>"'`).
- When HTML content (e.g. `summary`, `content`) is processed, shortcodes are replaced only inside [Text][DOM-Text] nodes.
- Reserved HTML characters in text are escaped before replacing shortcodes.
The aspect ratio of the image SHOULD be preserved.
Shortcodes inside `<code>` and `<pre>` HTML elements MUST NOT be replaced.
## Implementations
This document is based on implementations of custom emojis in Pleroma, Mastodon, Misskey and Fedibird.