This commit is contained in:
Adam Matthiesen 2024-02-13 08:54:55 -08:00
parent 157598cf37
commit ecd4725c3e
13 changed files with 22 additions and 11 deletions

View File

@ -1,10 +1,8 @@
---
import type { SanitizeOptions } from 'ultrahtml/transformers/sanitize'
import { createComponentProxy, html } from './utils';
export interface Props {
content?: string;
sanitize?: SanitizeOptions;
components?: Record<string, any>;
}
@ -14,7 +12,7 @@ if (!input) {
}
// @ts-ignore
const components = createComponentProxy($$result, Astro.props.components);
const content = await html(input, { sanitize: Astro.props.sanitize, components });
const content = await html(input, { components });
---
<Fragment set:html={content} />

View File

@ -46,8 +46,6 @@ export function dedent(str: string): string {
export interface HTMLOptions {
// biome-ignore lint/complexity/noBannedTypes: <explanation>
sanitize?: {};
// biome-ignore lint/complexity/noBannedTypes: <explanation>
components?: {};
}

View File

@ -25,6 +25,7 @@
"exports": {
".": "./index.ts",
"./lib/*": "./lib/*",
"./examples/*": "./examples/*",
"./package.json": "./package.json"
},
"keywords": [

View File

@ -126,6 +126,9 @@ importers:
'@matthiesenxyz/astro-ghostcms':
specifier: ^3.2.1
version: link:../astro-ghostcms
'@matthiesenxyz/astro-ghostcms-rendercontent':
specifier: ^0.0.1
version: 0.0.1
'@unocss/astro':
specifier: ^0.57.7
version: 0.57.7(vite@5.0.12)
@ -148,9 +151,6 @@ importers:
specifier: ^0.57.7
version: 0.57.7(postcss@8.4.33)(vite@5.0.12)
devDependencies:
'@matthiesenxyz/astro-ghostcms-rendercontent':
specifier: workspace:*
version: link:../astro-ghostcms-rendercontent
'@typescript-eslint/parser':
specifier: ^6.21.0
version: 6.21.0(eslint@8.56.0)(typescript@5.3.3)
@ -208,9 +208,6 @@ importers:
entities:
specifier: ^4.5.0
version: 4.5.0
node-html-parser:
specifier: 6.1.12
version: 6.1.12
ultrahtml:
specifier: ^1.5.2
version: 1.5.2
@ -1503,6 +1500,13 @@ packages:
globby: 11.1.0
read-yaml-file: 1.1.0
/@matthiesenxyz/astro-ghostcms-rendercontent@0.0.1:
resolution: {integrity: sha512-2zXmCnAoFHZqvkEuccUY0uN/legpXxn0LzVvERc2w8bjTnOPTB+fQN35fc+OiyFZJEy+jgcvwM76ZA3dVgPayQ==}
dependencies:
entities: 4.5.0
ultrahtml: 1.5.2
dev: false
/@nodelib/fs.scandir@2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@ -3186,6 +3190,7 @@ packages:
/boolbase@1.0.0:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
dev: true
/boxen@7.1.1:
resolution: {integrity: sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog==}
@ -3551,6 +3556,7 @@ packages:
domhandler: 5.0.3
domutils: 3.1.0
nth-check: 2.1.1
dev: true
/css-to-react-native@3.2.0:
resolution: {integrity: sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==}
@ -3570,6 +3576,7 @@ packages:
/css-what@6.1.0:
resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==}
engines: {node: '>= 6'}
dev: true
/cssesc@3.0.0:
resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}
@ -3770,15 +3777,18 @@ packages:
domelementtype: 2.3.0
domhandler: 5.0.3
entities: 4.5.0
dev: true
/domelementtype@2.3.0:
resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
dev: true
/domhandler@5.0.3:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
dependencies:
domelementtype: 2.3.0
dev: true
/domutils@3.1.0:
resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==}
@ -3786,6 +3796,7 @@ packages:
dom-serializer: 2.0.0
domelementtype: 2.3.0
domhandler: 5.0.3
dev: true
/dset@3.1.3:
resolution: {integrity: sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ==}
@ -4817,6 +4828,7 @@ packages:
/he@1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
dev: true
/hex-rgb@4.3.0:
resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==}
@ -5951,6 +5963,7 @@ packages:
dependencies:
css-select: 5.1.0
he: 1.2.0
dev: true
/node-releases@2.0.14:
resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==}
@ -5993,6 +6006,7 @@ packages:
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
dependencies:
boolbase: 1.0.0
dev: true
/object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}