Comparing version 1.1.5 to 1.1.6
@@ -6,3 +6,2 @@ import { marked } from 'marked'; | ||
import { defaultPrefixes } from './prefixes'; | ||
import escape from 'escape-html'; | ||
export class Carta { | ||
@@ -49,5 +48,4 @@ options; | ||
async render(markdown) { | ||
const escaped = escape(markdown); | ||
return new Promise((resolve) => { | ||
marked.parse(escaped, (e, dirty) => { | ||
marked.parse(markdown, (e, dirty) => { | ||
resolve((this.options?.sanitizer && this.options?.sanitizer(dirty)) ?? dirty); | ||
@@ -63,4 +61,3 @@ }); | ||
renderSSR(markdown) { | ||
const escaped = escape(markdown); | ||
const dirty = marked.parse(escaped); | ||
const dirty = marked.parse(markdown); | ||
if (this.options?.sanitizer) | ||
@@ -67,0 +64,0 @@ return this.options.sanitizer(dirty); |
@@ -36,3 +36,7 @@ /** | ||
readonly maker: (prev: string) => string; | ||
}, { | ||
readonly id: "blockquote"; | ||
readonly match: (line: string) => string | undefined; | ||
readonly maker: (prev: string) => string; | ||
}]; | ||
export type DefaultPrefixId = (typeof defaultPrefixes)[number]['id']; |
@@ -28,3 +28,8 @@ export const defaultPrefixes = [ | ||
maker: (prev) => `${Number(prev.slice(0, -1)) + 1}. ` | ||
}, | ||
{ | ||
id: 'blockquote', | ||
match: (line) => line.match(/^(> *)+/gm)?.at(0), | ||
maker: (prev) => prev | ||
} | ||
]; |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"scripts": { | ||
@@ -25,3 +25,2 @@ "dev": "vite dev", | ||
"@sveltejs/package": "^2.0.2", | ||
"@types/escape-html": "^1.0.2", | ||
"@types/marked": "^4.0.8", | ||
@@ -36,3 +35,3 @@ "@types/prismjs": "^1.26.0", | ||
"type": "module", | ||
"dependencies": { "escape-html": "^1.0.3", "marked": "^4.3.0", "prismjs": "^1.29.0" }, | ||
"dependencies": { "marked": "^4.3.0", "prismjs": "^1.29.0" }, | ||
"peerDependencies": { "svelte": "^3.54.0" }, | ||
@@ -39,0 +38,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83193
3
10
1854
- Removedescape-html@^1.0.3
- Removedescape-html@1.0.3(transitive)