svelte-purify
Advanced tools
Comparing version 0.1.2 to 1.0.0
{ | ||
"name": "svelte-purify", | ||
"description": "💎 Safe html expansion for Svelte with DOMPurify", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
@@ -56,12 +56,12 @@ "type": "module", | ||
"devDependencies": { | ||
"@jill64/eslint-config-svelte": "1.0.0", | ||
"@jill64/playwright-config": "1.0.0", | ||
"@jill64/eslint-config-svelte": "1.0.1", | ||
"@jill64/playwright-config": "1.4.2", | ||
"@jill64/prettier-config": "1.0.0", | ||
"@jill64/sentry-sveltekit-edge": "0.0.1", | ||
"@jill64/sentry-sveltekit-edge": "0.1.0", | ||
"@playwright/test": "1.40.1", | ||
"@sveltejs/adapter-vercel": "3.1.0", | ||
"@sveltejs/kit": "1.27.6", | ||
"@sveltejs/kit": "1.27.7", | ||
"svelte": "4.2.8", | ||
"typescript": "5.3.2", | ||
"vite": "5.0.5" | ||
"typescript": "5.3.3", | ||
"vite": "5.0.7" | ||
}, | ||
@@ -68,0 +68,0 @@ "dependencies": { |
@@ -10,1 +10,51 @@ <!----- BEGIN GHOST DOCS HEADER -----> | ||
<!----- END GHOST DOCS HEADER -----> | ||
## Installation | ||
```sh | ||
npm i svelte-purify | ||
``` | ||
## Usage | ||
```svelte | ||
<script> | ||
import { Render } from 'svelte-purify' | ||
const code = '<h1>Hello World</h1>' | ||
</script> | ||
<Render html={code} config={/* DOMPurify Config */} /> | ||
<!-- Equivalent to {@html code} --> | ||
``` | ||
## SSR | ||
`Render` uses DOMPurify internally and only works in the browser or at Node runtime. | ||
There are two options for use in non-node environments such as the edge. | ||
1. Use Browser Only Entry Point | ||
In this case, html is not rendered on the server. | ||
```svelte | ||
<script> | ||
import { Render } from 'svelte-purify/browser-only' | ||
</script> | ||
<Render html={/* ... */} /> | ||
``` | ||
2. Use [`svelte-sanitize`](https://github.com/jill64/svelte-sanitize) | ||
Enables the use of html rendering in non-node environments at the expense of detailed compatibility. | ||
Please check the link for details. | ||
```svelte | ||
<script> | ||
import { Render } from 'svelte-sanitize' | ||
</script> | ||
<Render html={/* ... */} /> | ||
``` |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6585
0
60