fix: 🐛 bug: `starlight-ghostcms` markup allowElements list breaks `astro-gists` (#92)

Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
This commit is contained in:
create-issue-branch[bot] 2024-03-09 05:09:43 -08:00 committed by GitHub
parent 110c5a973a
commit 746fcc5858
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 11 deletions

View File

@ -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

View File

@ -33,8 +33,7 @@ invariant(settings, "Settings are required");
<Markup <Markup
content={post.html} content={post.html}
sanitize={{ sanitize={{
allowComponents: true, 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'],
}} }}
components={{ components={{
h1: C.H1, h1: C.H1,

View File

@ -33,8 +33,7 @@ invariant(settings, "Settings not found");
<Markup <Markup
content={post.html} content={post.html}
sanitize={{ sanitize={{
allowComponents: true, 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={{ components={{
pre: render.CodeSlot pre: render.CodeSlot

View File

@ -30,7 +30,6 @@ const { page, settings, pageClass } = Astro.props as Props;
content={page.html} content={page.html}
sanitize={{ sanitize={{
allowComponents: true, 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={{ components={{
pre: render.CodeSlot pre: render.CodeSlot

View File

@ -21,8 +21,7 @@ invariant(settings, "Settings not found");
<Markup <Markup
content={post.html} content={post.html}
sanitize={{ sanitize={{
allowComponents: true, 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={{ components={{
pre: render.CodeSlot pre: render.CodeSlot

View File

@ -48,8 +48,7 @@ const pageProps = getPageProps(post.title)
<Markup <Markup
content={post.html} content={post.html}
sanitize={{ sanitize={{
allowComponents: true, 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={{ components={{
pre: render.CodeSlot, pre: render.CodeSlot,

View File

@ -12,23 +12,24 @@ const aboutPage = await getSluggedPage("about");
//const { entries, nextLink, prevLink } = Astro.props //const { entries, nextLink, prevLink } = Astro.props
const pageProps = getPageProps(aboutPage?.post?.title) const pageProps = getPageProps(aboutPage ? aboutPage.post.title : "")
--- ---
<Page {...pageProps}> <Page {...pageProps}>
{config.supportGhost && ( {config.supportGhost && (
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div> <div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
)} )}
{aboutPage &&
<Metadata entry={aboutPage.post} /> <Metadata entry={aboutPage.post} />
<Markup <Markup
content={aboutPage.post.html} content={aboutPage.post.html}
sanitize={{ sanitize={{
allowComponents: true, 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={{ components={{
pre: render.CodeSlot pre: render.CodeSlot
}} /> }} />
}
<footer class="not-content"> <footer class="not-content">
<!--PrevNextLinks next={nextLink} prev={prevLink} /--> <!--PrevNextLinks next={nextLink} prev={prevLink} /-->
</footer> </footer>