mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-24 10:16:06 +03:00
feat: support all HTML elements allowed by Glitch (#1233)
Closes https://github.com/elk-zone/elk/issues/1230
This commit is contained in:
parent
9df47ea6c2
commit
8c170961cb
2 changed files with 33 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ exports[`content-rich > handles formatting from servers 1`] = `
|
|||
<p></p>
|
||||
<ul>
|
||||
<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>
|
||||
</ul>
|
||||
<ol>
|
||||
|
|
Loading…
Reference in a new issue