fix: 🐛 Custom Code Component Swap is causing issues. #112
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
"@matthiesenxyz/astro-ghostcms-brutalbyelian": patch
|
||||||
|
"@matthiesenxyz/astro-ghostcms-theme-default": patch
|
||||||
|
"@matthiesenxyz/astro-ghostcms-catppuccin": patch
|
||||||
|
"@matthiesenxyz/starlight-ghostcms": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix:
|
||||||
|
|
||||||
|
- Removed CodeSlot Component that sometimes would break with some <pre> components
|
||||||
|
- Will be adding at a latter time a custom component to replace this, but at this time this is now fixed.
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
import { Code } from "astro/components"
|
|
||||||
import { parse } from "ultrahtml"
|
|
||||||
import { querySelector } from "ultrahtml/selector"
|
|
||||||
|
|
||||||
const html = await Astro.slots.render("default")
|
|
||||||
const ast = await parse(html)
|
|
||||||
const codetag = querySelector(ast,'code')
|
|
||||||
const { children, attributes } = codetag
|
|
||||||
|
|
||||||
const code = children[0].value
|
|
||||||
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
|
|
||||||
|
|
||||||
const lang = checkLang ? checkLang : 'plaintxt'
|
|
||||||
---
|
|
||||||
|
|
||||||
<Code code={code} lang={lang}/>
|
|
|
@ -4,6 +4,5 @@ export { default as H3 } from "./H3.astro";
|
||||||
export { default as H4 } from "./H4.astro";
|
export { default as H4 } from "./H4.astro";
|
||||||
export { default as H5 } from "./H5.astro";
|
export { default as H5 } from "./H5.astro";
|
||||||
export { default as H6 } from "./H6.astro";
|
export { default as H6 } from "./H6.astro";
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
||||||
export { default as Paragraph } from "./Paragraph.astro";
|
export { default as Paragraph } from "./Paragraph.astro";
|
||||||
export { default as astrocard } from "./astrocard.astro";
|
export { default as astrocard } from "./astrocard.astro";
|
||||||
|
|
|
@ -34,6 +34,7 @@ invariant(settings, "Settings are required");
|
||||||
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,
|
||||||
|
@ -42,7 +43,6 @@ invariant(settings, "Settings are required");
|
||||||
h4: C.H4,
|
h4: C.H4,
|
||||||
h5: C.H5,
|
h5: C.H5,
|
||||||
h6: C.H6,
|
h6: C.H6,
|
||||||
pre: C.CodeSlot,
|
|
||||||
p: C.Paragraph,
|
p: C.Paragraph,
|
||||||
astrocard: C.astrocard,
|
astrocard: C.astrocard,
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import FeatureImage from "./FeatureImage.astro";
|
||||||
import AuthorList from "./AuthorList.astro";
|
import AuthorList from "./AuthorList.astro";
|
||||||
import { formatDate } from "../utils";
|
import { formatDate } from "../utils";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
|
@ -66,10 +65,7 @@ const latestFeatured = posts[0]
|
||||||
content={latestFeatured.html}
|
content={latestFeatured.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'],
|
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={{
|
|
||||||
pre: render.CodeSlot
|
|
||||||
}}
|
}}
|
||||||
/> }
|
/> }
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import PostHero from "../components/PostHero.astro";
|
||||||
import PostFooter from "../components/PostFooter.astro";
|
import PostFooter from "../components/PostFooter.astro";
|
||||||
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
|
@ -34,9 +33,7 @@ invariant(settings, "Settings not found");
|
||||||
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={{
|
|
||||||
pre: render.CodeSlot
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
import { Code } from "astro/components"
|
|
||||||
import { parse } from "ultrahtml"
|
|
||||||
import { querySelector } from "ultrahtml/selector"
|
|
||||||
|
|
||||||
const html = await Astro.slots.render("default")
|
|
||||||
const ast = await parse(html)
|
|
||||||
const codetag = querySelector(ast,'code')
|
|
||||||
const { children, attributes } = codetag
|
|
||||||
|
|
||||||
const code = children[0].value
|
|
||||||
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
|
|
||||||
|
|
||||||
const lang = checkLang ? checkLang : 'plaintxt'
|
|
||||||
---
|
|
||||||
|
|
||||||
<Code code={code} lang={lang}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -2,7 +2,7 @@
|
||||||
import FeatureImage from "../components/FeatureImage.astro";
|
import FeatureImage from "../components/FeatureImage.astro";
|
||||||
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
|
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
page: Page;
|
page: Page;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -30,10 +30,9 @@ 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', 'astrocard'],
|
||||||
}}
|
}}
|
||||||
components={{
|
/>
|
||||||
pre: render.CodeSlot
|
|
||||||
}} />
|
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PostHero from "../components/PostHero.astro";
|
||||||
import PostFooter from "../components/PostFooter.astro";
|
import PostFooter from "../components/PostFooter.astro";
|
||||||
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -22,10 +22,9 @@ invariant(settings, "Settings not found");
|
||||||
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={{
|
/>
|
||||||
pre: render.CodeSlot
|
|
||||||
}} />
|
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
<PostFooter post={post} settings={settings} posts={posts} />
|
<PostFooter post={post} settings={settings} posts={posts} />
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
import { Code } from "astro/components"
|
|
||||||
import { parse } from "ultrahtml"
|
|
||||||
import { querySelector } from "ultrahtml/selector"
|
|
||||||
|
|
||||||
const html = await Astro.slots.render("default")
|
|
||||||
const ast = await parse(html)
|
|
||||||
const codetag = querySelector(ast,'code')
|
|
||||||
const { children, attributes } = codetag
|
|
||||||
|
|
||||||
const code = children[0].value
|
|
||||||
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
|
|
||||||
|
|
||||||
const lang = checkLang ? checkLang : 'plaintext'
|
|
||||||
---
|
|
||||||
|
|
||||||
<Code code={code} lang={lang}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
import { Code } from "@astrojs/starlight/components"
|
|
||||||
import { parse } from "ultrahtml"
|
|
||||||
import { querySelector } from "ultrahtml/selector"
|
|
||||||
|
|
||||||
const html = await Astro.slots.render("default")
|
|
||||||
const ast = await parse(html)
|
|
||||||
const codetag = querySelector(ast,'code')
|
|
||||||
const { children, attributes } = codetag
|
|
||||||
|
|
||||||
const code = children[0].value
|
|
||||||
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
|
|
||||||
|
|
||||||
const lang = checkLang ? checkLang : 'txt'
|
|
||||||
---
|
|
||||||
|
|
||||||
<Code code={code} lang={lang}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -6,7 +6,6 @@ import { getPageProps } from '../utils/page';
|
||||||
import { getAllPosts } from '../utils/api';
|
import { getAllPosts } from '../utils/api';
|
||||||
import Metadata from '../components/Metadata.astro';
|
import Metadata from '../components/Metadata.astro';
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
import * as Gists from '@matthiesenxyz/astro-gists/components';
|
import * as Gists from '@matthiesenxyz/astro-gists/components';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
|
@ -51,7 +50,6 @@ const pageProps = getPageProps(post.title)
|
||||||
allowComponents: true,
|
allowComponents: true,
|
||||||
}}
|
}}
|
||||||
components={{
|
components={{
|
||||||
pre: render.CodeSlot,
|
|
||||||
getgist: Gists.GetGist,
|
getgist: Gists.GetGist,
|
||||||
getgistgroup: Gists.GetGistGroup,
|
getgistgroup: Gists.GetGistGroup,
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import Page from '../components/Page.astro'
|
||||||
import { getPageProps } from '../utils/page'
|
import { getPageProps } from '../utils/page'
|
||||||
import { getSluggedPage } from '../utils/api'
|
import { getSluggedPage } from '../utils/api'
|
||||||
import { Markup } from 'astro-remote'
|
import { Markup } from 'astro-remote'
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
|
|
||||||
const aboutPage = await getSluggedPage("about");
|
const aboutPage = await getSluggedPage("about");
|
||||||
|
|
||||||
|
@ -26,9 +25,7 @@ const pageProps = getPageProps(aboutPage ? aboutPage.post.title : "")
|
||||||
sanitize={{
|
sanitize={{
|
||||||
allowComponents: true,
|
allowComponents: true,
|
||||||
}}
|
}}
|
||||||
components={{
|
/>
|
||||||
pre: render.CodeSlot
|
|
||||||
}} />
|
|
||||||
}
|
}
|
||||||
<footer class="not-content">
|
<footer class="not-content">
|
||||||
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import ghostcms from "@matthiesenxyz/astro-ghostcms";
|
import ghostcms from "@matthiesenxyz/astro-ghostcms";
|
||||||
import { defineConfig } from "astro/config";
|
import { defineConfig } from "astro/config";
|
||||||
///import tailwind from "@astrojs/tailwind";
|
import tailwind from "@astrojs/tailwind";
|
||||||
//import UnoCSS from "unocss/astro";
|
//import UnoCSS from "unocss/astro";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: "https://demo.astro-ghostcms.xyz/",
|
site: "https://demo.astro-ghostcms.xyz/",
|
||||||
integrations: [
|
integrations: [
|
||||||
//tailwind(),
|
tailwind(),
|
||||||
// UnoCSS({ injectReset: true }),
|
// UnoCSS({ injectReset: true }),
|
||||||
ghostcms({
|
ghostcms({
|
||||||
ghostURL: 'https://ghostdemo.matthiesen.xyz',
|
ghostURL: 'https://ghostdemo.matthiesen.xyz',
|
||||||
ThemeProvider: {
|
ThemeProvider: {
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
|
theme: "@matthiesenxyz/astro-ghostcms-catppuccin",
|
||||||
},
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue