fix: 🐛 bug: ultrahtml does not handle all html strings. add switch to enable standard html fragment tag instead. #115
|
@ -2,6 +2,10 @@
|
||||||
import { getGhostImgPath } from "../../utils";
|
import { getGhostImgPath } from "../../utils";
|
||||||
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
image: string;
|
image: string;
|
||||||
alt?: string;
|
alt?: string;
|
||||||
|
@ -23,5 +27,8 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
|
||||||
alt={alt}
|
alt={alt}
|
||||||
transition:name={transitionName}
|
transition:name={transitionName}
|
||||||
/>
|
/>
|
||||||
{caption && <figcaption class="text-ctp-overlay2"><Markup content={caption} /></figcaption>}
|
{caption && (
|
||||||
|
<figcaption class="text-ctp-overlay2">
|
||||||
|
{useRemote ? <Markup content={caption} /> : <Fragment set:html={caption} />}
|
||||||
|
</figcaption>)}
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
@ -7,6 +7,9 @@ import BlogPostHeader from "../components/blog/BlogPostHeader.astro";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as C from "../components/ghostrender";
|
import * as C from "../components/ghostrender";
|
||||||
import { Card } from "@eliancodes/brutal-ui";
|
import { Card } from "@eliancodes/brutal-ui";
|
||||||
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
|
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
|
||||||
|
@ -30,7 +33,7 @@ invariant(settings, "Settings are required");
|
||||||
|
|
||||||
<div class="my-5"/>
|
<div class="my-5"/>
|
||||||
<div id="ghost">
|
<div id="ghost">
|
||||||
<Markup
|
{useRemote ? <Markup
|
||||||
content={post.html}
|
content={post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
allowComponents: true,
|
allowComponents: true,
|
||||||
|
@ -46,7 +49,7 @@ invariant(settings, "Settings are required");
|
||||||
p: C.Paragraph,
|
p: C.Paragraph,
|
||||||
astrocard: C.astrocard,
|
astrocard: C.astrocard,
|
||||||
}}
|
}}
|
||||||
/>
|
/> : <Fragment set:html={post.html} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
|
@ -4,6 +4,9 @@ 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 config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
|
@ -61,13 +64,15 @@ const latestFeatured = posts[0]
|
||||||
</div>
|
</div>
|
||||||
<div class="divider my-4"/>
|
<div class="divider my-4"/>
|
||||||
<section id="ghostimport" class="text-ctp-subtext1">
|
<section id="ghostimport" class="text-ctp-subtext1">
|
||||||
{latestFeatured && <Markup
|
|
||||||
|
|
||||||
|
{useRemote ? (latestFeatured && <Markup
|
||||||
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', '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'],
|
||||||
}}
|
}}
|
||||||
/> }
|
/>) : (latestFeatured && <Fragment set:html={latestFeatured.html} />) }
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -3,6 +3,9 @@ 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 config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
|
@ -16,10 +19,10 @@ async function getPostsSet(){
|
||||||
const featuredPosts = await getFeaturedPosts();
|
const featuredPosts = await getFeaturedPosts();
|
||||||
const fposts = posts;
|
const fposts = posts;
|
||||||
if(featuredPosts.posts.length === 0){ return fposts }
|
if(featuredPosts.posts.length === 0){ return fposts }
|
||||||
else {
|
|
||||||
const featured = featuredPosts.posts[0]
|
const featured = featuredPosts.posts[0]
|
||||||
return fposts.filter((p: Post)=>p.id !== featured.id)
|
return fposts.filter((p: Post)=>p.id !== featured.id)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mPosts = await getPostsSet()
|
const mPosts = await getPostsSet()
|
||||||
|
@ -29,6 +32,7 @@ invariant(settings, "Settings not found");
|
||||||
|
|
||||||
<PostHero post={post} settings={settings} />
|
<PostHero post={post} settings={settings} />
|
||||||
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
||||||
|
{useRemote ? (
|
||||||
<Markup
|
<Markup
|
||||||
content={post.html}
|
content={post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
|
@ -36,6 +40,7 @@ invariant(settings, "Settings not found");
|
||||||
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'],
|
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'],
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
) : <Fragment set:html={post.html} /> }
|
||||||
</div>
|
</div>
|
||||||
<PostFooter post={post} settings={settings} posts={mPosts} />
|
<PostFooter post={post} settings={settings} posts={mPosts} />
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
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 config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
page: Page;
|
page: Page;
|
||||||
|
@ -26,6 +29,7 @@ const { page, settings, pageClass } = Astro.props as Props;
|
||||||
|
|
||||||
<section class="gh-content gh-canvas">
|
<section class="gh-content gh-canvas">
|
||||||
<h1 class="article-title">{page.title}</h1>
|
<h1 class="article-title">{page.title}</h1>
|
||||||
|
{useRemote ? (
|
||||||
<Markup
|
<Markup
|
||||||
content={page.html}
|
content={page.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
|
@ -33,6 +37,7 @@ const { page, settings, pageClass } = Astro.props as Props;
|
||||||
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'],
|
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'],
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
) : <Fragment set:html={page.html} /> }
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -3,6 +3,9 @@ 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 config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
|
@ -18,6 +21,7 @@ invariant(settings, "Settings not found");
|
||||||
<article class={`article post ${postClass}`}>
|
<article class={`article post ${postClass}`}>
|
||||||
<PostHero post={post} settings={settings} />
|
<PostHero post={post} settings={settings} />
|
||||||
<section class="gh-content gh-canvas">
|
<section class="gh-content gh-canvas">
|
||||||
|
{useRemote ? (
|
||||||
<Markup
|
<Markup
|
||||||
content={post.html}
|
content={post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
|
@ -25,6 +29,7 @@ invariant(settings, "Settings not found");
|
||||||
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'],
|
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'],
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
) : <Fragment set:html={post.html} /> }
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
<PostFooter post={post} settings={settings} posts={posts} />
|
<PostFooter post={post} settings={settings} posts={posts} />
|
||||||
|
|
|
@ -17,22 +17,19 @@ export const GhostUserConfigSchema = z.object({
|
||||||
/** OPTIONAL - Configure the Theme Provider
|
/** OPTIONAL - Configure the Theme Provider
|
||||||
* @ This option allows the user to configure the Theme Provider
|
* @ This option allows the user to configure the Theme Provider
|
||||||
*/
|
*/
|
||||||
ThemeProvider: z
|
ThemeProvider: z.object({
|
||||||
.object({
|
|
||||||
/** OPTIONAL - Disable the theme provider
|
/** OPTIONAL - Disable the theme provider
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
disableThemeProvider: z.coerce.boolean(),
|
disableThemeProvider: z.coerce.boolean().default(false),
|
||||||
/** OPTIONAL - Set the theme you want to use
|
/** OPTIONAL - Set the theme you want to use
|
||||||
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
||||||
*/
|
*/
|
||||||
theme: z.string(),
|
theme: z.string().default("@matthiesenxyz/astro-ghostcms-theme-default"),
|
||||||
})
|
astroRemote: z.object({
|
||||||
.optional()
|
enable: z.boolean().default(true),
|
||||||
.default({
|
}).optional().default({}),
|
||||||
disableThemeProvider: false,
|
}).optional().default({}),
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default"
|
|
||||||
}),
|
|
||||||
/** Allows the user to disable the provided 404 page */
|
/** Allows the user to disable the provided 404 page */
|
||||||
disableDefault404: z.coerce.boolean().optional(),
|
disableDefault404: z.coerce.boolean().optional(),
|
||||||
/** Allows the user to disable the provided RSS Feed */
|
/** Allows the user to disable the provided RSS Feed */
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
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-catppuccin",
|
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||||
|
astroRemote: {
|
||||||
|
enable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue