Compare commits

...

30 Commits

Author SHA1 Message Date
Adam Matthiesen ca3e595401
Update package.json 2024-03-19 05:22:27 -07:00
Adam Matthiesen fa276f9d64
Update changeset-main.yml 2024-03-19 05:20:16 -07:00
Adam Matthiesen 5166bdc11f
Update package.json 2024-03-19 05:18:51 -07:00
github-actions[bot] acf9a1def4
👷 [ci]: Ready for Release (#120)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-19 05:16:19 -07:00
dependabot[bot] f82035b813
Bump the prod-dependencies group with 9 updates (#119)
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-19 05:14:59 -07:00
dependabot[bot] a6b2b28843
Bump the dev-dependencies group with 6 updates (#118)
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-19 05:03:24 -07:00
Adam Matthiesen c3b8872706 Update package versions in pnpm-lock.yaml 2024-03-12 23:27:32 -07:00
github-actions[bot] 13d6b551b8
👷 [ci]: Ready for Release (#116)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-12 23:23:30 -07:00
create-issue-branch[bot] f097c6a18b
fix: 🐛 bug: ultrahtml does not handle all html strings. add switch to enable standard html fragment tag instead. (#115)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
2024-03-12 23:22:39 -07:00
github-actions[bot] ec50145786
👷 [ci]: Ready for Release (#113)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-12 17:09:02 -07:00
create-issue-branch[bot] b0218e182b
fix: 🐛 Custom Code Component Swap is causing issues. (#112)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
2024-03-12 17:06:50 -07:00
Adam Matthiesen 8074b66935
Update coauthor.yml 2024-03-12 15:16:10 -07:00
Adam Matthiesen c57ff7d370
Update README.md 2024-03-11 16:30:54 -07:00
Adam Matthiesen 2854ad8a33
Update gitlab-sync.yml 2024-03-11 15:17:08 -07:00
Adam Matthiesen cfc6c88a8f Update @matthiesenxyz/astro-ghostcms version specifier to ^3.3.3 2024-03-11 10:22:18 -07:00
github-actions[bot] e532e1471e
👷 [ci]: Ready for Release (#110)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-11 10:19:45 -07:00
create-issue-branch[bot] b685e6617d
chore: ♻️ Fix: Some Deps should be Peer not dev/main (#109)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
2024-03-11 10:18:12 -07:00
dependabot[bot] 62829e268a
Bump the dev-dependencies group with 2 updates (#105)
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-11 08:44:46 -07:00
Adam Matthiesen 6f1139f038 update pnpm-lock 2024-03-09 21:05:19 -08:00
github-actions[bot] f1ee69c8b7
👷 [ci]: Ready for Release (#102)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-09 21:03:00 -08:00
create-issue-branch[bot] 4c1002a733
fix: 🐛 Tag slug page returns 404 in development environment (#101)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Jungley <yejing@live.cn>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
2024-03-09 21:02:03 -08:00
github-actions[bot] 10bcac444b
👷 [ci]: Ready for Release (#98)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-09 08:49:52 -08:00
create-issue-branch[bot] a02c78b323
feat: bump starlight-ghostcms (#97)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <30383579+Adammatthiesen@users.noreply.github.com>
2024-03-09 08:49:00 -08:00
github-actions[bot] 6fee8bab1d
👷 [ci]: Ready for Release (#95)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-09 08:44:55 -08:00
Adam Matthiesen 209e99b8c7
update deps (#94) 2024-03-09 08:43:42 -08:00
github-actions[bot] b0ebb96783
👷 [ci]: Ready for Release (#93)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-09 05:11:38 -08:00
create-issue-branch[bot] 746fcc5858
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>
2024-03-09 05:09:43 -08:00
github-actions[bot] 110c5a973a
👷 [ci]: Ready for Release (#90)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-09 04:12:50 -08:00
create-issue-branch[bot] 205738c288
fix: 🐛 Bug: `Starlight-GhostCMS` on line 113 of `ghostAPI.ts` (#89)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
2024-03-09 04:11:54 -08:00
Adam Matthiesen fa93f54b68
Update changeset-main.yml 2024-03-07 23:53:14 -08:00
72 changed files with 1871 additions and 1453 deletions

View File

@ -26,13 +26,13 @@ jobs:
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: install dependencies
run: pnpm install
run: pnpm install --no-frozen-lockfile
- name: create and publish versions
uses: matthiesenxyz/changeset@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "Chore: Ready for Release"
title: "👷 [ci]: Ready for Release"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -14,4 +14,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: kevinzunigacuellar/coauthor-action@v0.1.1
- uses: kevinzunigacuellar/coauthor-action@v0.1.2

View File

@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: jauderho/git-repo-sync@63782025e80e84c48b25a1ee6bb9a22a3bd570d3
- uses: MatthiesenXYZ/git-sync-action@v1.1
with:
# Such as https://github.com/wangchucheng/git-repo-sync.git
target-url: ${{ secrets.GITLAB_URL }}

View File

@ -36,7 +36,6 @@ In this Repo you will find the Following:
- `packages/`:
- [`create-astro-ghostcms`](./packages/create-astro-ghostcms/): CLI Utility to quickly deploy new Astro-GhostCMS projects.
- [`astro-ghostcms`](./packages/astro-ghostcms/): The main Integration!
- [`astro-ghostcms-rendercontent`](./packages/astro-ghostcms-rendercontent/): Allows rendering of remote GhostCMS HTML with Custom Astro Components
- [`astro-ghostcms-theme-default`](./packages/astro-ghostcms-theme-default/): The Default theme in integration mode.
- [`astro-ghostcms-catppuccin`](./packages/astro-ghostcms-catppuccin/): A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS Integration Mode.
- [`astro-ghostcms-brutalbyelian`](./packages/astro-ghostcms-brutalbyelian/): [ElianCodes](https://www.elian.codes/) Brutal theme modified to work with Astro-GhostCMS

View File

@ -22,10 +22,10 @@
"test:starlight:coverage": "pnpm --filter starlight-ghostcms test:coverage"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@biomejs/biome": "1.6.1",
"@changesets/cli": "^2.27.1",
"@vitest/ui": "^1.3.1",
"vitest": "^1.3.1",
"@vitest/ui": "^1.4.0",
"vitest": "^1.4.0",
"vitest-fetch-mock": "^0.2.2"
}
}

View File

@ -1,5 +1,55 @@
# @matthiesenxyz/astro-ghostcms-brutalbyelian
## 0.0.18
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms@3.3.5
## 0.0.17
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.0.16
### Patch Changes
- b0218e1: 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.
## 0.0.15
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.0.14
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.0.13
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-brutalbyelian",
"description": "ElianCodes Brutal theme modified to work with Astro-GhostCMS",
"version": "0.0.13",
"version": "0.0.18",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -42,11 +42,11 @@
},
"scripts": {},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"astro": ">=4.4.1"
},
"devDependencies": {
"@typescript-eslint/parser": "^7.1.1",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-jsx-a11y": "^6.8.0",
@ -57,12 +57,12 @@
"@eliancodes/brutal-ui": "^0.2.6",
"@iconify-json/logos": "^1.1.41",
"@iconify-json/uil": "^1.1.8",
"@unocss/astro": "^0.58.5",
"@unocss/reset": "^0.58.5",
"astro-font": "^0.0.77",
"@unocss/astro": "^0.58.6",
"@unocss/reset": "^0.58.6",
"astro-font": "^0.0.78",
"astro-remote": "0.3.2",
"typescript": "^5.4.2",
"ultrahtml": "^1.5.3",
"unocss": "^0.58.5"
"unocss": "^0.58.6"
}
}

View File

@ -2,6 +2,10 @@
import { getGhostImgPath } from "../../utils";
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
image: string;
alt?: string;
@ -23,5 +27,8 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
alt={alt}
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>

View File

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

View File

@ -4,6 +4,5 @@ export { default as H3 } from "./H3.astro";
export { default as H4 } from "./H4.astro";
export { default as H5 } from "./H5.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 astrocard } from "./astrocard.astro";

View File

@ -7,6 +7,9 @@ import BlogPostHeader from "../components/blog/BlogPostHeader.astro";
import { Markup } from 'astro-remote';
import * as C from "../components/ghostrender";
import { Card } from "@eliancodes/brutal-ui";
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export async function getStaticPaths() {
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
@ -30,10 +33,10 @@ invariant(settings, "Settings are required");
<div class="my-5"/>
<div id="ghost">
<Markup
{useRemote ? <Markup
content={post.html}
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={{
@ -43,11 +46,10 @@ invariant(settings, "Settings are required");
h4: C.H4,
h5: C.H5,
h6: C.H6,
pre: C.CodeSlot,
p: C.Paragraph,
astrocard: C.astrocard,
}}
/>
/> : <Fragment set:html={post.html} />}
</div>
</article>

View File

@ -8,7 +8,7 @@ import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/
export async function getStaticPaths() {
const posts = await getAllPosts();
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -2,7 +2,7 @@
import Layout from '../layouts/Default.astro';
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagSummaryCard from '../components/generic/TagSummaryCard.astro';
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
invariant(settings, 'Settings not found');
const title = settings.title;
@ -16,7 +16,7 @@ const description = settings.description;
description={description}
>
<main class='bg-pink p-6'>
{
{
tags
.filter((tag) => tag.slug && !tag.slug.startsWith("hash-"))
.map((tag) => (

View File

@ -1,5 +1,36 @@
# @matthiesenxyz/astro-ghostcms-catppuccin
## 0.0.14
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.0.13
### Patch Changes
- b0218e1: 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.
## 0.0.12
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.0.11
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.0.10
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-catppuccin",
"description": "A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS",
"version": "0.0.10",
"version": "0.0.14",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -50,7 +50,7 @@
},
"scripts": {},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"astro": ">=4.4.0"
},
"devDependencies": {
@ -60,7 +60,7 @@
"@astrojs/tailwind": "^5.1.0",
"@catppuccin/tailwindcss": "0.1.6",
"@fontsource-variable/inter": "^5.0.17",
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
"@matthiesenxyz/astro-ghostcms": "^3.3.5",
"@tailwindcss/typography": "^0.5.10",
"astro-navbar": "^2.3.1",
"astro-remote": "^0.3.2",

View File

@ -4,7 +4,9 @@ import FeatureImage from "./FeatureImage.astro";
import AuthorList from "./AuthorList.astro";
import { formatDate } from "../utils";
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
posts: Post[];
@ -62,16 +64,15 @@ const latestFeatured = posts[0]
</div>
<div class="divider my-4"/>
<section id="ghostimport" class="text-ctp-subtext1">
{latestFeatured && <Markup
content={latestFeatured.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
}}
/> }
{useRemote ? (latestFeatured && <Markup
content={latestFeatured.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'],
}}
/>) : (latestFeatured && <Fragment set:html={latestFeatured.html} />) }
</section>
</div>
</main>

View File

@ -3,7 +3,9 @@ import PostHero from "../components/PostHero.astro";
import PostFooter from "../components/PostFooter.astro";
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
post: Post;
@ -17,10 +19,10 @@ async function getPostsSet(){
const featuredPosts = await getFeaturedPosts();
const fposts = posts;
if(featuredPosts.posts.length === 0){ return fposts }
else {
const featured = featuredPosts.posts[0]
return fposts.filter((p: Post)=>p.id !== featured.id)
}
const featured = featuredPosts.posts[0]
return fposts.filter((p: Post)=>p.id !== featured.id)
}
const mPosts = await getPostsSet()
@ -30,16 +32,15 @@ invariant(settings, "Settings not found");
<PostHero post={post} settings={settings} />
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
<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'],
}}
components={{
pre: render.CodeSlot
}}
/>
{useRemote ? (
<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'],
}}
/>
) : <Fragment set:html={post.html} /> }
</div>
<PostFooter post={post} settings={settings} posts={mPosts} />

View File

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

View File

@ -1 +0,0 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -7,7 +7,7 @@ import PostPreview from '../../components/PostPreview.astro';
export async function getStaticPaths() {
const posts = await getAllPosts();
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {
@ -37,7 +37,7 @@ const description = `All of the articles we've posted and linked so far under th
<Layout title={title} description={description} settings={settings}>
<Container>
<section class="post-card post-card-large">
<div class="post-card-content">
<div class="post-card-content-link">
<header class="post-card-header">

View File

@ -6,7 +6,7 @@ import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcm
let title = "All Tags";
let description = "All the tags used so far...";
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
invariant(settings, 'Settings not found');

View File

@ -1,60 +0,0 @@
# @matthiesenxyz/astro-ghostcms-rendercontent
## 0.0.9
### Patch Changes
- 2724119: Prep to deprecate this package. Moving to `astro-remote`
## 0.0.8
### Patch Changes
- f921005: Bump dependencies:
- vite from to
- @eliancodes/brutal-ui from to
- typescript from to
- ultrahtml from to
- @fontsource-variable/inter from to
- astro-seo from to
- astro from to
- sass from to
- @astrojs/starlight from to
- sharp from to
## 0.0.7
### Patch Changes
- 1f850db: Bump dependencies:
- astro from to
- vite from to
- astro-seo from to
- sass from to
## 0.0.6
### Patch Changes
- 3a5aea9: Updated Tests and Linted packages
## 0.0.5
### Patch Changes
- 455ad3f: Bump astro from 4.0.0 to 4.3.7
- 12be739: Depencency updates
## 0.0.4
### Patch Changes
- Fix License File
## 0.0.3
### Patch Changes
- Initialization of changeset cli

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2024 MatthiesenXYZ - Astro-GhostCMS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,35 +0,0 @@
# Astro GhostCMS Content API HTML Processor
## NOTE: This package is no longer in use - Please switch to [`astro-remote`](https://github.com/natemoo-re/astro-remote)
Render remote GhostCMS HTML in Astro with full control over the output.
Powered by [`ultrahtml`](https://github.com/natemoo-re/ultrahtml).
## Rendering Remote Content
The most basic function of `astro-ghostcms-rendercontent` is to convert a string of HTML to Astro friendly HTML. Use the `GhostRender` component.
```astro
---
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
---
<GhostRender content={post.html} />
```
### Customization
`GhostRender` allows full control over the rendering of output. The `components` option allows you to replace a standard HTML element with a custom component.
```astro
---
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
import Title from '../components/Title.astro';
---
<!-- Render <h1> as custom <Title> component -->
<GhostRender content={post.html} components={{ h1: Title }} />
```
For examples on how to setup custom components check [examples](./examples/)

View File

@ -1,12 +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 } = codetag
const code = children[0].value
---
<Code code={code} lang={"sh"} theme={"monokai"}/>

View File

@ -1,5 +0,0 @@
---
---
<h1 class="righteous">
<slot />
</h1>

View File

@ -1,5 +0,0 @@
---
---
<h2 class="righteous">
<slot />
</h2>

View File

@ -1,5 +0,0 @@
---
---
<h3 class="righteous">
<slot />
</h3>

View File

@ -1,5 +0,0 @@
---
---
<h4 class="righteous">
<slot />
</h4>

View File

@ -1,5 +0,0 @@
---
---
<h5 class="righteous">
<slot />
</h5>

View File

@ -1,5 +0,0 @@
---
---
<h6 class="righteous">
<slot />
</h6>

View File

@ -1,21 +0,0 @@
---
---
<p class="my-5"><slot /></p>
<style is:inline>
#ghost p a {
color: rgb(0, 123, 247);
}
#ghost ul li a {
color: rgb(0, 123, 247);
}
#ghost ul li {
padding-top: 0.5rem;
margin-left: 2rem;
list-style: circle;
}
#ghost ul {
margin-top: 1rem;
margin-bottom: 1rem;
}
</style>

View File

@ -1,8 +0,0 @@
export { default as H1 } from "./H1.astro";
export { default as H2 } from "./H2.astro";
export { default as H3 } from "./H3.astro";
export { default as H4 } from "./H4.astro";
export { default as H5 } from "./H5.astro";
export { default as H6 } from "./H6.astro";
export { default as CodeSlot } from "./CodeSlot.astro";
export { default as Paragraph } from "./Paragraph.astro";

View File

@ -1 +0,0 @@
export { default as GhostRender } from "./lib/GhostRender.astro";

View File

@ -1,18 +0,0 @@
---
import { createComponentProxy, html } from './utils';
export interface Props {
content?: string;
components?: Record<string, any>;
}
const input = Astro.props.content ?? await Astro.slots.render('default');
if (!input) {
throw new Error('Unable to render <GhostRender> without a content prop or children')
}
// @ts-ignore
const components = createComponentProxy($$result, Astro.props.components);
const content = await html(input, { components });
---
<Fragment set:html={content} />

View File

@ -1 +0,0 @@
/// <reference types="astro/client" />

View File

@ -1,59 +0,0 @@
import { jsx as h } from "astro/jsx-runtime";
import { renderJSX } from "astro/runtime/server/jsx";
import * as entities from "entities";
import { transform } from "ultrahtml";
import { __unsafeHTML } from "ultrahtml";
import swap from "ultrahtml/transformers/swap";
export function createComponentProxy(
result,
_components: Record<string, any> = {},
) {
const components = {};
for (const [key, value] of Object.entries(_components)) {
if (typeof value === "string") {
components[key] = value;
} else {
components[key] = async (props, children) => {
if (key === "CodeBlock" || key === "CodeSpan") {
props.code = entities.decode(JSON.parse(`"${props.code}"`));
}
const output = await renderJSX(
result,
h(value, { ...props, "set:html": children.value }),
);
return __unsafeHTML(output);
};
}
}
return components;
}
function getIndent(ln: string): string {
if (ln.trim() === ln) return "";
return ln.slice(0, ln.length - ln.trim().length);
}
export function dedent(str: string): string {
const lns = str.replace(/^[\r\n]+/, "").split("\n");
let indent = getIndent(lns[0]);
if (indent.length === 0 && lns.length > 1) {
indent = getIndent(lns[1]);
}
return lns
.map((ln) => (ln.startsWith(indent) ? ln.slice(indent.length) : ln))
.map((ln, i, { length }) => (i === length - 1 ? ln.trim() : ln))
.join("\n");
}
export interface HTMLOptions {
// biome-ignore lint/complexity/noBannedTypes: <explanation>
components?: {};
}
export async function html(
input: string,
opts: HTMLOptions = {},
): Promise<string> {
return transform(dedent(input), [swap(opts.components)]);
}

View File

@ -1,47 +0,0 @@
{
"name": "@matthiesenxyz/astro-ghostcms-rendercontent",
"type": "module",
"version": "0.0.9",
"repository": {
"type": "git",
"url": "git+https://github.com/MatthiesenXYZ/astro-ghostcms.git"
},
"bugs": {
"url": "https://github.com/MatthiesenXYZ/astro-ghostcms/issues",
"email": "issues@astro-ghostcms.xyz"
},
"publishConfig": {
"access": "public"
},
"sideEffects": false,
"homepage": "https://astro-ghostcms.xyz",
"files": [
"examples",
"lib",
"index.ts",
"CHANGELOG.md"
],
"types": "./index.ts",
"exports": {
".": "./index.ts",
"./lib/*": "./lib/*",
"./examples/*": "./examples/*",
"./package.json": "./package.json"
},
"keywords": [
"astro-ghostcms"
],
"author": {
"email": "adam@matthiesen.xyz",
"name": "Adam Matthiesen - MatthiesenXYZ",
"url": "https://matthiesen.xyz"
},
"license": "MIT",
"dependencies": {
"entities": "^4.5.0",
"ultrahtml": "^1.5.3"
},
"devDependencies": {
"astro": "4.4.13"
}
}

View File

@ -1,5 +1,55 @@
# @matthiesenxyz/astro-ghostcms-theme-default
## 0.1.20
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms@3.3.5
## 0.1.19
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.1.18
### Patch Changes
- b0218e1: 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.
## 0.1.17
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.1.16
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.1.15
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
"description": "Default Theme for astro-ghostcms",
"version": "0.1.15",
"version": "0.1.20",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -43,17 +43,17 @@
"scripts": {},
"devDependencies": {
"@matthiesenxyz/astro-ghostcms": "*",
"@astrojs/check": "^0.5.6",
"@astrojs/check": "^0.5.9",
"typescript": "^5.4.2"
},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"astro": ">=4.4.0"
},
"dependencies": {
"astro-font": "^0.0.77",
"astro-font": "^0.0.78",
"astro-remote": "^0.3.2",
"sass": "^1.71.1",
"sass": "^1.72.0",
"ultrahtml": "^1.5.3"
}
}

View File

@ -2,7 +2,10 @@
import FeatureImage from "../components/FeatureImage.astro";
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
page: Page;
settings: Settings;
@ -26,15 +29,15 @@ const { page, settings, pageClass } = Astro.props as Props;
<section class="gh-content gh-canvas">
<h1 class="article-title">{page.title}</h1>
<Markup
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
}} />
{useRemote ? (
<Markup
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', 'astrocard'],
}}
/>
) : <Fragment set:html={page.html} /> }
</section>
</article>
</main>

View File

@ -3,7 +3,10 @@ import PostHero from "../components/PostHero.astro";
import PostFooter from "../components/PostFooter.astro";
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
post: Post;
settings: Settings;
@ -18,15 +21,15 @@ invariant(settings, "Settings not found");
<article class={`article post ${postClass}`}>
<PostHero post={post} settings={settings} />
<section class="gh-content gh-canvas">
<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'],
}}
components={{
pre: render.CodeSlot
}} />
{useRemote ? (
<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'],
}}
/>
) : <Fragment set:html={post.html} /> }
</section>
</article>
<PostFooter post={post} settings={settings} posts={posts} />

View File

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

View File

@ -1 +0,0 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -1,13 +1,13 @@
---
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import DefaultPageLayout from "../../layouts/default.astro";
import PostPreview from "../../components/PostPreview.astro";
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import PostPreview from "../../components/PostPreview.astro";
import DefaultPageLayout from "../../layouts/default.astro";
import { getGhostImgPath } from "../../utils";
export async function getStaticPaths() {
const posts = await getAllPosts();
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -1,13 +1,13 @@
---
import DefaultPageLayout from "../layouts/default.astro";
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagCard from "../components/TagCard.astro";
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import DefaultPageLayout from "../layouts/default.astro";
let title = "All Tags";
let description = "All the tags used so far...";
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings not found");
---

View File

@ -1,5 +1,46 @@
# @matthiesenxyz/astro-ghostcms
## 3.3.5
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.20
## 3.3.4
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.19
## 3.3.3
### Patch Changes
- b685e66: Update Deps
## 3.3.2
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.17
## 3.3.1
### Patch Changes

View File

@ -66,6 +66,9 @@ export default defineConfig({
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false, // OPTIONAL - Default False
theme: "@matthiesenxyz/astro-ghostcms-theme-default", // OPTIONAL - Default Theme shown.
astroRemote: {
enable: true // OPTIONAL - Default True, Allows the user to switch to standard <Fragment> html rendering if they are having issues with Astro-remote
}
};
disableDefault404: false, // Allows the user to disable the default `/404 page, to be able to create their own under `/src/pages/404.astro`.
enableRSSFeed: true, // Allows the user to Enable or disable RSS Feed Generation. Default: true

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms",
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
"version": "3.3.1",
"version": "3.3.5",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -61,24 +61,24 @@
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.25",
"vitest": "^1.3.1",
"@types/node": "^20.11.28",
"vitest": "^1.4.0",
"vitest-fetch-mock": "^0.2.2"
},
"dependencies": {
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.14",
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.20",
"@resvg/resvg-js": "^2.6.0",
"@ts-ghost/core-api": "^6.0.0",
"@ts-ghost/content-api": "^4.0.12",
"astro-integration-kit": "^0.5.1",
"astro-integration-kit": "^0.6.0",
"astro-robots-txt": "^1.0.0",
"fs-extra": "^11.2.0",
"package-json": "^10.0.0",
"picocolors": "^1.0.0",
"satori": "^0.10.13",
"satori-html": "^0.3.2",
"vite": "^5.1.5"
"vite": "^5.1.6"
}
}

View File

@ -1,5 +1,5 @@
import { TSGhostContentAPI } from "@ts-ghost/content-api";
import type { Page, Post } from "../schemas/api";
import type { Page, Post, Tag } from "../schemas/api";
// LOAD ENVIRONMENT VARIABLES
import { loadEnv } from "vite";
@ -94,17 +94,20 @@ export const getSettings = async () => {
};
export const getAllTags = async () => {
const results = await api.tags
.browse()
const tags: Tag[] = [];
let cursor = await api.tags
.browse({
limit: 'all'
})
.include({ "count.posts": true })
.fetch();
if (!results.success) {
throw new Error(results.errors.map((e) => e.message).join(", "));
.paginate();
if (cursor.current.success) tags.push(...cursor.current.data);
while (cursor.next) {
cursor = await cursor.next.paginate();
if (cursor.current.success) tags.push(...cursor.current.data);
}
return {
tags: results.data,
meta: results.meta,
};
return tags;
};
export const getFeaturedPosts = async () => {

View File

@ -16,7 +16,7 @@ import satoriOG from "../../satori";
export const getStaticPaths: GetStaticPaths = async () => {
const result: GetStaticPathsItem[] = [];
const posts = await getAllPosts();
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings are required");

View File

@ -17,22 +17,19 @@ export const GhostUserConfigSchema = z.object({
/** OPTIONAL - Configure the Theme Provider
* @ This option allows the user to configure the Theme Provider
*/
ThemeProvider: z
.object({
ThemeProvider: z.object({
/** OPTIONAL - Disable the theme provider
* @default false
*/
disableThemeProvider: z.coerce.boolean(),
disableThemeProvider: z.coerce.boolean().default(false),
/** OPTIONAL - Set the theme you want to use
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
*/
theme: z.string(),
})
.optional()
.default({
disableThemeProvider: false,
theme: "@matthiesenxyz/astro-ghostcms-theme-default"
}),
theme: z.string().default("@matthiesenxyz/astro-ghostcms-theme-default"),
astroRemote: z.object({
enable: z.boolean().default(true),
}).optional().default({}),
}).optional().default({}),
/** Allows the user to disable the provided 404 page */
disableDefault404: z.coerce.boolean().optional(),
/** Allows the user to disable the provided RSS Feed */

View File

@ -1,5 +1,11 @@
# @matthiesenxyz/create-astro-ghostcms
## 0.1.2
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
## 0.1.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@matthiesenxyz/create-astro-ghostcms",
"version": "0.1.1",
"version": "0.1.2",
"description": "Utility to quickly get started with our Integration and astro",
"type": "module",
"main": "./create-astro-ghostcms.mjs",
@ -44,7 +44,7 @@
"devDependencies": {
"@types/fs-extra": "^11.0.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/node": "^20.11.25",
"@types/node": "^20.11.28",
"@types/tar-fs": "^2.0.1",
"typescript": "^5.4.2"
},

View File

@ -1,13 +1,13 @@
---
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import DefaultPageLayout from "../../layouts/default.astro";
import PostPreview from "../../components/PostPreview.astro";
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import PostPreview from "../../components/PostPreview.astro";
import DefaultPageLayout from "../../layouts/default.astro";
import { getGhostImgPath } from "../../utils";
export async function getStaticPaths() {
const posts = await getAllPosts();
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -1,13 +1,13 @@
---
import DefaultPageLayout from "../layouts/default.astro";
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagCard from "../components/TagCard.astro";
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import DefaultPageLayout from "../layouts/default.astro";
let title = "All Tags";
let description = "All the tags used so far...";
const { tags } = await getAllTags();
const tags = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings not found");
---

View File

@ -1,5 +1,66 @@
# @matthiesenxyz/starlight-ghostcms
## 0.1.9
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
## 0.1.8
### Patch Changes
- b0218e1: 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.
## 0.1.7
### Patch Changes
- b685e66: Update Deps
## 0.1.6
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
## 0.1.5
### Patch Changes
- a02c78b: bump starlight-ghostcms
## 0.1.4
### Patch Changes
- 209e99b: update deps
## 0.1.4
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.1.3
### Patch Changes
- 205738c: fix bug, and resolved config issue that was now will allow users to pass the ghostURL within their `astro.config.mjs`
## 0.1.2
### Patch Changes

View File

@ -49,7 +49,9 @@ export default defineConfig({
integrations: [
starlight({
plugins: [
starlightGhostCMS()
starlightGhostCMS({
ghostURL: "https://ghostdemo.matthiesen.xyz"
})
],
title: 'My Docs',
}),
@ -63,7 +65,7 @@ You must also create 2 environment variables in a `.env` file with the following
```env
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz // ghostURL option in `astro.config.mjs` will take priority. (This is fallback option)
GITHUB_PERSONAL_TOKEN=ghp_ //OPTIONAL - This is for Astro-Gists if you choose to use it!
```

View File

@ -1,18 +1,14 @@
import type { StarlightPlugin, StarlightUserConfig } from "@astrojs/starlight/types";
import type { AstroIntegrationLogger } from "astro";
import { type StarlightGhostConfig, validateConfig } from "./src/schemas/config";
import { facebook, getSettings, invariant, twitter } from "./src/utils/api";
import starlightGhostcms from "./src/integrations/starlight-ghostcms";
const settings = await getSettings();
export type { StarlightGhostConfig };
export default function starlightGhostCMS(
userConfig?: StarlightGhostConfig,
): StarlightPlugin {
const config: StarlightGhostConfig = validateConfig(userConfig);
invariant(settings, "Settings not available... check your api key/url");
return {
name: "@matthiesenxyz/starlight-ghostcms-plugin",
@ -32,8 +28,6 @@ export default function starlightGhostCMS(
social: {
...starlightConfig.social,
...overrideRSS(starlightConfig.social, astroConfig.site),
...overrideTwitter(starlightConfig.social),
...overrideFacebook(starlightConfig.social),
},
components: {
...starlightConfig.components,
@ -59,6 +53,7 @@ export default function starlightGhostCMS(
};
}
function overrideRSS(
socials: StarlightUserConfig["social"],
url: string | undefined
@ -68,26 +63,6 @@ function overrideRSS(
return { rss: `${url}/rss.xml` };
}
function overrideTwitter(
socials: StarlightUserConfig["social"],
) {
if (socials?.twitter) { return {}; }
if (settings?.twitter) {
return { twitter: twitter(settings.twitter), }
}
return undefined;
}
function overrideFacebook(
socials: StarlightUserConfig["social"],
) {
if (socials?.facebook) { return {}; }
if (settings?.facebook) {
return { facebook: facebook(settings.facebook), }
}
return undefined;
}
function overrideStarlightComponent(
components: StarlightUserConfig["components"],
logger: AstroIntegrationLogger,

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/starlight-ghostcms",
"description": "Starlight GhostCMS plugin to allow easier importing of GhostCMS Content into your starlight website",
"version": "0.1.2",
"version": "0.1.9",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -54,20 +54,19 @@
},
"devDependencies": {
"@astrojs/starlight": "^0.21.1",
"astro": "^4.4.13",
"vitest": "^1.3.1",
"vitest": "^1.4.0",
"vitest-fetch-mock": "^0.2.2"
},
"dependencies": {
"@astrojs/rss": "^4.0.5",
"@matthiesenxyz/astro-gists": "^0.2.1",
"@matthiesenxyz/astro-gists": "^0.2.11",
"@ts-ghost/core-api": "^6.0.0",
"@ts-ghost/content-api": "^4.0.12",
"astro-integration-kit": "^0.5.1",
"astro-integration-kit": "^0.6.0",
"astro-remote": "^0.3.2",
"ultrahtml": "^1.5.3",
"vite": "^5.1.5",
"vite-tsconfig-paths": "^4.3.1"
"vite": "^5.1.6",
"vite-tsconfig-paths": "^4.3.2"
},
"peerDependencies": {
"@astrojs/starlight": ">=0.19.0",

View File

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

View File

@ -1 +0,0 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -6,12 +6,17 @@ import { corePlugins } from "astro-integration-kit/plugins";
import { z } from "astro/zod";
import { type StarlightGhostConfig } from "../schemas/config";
import astroGists from "@matthiesenxyz/astro-gists";
import { AstroError } from "astro/errors";
import { loadEnv } from "vite";
// Load environment variables
const ENV = loadEnv("all", process.cwd(), "CONTENT_API");
export default defineIntegration({
name: "@matthiesenxyz/starlight-ghostcms",
optionsSchema: z.custom<StarlightGhostConfig>(),
plugins: [...corePlugins],
setup({ options }) {
setup({ options, name }) {
const { resolve } = createResolver(import.meta.url);
return {
@ -24,6 +29,23 @@ export default defineIntegration({
}) => {
watchIntegration(resolve());
// Check for GhostCMS API Key
if (ENV.CONTENT_API_KEY === undefined) {
throw new AstroError(
`${name} CONTENT_API_KEY is not set in environment variables`,
);
}
// Check for GhostCMS URL
if (options.ghostURL === undefined) {
logger.warn("ghostURL is not set in user configuration falling back to environment variable");
if (ENV.CONTENT_API_URL === undefined) {
throw new AstroError(
`${name} CONTENT_API_URL is not set in environment variables`,
);
}
}
// Add the AstroGist integration if enabled
logger.info("Adding @matthiesenxyz/astro-gists integration ...");
addIntegration(astroGists());

View File

@ -6,7 +6,6 @@ import { getPageProps } from '../utils/page';
import { getAllPosts } from '../utils/api';
import Metadata from '../components/Metadata.astro';
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import * as Gists from '@matthiesenxyz/astro-gists/components';
export async function getStaticPaths() {
@ -48,11 +47,9 @@ 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,
getgist: Gists.GetGist,
getgistgroup: Gists.GetGistGroup,
}}

View File

@ -6,29 +6,27 @@ import Page from '../components/Page.astro'
import { getPageProps } from '../utils/page'
import { getSluggedPage } from '../utils/api'
import { Markup } from 'astro-remote'
import * as render from '../components/astro-remote';
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>

View File

@ -3,6 +3,10 @@ import { z } from "astro/zod";
const configSchema = z
.object({
/**
* The URL of the GhostCMS instance.
*/
ghostURL: z.string().url().optional(),
/**
* The number of blog posts to display per page in the blog post list.
*/
@ -31,8 +35,8 @@ const configSchema = z
* Turn on and off "Powered by Ghost"
*/
supportGhost: z.boolean().default(true),
})
.default({ postCount: 5, recentPostCount: 10, route: "blog", title: "Blog", rssDescription: "My Awesome Starlight-GhostCMS Blog", supportGhost: true});
verbose: z.boolean().default(false),
});
export function validateConfig(userConfig: unknown): StarlightGhostConfig {
const config = configSchema.safeParse(userConfig);

View File

@ -3,7 +3,7 @@ import type { Page, Post } from "./schemas";
// LOAD ENVIRONMENT VARIABLES
import { loadEnv } from "vite";
//import StarlightGhostConfig from "virtual:starlight-ghostcms/config";
import config from "virtual:starlight-ghostcms/config";
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
"all",
@ -11,12 +11,9 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
"CONTENT_",
);
//const ConfURL = StarlightGhostConfig.ghostURL || "";
// SETUP GHOST API
const ghostApiKey = CONTENT_API_KEY || "";
const ghostUrl = CONTENT_API_URL || "";
const ghostUrl = config.ghostURL || CONTENT_API_URL || "";
const version = "v5.0";
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
@ -101,6 +98,15 @@ export const getAllPages = async () => {
return pages;
};
export const getSettings = async () => {
const res = await api.settings.fetch();
if (res.success) {
return res.data;
}
return null;
};
export const getSluggedPage = async (slug:string) => {
const results = await api.pages
.read({slug: slug})
@ -110,21 +116,16 @@ export const getSluggedPage = async (slug:string) => {
}).fetch()
if (!results.success) {
throw new Error(results.errors.map((e) => e.message).join(", "));
if (config.verbose === true){
console.log(`[Starlight-GhostCMS]: ${results.errors.map((e) => e.message).join(", ")}Resource: (${slug})`);
}
return null;
}
return {
post: results.data,
};
};
export const getSettings = async () => {
const res = await api.settings.fetch();
if (res.success) {
return res.data;
}
return null;
};
export const getAllTags = async () => {
const results = await api.tags
.browse()

View File

@ -1,18 +1,21 @@
import ghostcms from "@matthiesenxyz/astro-ghostcms";
import { defineConfig } from "astro/config";
///import tailwind from "@astrojs/tailwind";
//import UnoCSS from "unocss/astro";
// import tailwind from "@astrojs/tailwind";
// import UnoCSS from "unocss/astro";
// https://astro.build/config
export default defineConfig({
site: "https://demo.astro-ghostcms.xyz/",
integrations: [
//tailwind(),
//UnoCSS({ injectReset: true }),
// UnoCSS({ injectReset: true }),
ghostcms({
ghostURL: 'https://ghostdemo.matthiesen.xyz',
ThemeProvider: {
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
astroRemote: {
enable: true,
},
},
verbose: true,
}),

View File

@ -11,18 +11,18 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.4.13",
"astro": "^4.5.6",
"@matthiesenxyz/astro-ghostcms": "workspace:*",
"@matthiesenxyz/astro-ghostcms-theme-default": "workspace:*",
"@matthiesenxyz/astro-ghostcms-catppuccin": "workspace:*",
"@matthiesenxyz/astro-ghostcms-brutalbyelian": "workspace:*",
"@astrojs/tailwind": "^5.1.0",
"@unocss/astro": "^0.58.5",
"@unocss/astro": "^0.58.6",
"tailwindcss": "^3.3.5"
},
"devDependencies": {
"@unocss/reset": "^0.58.5",
"@unocss/reset": "^0.58.6",
"typescript": "^5.4.2",
"unocss": "^0.58.5"
"unocss": "^0.58.6"
}
}

View File

@ -10,6 +10,7 @@ export default defineConfig({
title: "My Docs",
plugins: [
starlightGhostCMS({
ghostURL: "https://ghostdemo.matthiesen.xyz",
title: "Demo Blog",
rssDescription: "Starlight Playground",
route: "blog",

View File

@ -11,11 +11,14 @@
"preview": "astro preview",
"astro": "astro"
},
"devDependencies": {},
"devDependencies": {
"@types/node": "^20.11.28"
},
"dependencies": {
"@astrojs/starlight": "^0.21.1",
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
"astro": "^4.4.13",
"@matthiesenxyz/astro-gists": "^0.2.11",
"astro": "^4.5.6",
"sharp": "^0.33.2"
}
}

File diff suppressed because it is too large Load Diff