@flamingo-stack/openframe-frontend-core 0.0.747 → 0.0.748
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/dist/{chunk-TYW7NBP7.cjs → chunk-46EIXJFC.cjs} +9 -9
- package/dist/{chunk-PIQRV4EQ.cjs → chunk-4AZHFLOM.cjs} +3 -3
- package/dist/{chunk-R3FXJXSQ.cjs → chunk-6XP6RNFD.cjs} +273 -273
- package/dist/{chunk-4DT5YXTM.cjs → chunk-7Y3VMMJB.cjs} +7 -7
- package/dist/{chunk-7Y5U3Y4S.cjs → chunk-BBTSJYTR.cjs} +38 -33
- package/dist/{chunk-FCQCEQBY.cjs → chunk-D4XZL27V.cjs} +4 -4
- package/dist/{chunk-2CEQGGRN.cjs → chunk-EH3LOWGY.cjs} +17 -17
- package/dist/{chunk-O6QQ44I3.cjs → chunk-G2ELX3DG.cjs} +11 -11
- package/dist/{chunk-LLAKQT3B.cjs → chunk-GE4PCDNZ.cjs} +6 -6
- package/dist/{chunk-WY4FKKCV.cjs → chunk-H34A2765.cjs} +37 -37
- package/dist/{chunk-IJA3OZWF.cjs → chunk-JNBOQ7F2.cjs} +9 -9
- package/dist/{chunk-JPSMPXCH.cjs → chunk-JOPFX3PJ.cjs} +66 -66
- package/dist/{chunk-6RTHHU3S.cjs → chunk-OZUJYBQ2.cjs} +4 -4
- package/dist/{chunk-MA7T36JY.cjs → chunk-TRXCQADV.cjs} +33 -33
- package/dist/{chunk-HTMHDEIV.cjs → chunk-UNR74CAC.cjs} +4 -4
- package/dist/{chunk-4AWI6CCU.cjs → chunk-YKJQM2O6.cjs} +25 -25
- package/dist/{chunk-C7NTL2GV.cjs → chunk-ZNUSYMH7.cjs} +15 -15
- package/dist/{cloud-tenants-QJZIF2JS.cjs → cloud-tenants-V5727B7F.cjs} +4 -4
- package/dist/components/case-studies/index.cjs +14 -14
- package/dist/components/chat/index.cjs +3 -3
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/faq/index.cjs +6 -6
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/help-center-pages/index.cjs +74 -74
- package/dist/components/index.cjs +37 -37
- package/dist/components/meeting-scheduler/index.cjs +22 -22
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.cjs +6 -6
- package/dist/components/product-demo/index.cjs +7 -7
- package/dist/components/tickets/index.cjs +9 -9
- package/dist/components/ui/index.cjs +4 -4
- package/dist/{devices-V55KQCAL.cjs → devices-WWMXIIHI.cjs} +5 -5
- package/dist/{embeddable-chat-5CDR4I6E.cjs → embeddable-chat-IJHCGQ24.cjs} +64 -64
- package/dist/index.cjs +8 -8
- package/dist/{knowledge-S3VGDRKR.cjs → knowledge-JZP4RIXB.cjs} +5 -5
- package/dist/{logs-K5E2BGZE.cjs → logs-WIRYFNUC.cjs} +12 -12
- package/dist/{policies-BWU4FRFE.cjs → policies-X7OJYA7G.cjs} +8 -8
- package/dist/{scripts-25UPGXZU.cjs → scripts-GRMT2NGW.cjs} +9 -9
- package/dist/{software-update-F6UC7ULZ.cjs → software-update-G3QOB7RT.cjs} +7 -7
- package/dist/utils/index.cjs +49 -48
- package/dist/utils/markdown-to-plain.d.ts.map +1 -1
- package/dist/utils/markdown-to-plain.js +12 -7
- package/package.json +7 -2
- package/src/utils/markdown-to-plain.ts +25 -16
|
@@ -3,23 +3,32 @@
|
|
|
3
3
|
* (article-body echo in JSON-LD) and chat entity-card preview (clamped previews
|
|
4
4
|
* inside chat cards).
|
|
5
5
|
*
|
|
6
|
-
* The text is what a reader of the rendered page reads: the markdown
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The text is what a reader of the rendered page reads: the markdown goes through the SAME steps
|
|
7
|
+
* the renderer's pipeline runs (`components/ui/markdown/engine.tsx`: remark with GFM and line
|
|
8
|
+
* breaks, then rehype with raw HTML), and the result is the `innerText` of that HTML
|
|
9
9
|
* (`hast-util-to-text`). So link, emphasis and heading syntax, raw HTML tags (`<a rel>`, `<div>`),
|
|
10
10
|
* escapes (`\<`) and entities (`&`) all come out as their text; script and style content and
|
|
11
11
|
* comments do not. Code blocks and images are left out: their content is not prose.
|
|
12
12
|
*
|
|
13
|
+
* The steps are unified's UTILITY functions, the ones those plugins wrap (`mdast-util-from-markdown`
|
|
14
|
+
* with the GFM extensions, `mdast-util-newline-to-break`, `mdast-util-to-hast`, `hast-util-raw`),
|
|
15
|
+
* not a `remark()` processor. This module is in the CommonJS builds, and a unified processor is a
|
|
16
|
+
* callable object without `Function.prototype`: the bundler compiles a call to an imported
|
|
17
|
+
* function as `.call(void 0)`, which a processor does not have (0.0.745 crashed on load:
|
|
18
|
+
* `_remark.remark.call is not a function`). Plain functions have no such limit, and one
|
|
19
|
+
* synchronous conversion needs no plugin system.
|
|
20
|
+
*
|
|
13
21
|
* The two consumers differ only in whitespace — `mode: 'article'` keeps paragraph breaks;
|
|
14
22
|
* `mode: 'preview'` collapses everything to a single line.
|
|
15
23
|
*/
|
|
16
24
|
import type { Element, Root } from 'hast';
|
|
25
|
+
import { raw } from 'hast-util-raw';
|
|
17
26
|
import { toText } from 'hast-util-to-text';
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
27
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
28
|
+
import { gfmFromMarkdown } from 'mdast-util-gfm';
|
|
29
|
+
import { newlineToBreak } from 'mdast-util-newline-to-break';
|
|
30
|
+
import { toHast } from 'mdast-util-to-hast';
|
|
31
|
+
import { gfm } from 'micromark-extension-gfm';
|
|
23
32
|
import { SKIP, visit } from 'unist-util-visit';
|
|
24
33
|
|
|
25
34
|
export interface MarkdownToPlainOptions {
|
|
@@ -47,20 +56,20 @@ export function stripInlineMarkdown(s: string): string {
|
|
|
47
56
|
.replace(/`([^`]+)`/g, '$1'); // `inline code` → inline code
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
// The renderer's own pipeline, up to the HTML tree. Built once; `runSync` has no async plugins.
|
|
51
|
-
const toHtmlTree = remark()
|
|
52
|
-
.use(remarkGfm)
|
|
53
|
-
.use(remarkBreaks)
|
|
54
|
-
.use(remarkRehype, { allowDangerousHtml: true })
|
|
55
|
-
.use(rehypeRaw);
|
|
56
|
-
|
|
57
59
|
/** Elements whose content is not prose: code blocks and images. */
|
|
58
60
|
const NOT_PROSE = new Set(['pre', 'img']);
|
|
59
61
|
|
|
60
62
|
const TABLE_SECTIONS = new Set(['thead', 'tbody', 'tfoot']);
|
|
61
63
|
|
|
64
|
+
/** The renderer's steps, as functions: markdown (GFM) → line breaks → HTML tree with raw HTML parsed. */
|
|
65
|
+
function htmlTree(markdown: string): Root {
|
|
66
|
+
const mdast = fromMarkdown(markdown, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] });
|
|
67
|
+
newlineToBreak(mdast);
|
|
68
|
+
return raw(toHast(mdast, { allowDangerousHtml: true })) as Root;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
function proseTree(markdown: string): Root {
|
|
63
|
-
const tree
|
|
72
|
+
const tree = htmlTree(markdown);
|
|
64
73
|
visit(tree, 'element', (node: Element, index, parent) => {
|
|
65
74
|
if (NOT_PROSE.has(node.tagName) && parent && index !== undefined) {
|
|
66
75
|
parent.children.splice(index, 1);
|