feat: support all HTML elements allowed by Glitch (#1233)

Closes https://github.com/elk-zone/elk/issues/1230
pull/1127/head^2
jviide 2023-01-16 20:04:27 +02:00 zatwierdzone przez GitHub
rodzic 9df47ea6c2
commit 8c170961cb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 33 dodań i 6 usunięć

Wyświetl plik

@ -35,12 +35,35 @@ const sanitizer = sanitize({
code: { code: {
class: filterClasses(/^language-\w+$/), class: filterClasses(/^language-\w+$/),
}, },
// other elements supported in glitch // Other elements supported in glitch, as seen in
h1: {}, // https://github.com/glitch-soc/mastodon/blob/13227e1dafd308dfe1a3effc3379b766274809b3/lib/sanitize_ext/sanitize_config.rb#L75
ol: {}, abbr: {
ul: {}, title: keep,
li: {}, },
del: {},
blockquote: {
cite: filterHref(),
},
b: {},
strong: {},
u: {},
sub: {},
sup: {},
i: {},
em: {}, 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) { function set(value: string) {
return () => value return () => value
} }

Wyświetl plik

@ -92,7 +92,7 @@ exports[`content-rich > handles formatting from servers 1`] = `
<p></p> <p></p>
<ul> <ul>
<li>This is an indented bulleted list (not just asterisks).</li> <li>This is an indented bulleted list (not just asterisks).</li>
<li></li> <li><strong>This line is bold.</strong></li>
<li><em>This line is italic.</em></li> <li><em>This line is italic.</em></li>
</ul> </ul>
<ol> <ol>