feat: add LTR/RTL in hashtags and mentions support (#2541)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
Joaquín Sánchez 2024-01-04 20:51:32 +01:00 committed by GitHub
parent b016320eaf
commit 3adf92ea56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 202 additions and 106 deletions

View file

@ -72,6 +72,8 @@ const sanitizer = sanitize({
/**
* Parse raw HTML form Mastodon server to AST,
* with interop of custom emojis and inline Markdown syntax
* @param html The content to parse
* @param options The parsing options
*/
export function parseMastodonHTML(
html: string,
@ -140,6 +142,8 @@ export function parseMastodonHTML(
/**
* Converts raw HTML form Mastodon server to HTML for Tiptap editor
* @param html The content to parse
* @param customEmojis The custom emojis to use
*/
export function convertMastodonHTML(html: string, customEmojis: Record<string, mastodon.v1.CustomEmoji> = {}) {
const tree = parseMastodonHTML(html, {