@limetech/lime-elements 37.61.9 → 37.61.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/{markdown-parser-c4a1ec47.js → markdown-parser-4924e9a1.js} +6 -2
- package/dist/cjs/{markdown-parser-c4a1ec47.js.map → markdown-parser-4924e9a1.js.map} +1 -1
- package/dist/collection/components/markdown/markdown-parser.js +5 -1
- package/dist/collection/components/markdown/markdown-parser.js.map +1 -1
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/{markdown-parser-108384e8.js → markdown-parser-745c1e6c.js} +6 -2
- package/dist/esm/{markdown-parser-108384e8.js.map → markdown-parser-745c1e6c.js.map} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-ee74cfff.entry.js → p-2972eab9.entry.js} +2 -2
- package/dist/lime-elements/{p-a7fca1dd.js → p-830720d8.js} +2 -2
- package/dist/lime-elements/{p-a7fca1dd.js.map → p-830720d8.js.map} +1 -1
- package/dist/lime-elements/{p-ccc605fe.entry.js → p-980242f7.entry.js} +2 -2
- package/package.json +3 -3
- /package/dist/lime-elements/{p-ee74cfff.entry.js.map → p-2972eab9.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-ccc605fe.entry.js.map → p-980242f7.entry.js.map} +0 -0
|
@@ -46,10 +46,14 @@ export async function markdownToHTML(text, options) {
|
|
|
46
46
|
return file.toString();
|
|
47
47
|
}
|
|
48
48
|
function getWhiteList(allowedComponents) {
|
|
49
|
+
var _a, _b;
|
|
49
50
|
const whitelist = Object.assign(Object.assign({}, defaultSchema), { tagNames: [
|
|
50
51
|
...(defaultSchema.tagNames || []),
|
|
51
52
|
...allowedComponents.map((component) => component.tagName),
|
|
52
|
-
], attributes: Object.assign(Object.assign({}, defaultSchema.attributes), { p: [
|
|
53
|
+
], attributes: Object.assign(Object.assign({}, defaultSchema.attributes), { p: [
|
|
54
|
+
...((_a = defaultSchema.attributes.p) !== null && _a !== void 0 ? _a : []),
|
|
55
|
+
['className', 'MsoNormal'],
|
|
56
|
+
], '*': [...((_b = defaultSchema.attributes['*']) !== null && _b !== void 0 ? _b : []), 'style'] }) });
|
|
53
57
|
for (const component of allowedComponents) {
|
|
54
58
|
whitelist.attributes[component.tagName] = component.attributes;
|
|
55
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../src/components/markdown/markdown-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,IAAY,EACZ,OAA+B;;EAE/B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,EAAE;IAC9B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;GACnD;EAED,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE;KACvB,GAAG,CAAC,WAAW,CAAC;KAChB,GAAG,CAAC,SA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AC;QACrC,CAAC,WAAW,EAAE,WAAW,CAAC;OAC7B,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,MAAA,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,EAAE,OAAO,CAAC,MAE/D,CAAC;EAEF,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE;IACvC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;GAClE;EAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkGfm from 'remark-gfm';\nimport rehypeExternalLinks from 'rehype-external-links';\nimport rehypeSanitize, { defaultSchema } from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeRaw from 'rehype-raw';\nimport { visit } from 'unist-util-visit';\nimport { sanitizeStyle } from './sanitize-style';\nimport { Node } from 'unist';\nimport { Schema } from 'rehype-sanitize/lib';\nimport { CustomElement } from '../../global/shared-types/custom-element.types';\n\n/**\n * Takes a string as input and returns a new string\n * where the text has been converted to HTML.\n *\n * If the text is formatted with .md markdown, it will\n * be transformed to HTML.\n *\n * If the text already is in HTML it will be sanitized and\n * \"dangerous\" tags such as <script> will be removed.\n *\n * @param text - The string to convert.\n * @param options - Options for the conversions.\n * @returns The resulting HTML.\n */\nexport async function markdownToHTML(\n text: string,\n options?: markdownToHTMLOptions,\n): Promise<string> {\n if (options?.forceHardLineBreaks) {\n text = text.replace(/(?<!\\\\)([\\n\\r])/g, ' $1');\n }\n\n const file = await unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeExternalLinks, { target: '_blank' })\n .use(rehypeRaw)\n .use(rehypeSanitize, {\n ...getWhiteList(options?.whitelist ?? []),\n })\n .use(() => {\n return (tree: Node) => {\n // Run the sanitizeStyle function on all elements, to sanitize\n // the value of the `style` attribute, if there is one.\n visit(tree, 'element', sanitizeStyle);\n };\n })\n .use(rehypeStringify)\n .process(text);\n\n return file.toString();\n}\n\nfunction getWhiteList(allowedComponents: CustomElement[]): Schema {\n const whitelist: Schema = {\n ...defaultSchema,\n tagNames: [\n ...(defaultSchema.tagNames || []),\n ...allowedComponents.map((component) => component.tagName),\n ],\n attributes: {\n ...defaultSchema.attributes,\n p: [\n ...(defaultSchema.attributes.p ?? []),\n ['className', 'MsoNormal'],\n ], // Allow the class 'MsoNormal' on <p> elements\n '*': [...(defaultSchema.attributes['*'] ?? []), 'style'], // Allow `style` attribute on all elements\n },\n };\n\n for (const component of allowedComponents) {\n whitelist.attributes[component.tagName] = component.attributes;\n }\n\n return whitelist;\n}\n\n/**\n * Options for markdownToHTML.\n */\nexport interface markdownToHTMLOptions {\n /**\n * Set to `true` to convert all soft line breaks to hard line breaks.\n */\n forceHardLineBreaks?: boolean;\n whitelist?: CustomElement[];\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-6156b4fd.js';
|
|
2
|
-
import { m as markdownToHTML } from './markdown-parser-
|
|
2
|
+
import { m as markdownToHTML } from './markdown-parser-745c1e6c.js';
|
|
3
3
|
import './_commonjsHelpers-5ec8f9b7.js';
|
|
4
4
|
|
|
5
5
|
const markdownCss = "@charset \"UTF-8\";code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem;overflow:auto;white-space:pre-wrap}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:0.875rem}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:\"\";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0;border:1px solid rgb(var(--contrast-400))}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:0.875rem}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:0.875rem;margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}hr{border-top:1px solid rgb(var(--contrast-700))}img{max-width:100%}.MsoNormal{margin:0}";
|
|
@@ -5,7 +5,7 @@ import { k as keysIn, b as getSymbolsIn, g as getPrototype, a as getAllKeysIn }
|
|
|
5
5
|
import { i as isObject$1, r as root, S as Symbol } from './isObject-c74e273c.js';
|
|
6
6
|
import { i as isArray } from './isArray-80298bc7.js';
|
|
7
7
|
import { i as isObjectLike } from './isObjectLike-38996507.js';
|
|
8
|
-
import { d as decodeHTML, m as markdownToHTML } from './markdown-parser-
|
|
8
|
+
import { d as decodeHTML, m as markdownToHTML } from './markdown-parser-745c1e6c.js';
|
|
9
9
|
import { t as translate$1 } from './translations-d6a1fb0b.js';
|
|
10
10
|
import { c as createRandomString } from './random-string-812b1c35.js';
|
|
11
11
|
import { i as isItem } from './isItem-b0459122.js';
|
|
@@ -44169,10 +44169,14 @@ async function markdownToHTML(text, options) {
|
|
|
44169
44169
|
return file.toString();
|
|
44170
44170
|
}
|
|
44171
44171
|
function getWhiteList(allowedComponents) {
|
|
44172
|
+
var _a, _b;
|
|
44172
44173
|
const whitelist = Object.assign(Object.assign({}, defaultSchema), { tagNames: [
|
|
44173
44174
|
...(defaultSchema.tagNames || []),
|
|
44174
44175
|
...allowedComponents.map((component) => component.tagName),
|
|
44175
|
-
], attributes: Object.assign(Object.assign({}, defaultSchema.attributes), { p: [
|
|
44176
|
+
], attributes: Object.assign(Object.assign({}, defaultSchema.attributes), { p: [
|
|
44177
|
+
...((_a = defaultSchema.attributes.p) !== null && _a !== void 0 ? _a : []),
|
|
44178
|
+
['className', 'MsoNormal'],
|
|
44179
|
+
], '*': [...((_b = defaultSchema.attributes['*']) !== null && _b !== void 0 ? _b : []), 'style'] }) });
|
|
44176
44180
|
for (const component of allowedComponents) {
|
|
44177
44181
|
whitelist.attributes[component.tagName] = component.attributes;
|
|
44178
44182
|
}
|
|
@@ -44181,4 +44185,4 @@ function getWhiteList(allowedComponents) {
|
|
|
44181
44185
|
|
|
44182
44186
|
export { decodeHTML as d, markdownToHTML as m };
|
|
44183
44187
|
|
|
44184
|
-
//# sourceMappingURL=markdown-parser-
|
|
44188
|
+
//# sourceMappingURL=markdown-parser-745c1e6c.js.map
|