Refactor code to remove unnecessary elements in sanitize allowElements
This commit is contained in:
parent
9f89f2e4e4
commit
c494ecaf3d
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms-brutalbyelian": patch
|
||||
"@matthiesenxyz/astro-ghostcms-theme-default": patch
|
||||
"@matthiesenxyz/astro-ghostcms-catppuccin": patch
|
||||
"@matthiesenxyz/starlight-ghostcms": patch
|
||||
---
|
||||
|
||||
Fix html rendering to allow custom components
|
|
@ -33,8 +33,7 @@ invariant(settings, "Settings are required");
|
|||
<Markup
|
||||
content={post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'astrocard'],
|
||||
allowComponents: true,
|
||||
}}
|
||||
components={{
|
||||
h1: C.H1,
|
||||
|
|
|
@ -33,8 +33,7 @@ invariant(settings, "Settings not found");
|
|||
<Markup
|
||||
content={post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
|
||||
allowComponents: true,
|
||||
}}
|
||||
components={{
|
||||
pre: render.CodeSlot
|
||||
|
|
|
@ -30,7 +30,6 @@ const { page, settings, pageClass } = Astro.props as Props;
|
|||
content={page.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
|
||||
}}
|
||||
components={{
|
||||
pre: render.CodeSlot
|
||||
|
|
|
@ -21,8 +21,7 @@ invariant(settings, "Settings not found");
|
|||
<Markup
|
||||
content={post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
|
||||
allowComponents: true,
|
||||
}}
|
||||
components={{
|
||||
pre: render.CodeSlot
|
||||
|
|
|
@ -48,8 +48,7 @@ const pageProps = getPageProps(post.title)
|
|||
<Markup
|
||||
content={post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
|
||||
allowComponents: true,
|
||||
}}
|
||||
components={{
|
||||
pre: render.CodeSlot,
|
||||
|
|
|
@ -12,23 +12,24 @@ const aboutPage = await getSluggedPage("about");
|
|||
|
||||
//const { entries, nextLink, prevLink } = Astro.props
|
||||
|
||||
const pageProps = getPageProps(aboutPage?.post?.title)
|
||||
const pageProps = getPageProps(aboutPage ? aboutPage.post.title : "")
|
||||
---
|
||||
|
||||
<Page {...pageProps}>
|
||||
{config.supportGhost && (
|
||||
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
|
||||
)}
|
||||
{aboutPage &&
|
||||
<Metadata entry={aboutPage.post} />
|
||||
<Markup
|
||||
content={aboutPage.post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span'],
|
||||
}}
|
||||
components={{
|
||||
pre: render.CodeSlot
|
||||
}} />
|
||||
}
|
||||
<footer class="not-content">
|
||||
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
||||
</footer>
|
||||
|
|
Loading…
Reference in New Issue