diff --git a/composables/content-parse.ts b/composables/content-parse.ts index 1e45ab99..b113eaa1 100644 --- a/composables/content-parse.ts +++ b/composables/content-parse.ts @@ -35,12 +35,35 @@ const sanitizer = sanitize({ code: { class: filterClasses(/^language-\w+$/), }, - // other elements supported in glitch - h1: {}, - ol: {}, - ul: {}, - li: {}, + // Other elements supported in glitch, as seen in + // https://github.com/glitch-soc/mastodon/blob/13227e1dafd308dfe1a3effc3379b766274809b3/lib/sanitize_ext/sanitize_config.rb#L75 + abbr: { + title: keep, + }, + del: {}, + blockquote: { + cite: filterHref(), + }, + b: {}, + strong: {}, + u: {}, + sub: {}, + sup: {}, + i: {}, em: {}, + h1: {}, + h2: {}, + h3: {}, + h4: {}, + h5: {}, + ul: {}, + ol: { + start: keep, + reversed: keep, + }, + li: { + value: keep, + }, }) /** @@ -255,6 +278,10 @@ function filterClasses(allowed: RegExp) { } } +function keep(value: string | undefined) { + return value +} + function set(value: string) { return () => value } diff --git a/tests/__snapshots__/content-rich.test.ts.snap b/tests/__snapshots__/content-rich.test.ts.snap index 85001328..cd75bdac 100644 --- a/tests/__snapshots__/content-rich.test.ts.snap +++ b/tests/__snapshots__/content-rich.test.ts.snap @@ -92,7 +92,7 @@ exports[`content-rich > handles formatting from servers 1`] = `