vue-stream-markdown 0.0.0-alpha.0 → 0.1.1
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/README.md +18 -19
- package/dist/button-Bz0s_F3s.js +5 -0
- package/dist/{button-D8xx1WIP.js → button-dU2iYZBS.js} +1 -1
- package/dist/{code-CP6mPwkq.js → code-BfJ58lYO.js} +7 -7
- package/dist/code-block-BFUXyGQH.js +9 -0
- package/dist/{code-block-D2zjJAww.css → code-block-Bv8s2E8I.css} +5 -0
- package/dist/{code-block-C4D_QNTq.js → code-block-CZHD64ft.js} +5 -5
- package/dist/{composables-qhB1h_ed.js → composables-BwAY_BDJ.js} +124 -31
- package/dist/dropdown-RWgcV-8w.js +5 -0
- package/dist/error-component-CR9t-T1D.js +4 -0
- package/dist/{error-component-CzarUjhh.js → error-component-CiIR_1Cg.js} +1 -1
- package/dist/{image-heJSlrNv.js → image-BporCeem.js} +53 -49
- package/dist/index.d.ts +47 -33
- package/dist/index.js +23 -323
- package/dist/{inline-math-B4XO1wMP.js → inline-math-BfG4600m.js} +2 -2
- package/dist/{link-DOtoFtxu.js → link-D-OnakwP.js} +2 -2
- package/dist/{math-Byka28HI.js → math-CvKkCYb9.js} +2 -2
- package/dist/{mermaid-X0AFRzfF.js → mermaid-FgnWaZtT.js} +16 -8
- package/dist/{previewers-Drlf7IQF.js → previewers-CoU4RlpQ.js} +1 -1
- package/dist/{segmented-BEtO1eyl.js → segmented-Baxxk3UJ.js} +1 -1
- package/dist/segmented-C0uEAYuJ.js +6 -0
- package/dist/{shiki-vToM7Pz1.js → shiki-BHOZKGKS.js} +1 -1
- package/dist/{table-DjkiVd9L.js → table-B__TdLr7.js} +9 -4
- package/dist/{tooltip-RiXixMIt.js → tooltip-CA6Kp7Ek.js} +1 -1
- package/dist/tooltip-DoIUaZgq.js +4 -0
- package/dist/zoom-container-BPbftW_I.js +6 -0
- package/dist/{zoom-container-BfUO3Ocp.js → zoom-container-Dlqv-z-t.js} +2 -2
- package/package.json +15 -11
- package/dist/button-BClRCjnc.js +0 -5
- package/dist/code-block-Dzw63Lki.js +0 -9
- package/dist/dropdown-Ca_PKF_d.js +0 -5
- package/dist/error-component-CLEJmPmM.js +0 -4
- package/dist/segmented-CWoQcX-H.js +0 -6
- package/dist/tooltip-Ac_2x9ps.js +0 -4
- package/dist/zoom-container-BDEP09K9.js +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Component, MaybeRef } from "vue";
|
|
1
|
+
import * as vue12 from "vue";
|
|
2
|
+
import { Component, MaybeRef, MaybeRefOrGetter } from "vue";
|
|
3
3
|
import "tippy.js/dist/tippy.css";
|
|
4
4
|
import "tippy.js/themes/light.css";
|
|
5
5
|
import "tippy.js/dist/border.css";
|
|
@@ -7,6 +7,7 @@ import "tippy.js/dist/svg-arrow.css";
|
|
|
7
7
|
import { Zoom } from "medium-zoom";
|
|
8
8
|
import { MarkdownItAsync } from "markdown-it-async";
|
|
9
9
|
import { KatexOptions as KatexOptions$1 } from "katex";
|
|
10
|
+
import remend from "remend";
|
|
10
11
|
import "medium-zoom/dist/style.css";
|
|
11
12
|
import { BuiltinLanguage, BuiltinTheme, BundledLanguage, BundledTheme, CodeToTokensOptions, Highlighter, SpecialLanguage, TokensResult } from "shiki";
|
|
12
13
|
import { Mermaid, MermaidConfig } from "mermaid";
|
|
@@ -169,13 +170,13 @@ type CodeControlsConfig = boolean | {
|
|
|
169
170
|
copy?: boolean;
|
|
170
171
|
download?: boolean;
|
|
171
172
|
fullscreen?: boolean;
|
|
172
|
-
lineNumbers?: boolean;
|
|
173
173
|
};
|
|
174
174
|
type ImageControlsConfig = boolean | {
|
|
175
175
|
download?: boolean;
|
|
176
176
|
};
|
|
177
|
+
type ZoomControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
177
178
|
type ZoomControlsConfig = boolean | {
|
|
178
|
-
position?:
|
|
179
|
+
position?: ZoomControlPosition;
|
|
179
180
|
};
|
|
180
181
|
type ControlsConfig = boolean | {
|
|
181
182
|
table?: boolean | TableControlsConfig;
|
|
@@ -358,7 +359,7 @@ declare function useContext(): {
|
|
|
358
359
|
context: Context;
|
|
359
360
|
provideContext: (ctx: Partial<Context>) => void;
|
|
360
361
|
injectContext: () => Context;
|
|
361
|
-
isDark:
|
|
362
|
+
isDark: vue12.ComputedRef<boolean>;
|
|
362
363
|
readonly getContainer: () => HTMLElement | undefined;
|
|
363
364
|
readonly onCopied: (content: string) => void;
|
|
364
365
|
};
|
|
@@ -369,6 +370,7 @@ interface UseControlsOptions {
|
|
|
369
370
|
}
|
|
370
371
|
declare function useControls(options: UseControlsOptions): {
|
|
371
372
|
isControlEnabled: (key: string) => boolean;
|
|
373
|
+
getControlValue: <T = any>(key: string) => T | undefined;
|
|
372
374
|
};
|
|
373
375
|
//#endregion
|
|
374
376
|
//#region src/composables/use-harden-sanitizers.d.ts
|
|
@@ -379,15 +381,12 @@ interface UseHardenSanitizersOptions {
|
|
|
379
381
|
isImage?: MaybeRef<boolean | undefined>;
|
|
380
382
|
}
|
|
381
383
|
declare function useHardenSanitizers(options: UseHardenSanitizersOptions): {
|
|
382
|
-
hardenOptions:
|
|
384
|
+
hardenOptions: vue12.ComputedRef<HardenOptions>;
|
|
383
385
|
transformHardenUrl: (url: string) => string | null;
|
|
384
|
-
transformedUrl:
|
|
385
|
-
isHardenUrl:
|
|
386
|
+
transformedUrl: vue12.ComputedRef<string | null>;
|
|
387
|
+
isHardenUrl: vue12.ComputedRef<boolean>;
|
|
386
388
|
};
|
|
387
389
|
//#endregion
|
|
388
|
-
//#region src/composables/use-hsl-theme.d.ts
|
|
389
|
-
declare function useHslTheme(): void;
|
|
390
|
-
//#endregion
|
|
391
390
|
//#region src/composables/use-i18n.d.ts
|
|
392
391
|
declare function useI18n(): {
|
|
393
392
|
t: (key: string) => string;
|
|
@@ -395,7 +394,7 @@ declare function useI18n(): {
|
|
|
395
394
|
//#endregion
|
|
396
395
|
//#region src/composables/use-katex.d.ts
|
|
397
396
|
declare function useKatex(): {
|
|
398
|
-
installed:
|
|
397
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
399
398
|
render: (code: string, options?: KatexOptions$1) => Promise<{
|
|
400
399
|
html?: string;
|
|
401
400
|
error?: string;
|
|
@@ -411,9 +410,9 @@ interface UseMathRendererOptions {
|
|
|
411
410
|
throttle?: MaybeRef<number>;
|
|
412
411
|
}
|
|
413
412
|
declare function useMathRenderer(options: UseMathRendererOptions): {
|
|
414
|
-
html:
|
|
415
|
-
error:
|
|
416
|
-
errorMessage:
|
|
413
|
+
html: vue12.Ref<string, string>;
|
|
414
|
+
error: vue12.ComputedRef<boolean>;
|
|
415
|
+
errorMessage: vue12.Ref<string, string>;
|
|
417
416
|
};
|
|
418
417
|
//#endregion
|
|
419
418
|
//#region src/composables/use-mermaid.d.ts
|
|
@@ -422,7 +421,7 @@ interface UseMermaidOptions {
|
|
|
422
421
|
isDark?: MaybeRef<boolean>;
|
|
423
422
|
}
|
|
424
423
|
declare function useMermaid(options?: UseMermaidOptions): {
|
|
425
|
-
installed:
|
|
424
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
426
425
|
getMermaid: () => Promise<Mermaid>;
|
|
427
426
|
parseMermaid: (code: string) => Promise<boolean>;
|
|
428
427
|
renderMermaid: (code: string) => Promise<string | null>;
|
|
@@ -438,13 +437,28 @@ interface UseShikiOptions {
|
|
|
438
437
|
isDark?: MaybeRef<boolean>;
|
|
439
438
|
}
|
|
440
439
|
declare function useShiki(options?: UseShikiOptions): {
|
|
441
|
-
installed:
|
|
440
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
442
441
|
getHighlighter: () => Promise<Highlighter>;
|
|
443
442
|
codeToTokens: (code: string) => Promise<TokensResult>;
|
|
444
443
|
preload: () => Promise<void>;
|
|
445
444
|
dispose: () => void;
|
|
446
445
|
};
|
|
447
446
|
//#endregion
|
|
447
|
+
//#region src/composables/use-tailwind-v3-theme.d.ts
|
|
448
|
+
interface UseTailwindV3ThemeOptions {
|
|
449
|
+
element?: MaybeRefOrGetter<HTMLElement | undefined>;
|
|
450
|
+
styleScope?: MaybeRef<string>;
|
|
451
|
+
}
|
|
452
|
+
declare function useTailwindV3Theme(options: UseTailwindV3ThemeOptions): {
|
|
453
|
+
element: vue12.ComputedRef<Element | undefined>;
|
|
454
|
+
id: string;
|
|
455
|
+
css: vue12.ShallowRef<string>;
|
|
456
|
+
load: () => void;
|
|
457
|
+
unload: () => void;
|
|
458
|
+
isLoaded: Readonly<vue12.ShallowRef<boolean>>;
|
|
459
|
+
generateCSS: () => void;
|
|
460
|
+
};
|
|
461
|
+
//#endregion
|
|
448
462
|
//#region src/composables/use-tippy.d.ts
|
|
449
463
|
interface UseTippyOptions {
|
|
450
464
|
isDark?: MaybeRef<boolean>;
|
|
@@ -470,11 +484,11 @@ interface ZoomPanState {
|
|
|
470
484
|
translateY: number;
|
|
471
485
|
}
|
|
472
486
|
declare function useZoom(options?: UseZoomOptions): {
|
|
473
|
-
zoom:
|
|
474
|
-
translateX:
|
|
475
|
-
translateY:
|
|
476
|
-
isDragging:
|
|
477
|
-
transformStyle:
|
|
487
|
+
zoom: vue12.Ref<number, number>;
|
|
488
|
+
translateX: vue12.Ref<number, number>;
|
|
489
|
+
translateY: vue12.Ref<number, number>;
|
|
490
|
+
isDragging: vue12.Ref<boolean, boolean>;
|
|
491
|
+
transformStyle: vue12.ComputedRef<{
|
|
478
492
|
transform: string;
|
|
479
493
|
}>;
|
|
480
494
|
zoomIn: () => void;
|
|
@@ -502,30 +516,33 @@ declare const DEFAULT_HARDEN_OPTIONS: HardenOptions;
|
|
|
502
516
|
//#region src/constants/icons.d.ts
|
|
503
517
|
declare const ICONS: Record<string, Component>;
|
|
504
518
|
//#endregion
|
|
519
|
+
//#region src/constants/theme.d.ts
|
|
520
|
+
declare const SHADCN_SCHEMAS: readonly ["background", "foreground", "card", "card-foreground", "popover", "popover-foreground", "primary", "primary-foreground", "secondary", "secondary-foreground", "muted", "muted-foreground", "accent", "accent-foreground", "destructive", "border", "input", "ring", "chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "sidebar", "sidebar-foreground", "sidebar-primary", "sidebar-primary-foreground", "sidebar-accent", "sidebar-accent-foreground", "sidebar-border", "sidebar-ring"];
|
|
521
|
+
//#endregion
|
|
505
522
|
//#region src/index.vue.d.ts
|
|
506
|
-
declare const __VLS_export:
|
|
523
|
+
declare const __VLS_export: vue12.DefineComponent<StreamMarkdownProps, {
|
|
507
524
|
getMarkdownParser: () => MarkdownParser;
|
|
508
525
|
getParsedNodes: () => ParsedNode[];
|
|
509
|
-
}, {}, {}, {},
|
|
526
|
+
}, {}, {}, {}, vue12.ComponentOptionsMixin, vue12.ComponentOptionsMixin, {} & {
|
|
510
527
|
copied: (content: string) => any;
|
|
511
|
-
}, string,
|
|
528
|
+
}, string, vue12.PublicProps, Readonly<StreamMarkdownProps> & Readonly<{
|
|
512
529
|
onCopied?: ((content: string) => any) | undefined;
|
|
513
530
|
}>, {
|
|
514
531
|
mode: "static" | "streaming";
|
|
515
532
|
content: string;
|
|
516
|
-
nodeRenderers: Partial<Record<"blockquote" | "break" | "code" | "definition" | "delete" | "emphasis" | "footnoteDefinition" | "footnoteReference" | "heading" | "html" | "image" | "imageReference" | "inlineCode" | "link" | "linkReference" | "list" | "listItem" | "paragraph" | "strong" | "table" | "tableCell" | "tableRow" | "text" | "thematicBreak" | "yaml" | "inlineMath" | "math",
|
|
533
|
+
nodeRenderers: Partial<Record<"blockquote" | "break" | "code" | "definition" | "delete" | "emphasis" | "footnoteDefinition" | "footnoteReference" | "heading" | "html" | "image" | "imageReference" | "inlineCode" | "link" | "linkReference" | "list" | "listItem" | "paragraph" | "strong" | "table" | "tableCell" | "tableRow" | "text" | "thematicBreak" | "yaml" | "inlineMath" | "math", vue12.Component>>;
|
|
517
534
|
locale: string | LocaleConfig;
|
|
518
535
|
controls: ControlsConfig;
|
|
519
536
|
previewers: PreviewerConfig;
|
|
520
537
|
isDark: boolean;
|
|
521
|
-
}, {}, {}, {}, string,
|
|
538
|
+
}, {}, {}, {}, string, vue12.ComponentProvideOptions, false, {}, any>;
|
|
522
539
|
declare const _default: typeof __VLS_export;
|
|
523
540
|
//#endregion
|
|
524
541
|
//#region src/locales/index.d.ts
|
|
525
542
|
declare const SUPPORT_LANGUAGES: string[];
|
|
526
543
|
declare const localesGlob: Record<string, () => Promise<unknown>>;
|
|
527
|
-
declare const localeMessages:
|
|
528
|
-
declare const currentLocale:
|
|
544
|
+
declare const localeMessages: vue12.Ref<LocaleConfig | undefined, LocaleConfig | undefined>;
|
|
545
|
+
declare const currentLocale: vue12.Ref<string, string>;
|
|
529
546
|
declare function loadLocaleMessages(language: string | LocaleConfig): Promise<void>;
|
|
530
547
|
//#endregion
|
|
531
548
|
//#region src/postprocess/text.d.ts
|
|
@@ -695,9 +712,6 @@ declare function fixTable(content: string): string;
|
|
|
695
712
|
declare function preprocessLaTeX(content: string): string;
|
|
696
713
|
declare function preprocessThinkTag(content: string): string;
|
|
697
714
|
//#endregion
|
|
698
|
-
//#region src/preprocess/vendored/parse-incomplete-markdown.d.ts
|
|
699
|
-
declare function parseIncompleteMarkdown(text: string): string;
|
|
700
|
-
//#endregion
|
|
701
715
|
//#region src/preprocess/pattern.d.ts
|
|
702
716
|
declare const crlfPattern: RegExp;
|
|
703
717
|
declare const trailingBackticksPattern: RegExp;
|
|
@@ -759,4 +773,4 @@ declare function tableDataToTSV(data: TableData): string;
|
|
|
759
773
|
declare function escapeMarkdownTableCell(cell: string): string;
|
|
760
774
|
declare function tableDataToMarkdown(data: TableData): string;
|
|
761
775
|
//#endregion
|
|
762
|
-
export { BlockquoteNode, BlockquoteNodeRendererProps, BreakNode, BreakNodeRendererProps, CODE_PREVIEWERS, COMMON_COMPONENTS, CodeControlsConfig, CodeNode, CodeNodeRendererProps, CodeOptions, ControlsConfig, DEFAULT_DARK_THEME, DEFAULT_HARDEN_OPTIONS, DEFAULT_LIGHT_THEME, DefinitionNode, DefinitionNodeRendererProps, DeleteNode, DeleteNodeRendererProps, EmphasisNode, EmphasisNodeRendererProps, FootnoteDefinitionNode, FootnoteDefinitionNodeRendererProps, FootnoteReferenceNode, FootnoteReferenceNodeRendererProps, HardenOptions, HeadingNode, HeadingNodeRendererProps, HtmlNode, HtmlNodeRendererProps, ICONS, ImageControlsConfig, ImageNode, ImageNodeRendererProps, ImageOptions, ImageReferenceNode, ImageReferenceNodeRendererProps, InlineCodeNode, InlineCodeNodeRendererProps, InlineMathNode, InlineMathNodeRendererProps, KatexOptions, LANGUAGE_ALIAS, LANGUAGE_EXTENSIONS, LANGUAGE_ICONS, LinkNode, LinkNodeRendererProps, LinkReferenceNode, LinkReferenceNodeRendererProps, ListItemNode, ListItemNodeRendererProps, ListNode, ListNodeRendererProps, LocaleConfig, _default as Markdown, MarkdownParser, MarkdownParserOptions, MathNode, MathNodeRendererProps, MdastOptions, MermaidOptions, NODE_RENDERERS, NodeRendererListProps, NodeRendererProps, NodeRenderers, NodeType, Options, ParagraphNode, ParagraphNodeRendererProps, ParsedNode, PreviewerConfig, SUPPORT_LANGUAGES, SelectItem, ShikiOptions, StreamMarkdownContext, StreamMarkdownProps, StrongNode, StrongNodeRendererProps, SyntaxTree, TableCellNode, TableCellNodeRendererProps, TableControlsConfig, TableData, TableNode, TableNodeRendererProps, TableRowNode, TableRowNodeRendererProps, TextNode, TextNodeRendererProps, ThematicBreakNode, ThematicBreakNodeRendererProps, UseMathRendererOptions, UseZoomOptions, YamlNode, YamlNodeRendererProps, ZoomControlsConfig, ZoomPanState, codeBlockPattern, crlfPattern, currentLocale, doubleAsteriskPattern, doubleDollarPattern, doubleTildePattern, doubleUnderscorePattern, escapeMarkdownTableCell, extractTableDataFromElement, findLastLeafNode, findNodeParent, fixCode, fixDelete, fixEmphasis, fixLink, fixStrong, fixTable, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize,
|
|
776
|
+
export { BlockquoteNode, BlockquoteNodeRendererProps, BreakNode, BreakNodeRendererProps, CODE_PREVIEWERS, COMMON_COMPONENTS, CodeControlsConfig, CodeNode, CodeNodeRendererProps, CodeOptions, ControlsConfig, DEFAULT_DARK_THEME, DEFAULT_HARDEN_OPTIONS, DEFAULT_LIGHT_THEME, DefinitionNode, DefinitionNodeRendererProps, DeleteNode, DeleteNodeRendererProps, EmphasisNode, EmphasisNodeRendererProps, FootnoteDefinitionNode, FootnoteDefinitionNodeRendererProps, FootnoteReferenceNode, FootnoteReferenceNodeRendererProps, HardenOptions, HeadingNode, HeadingNodeRendererProps, HtmlNode, HtmlNodeRendererProps, ICONS, ImageControlsConfig, ImageNode, ImageNodeRendererProps, ImageOptions, ImageReferenceNode, ImageReferenceNodeRendererProps, InlineCodeNode, InlineCodeNodeRendererProps, InlineMathNode, InlineMathNodeRendererProps, KatexOptions, LANGUAGE_ALIAS, LANGUAGE_EXTENSIONS, LANGUAGE_ICONS, LinkNode, LinkNodeRendererProps, LinkReferenceNode, LinkReferenceNodeRendererProps, ListItemNode, ListItemNodeRendererProps, ListNode, ListNodeRendererProps, LocaleConfig, _default as Markdown, MarkdownParser, MarkdownParserOptions, MathNode, MathNodeRendererProps, MdastOptions, MermaidOptions, NODE_RENDERERS, NodeRendererListProps, NodeRendererProps, NodeRenderers, NodeType, Options, ParagraphNode, ParagraphNodeRendererProps, ParsedNode, PreviewerConfig, SHADCN_SCHEMAS, SUPPORT_LANGUAGES, SelectItem, ShikiOptions, StreamMarkdownContext, StreamMarkdownProps, StrongNode, StrongNodeRendererProps, SyntaxTree, TableCellNode, TableCellNodeRendererProps, TableControlsConfig, TableData, TableNode, TableNodeRendererProps, TableRowNode, TableRowNodeRendererProps, TextNode, TextNodeRendererProps, ThematicBreakNode, ThematicBreakNodeRendererProps, UseMathRendererOptions, UseZoomOptions, YamlNode, YamlNodeRendererProps, ZoomControlPosition, ZoomControlsConfig, ZoomPanState, codeBlockPattern, crlfPattern, currentLocale, doubleAsteriskPattern, doubleDollarPattern, doubleTildePattern, doubleUnderscorePattern, escapeMarkdownTableCell, extractTableDataFromElement, findLastLeafNode, findNodeParent, fixCode, fixDelete, fixEmphasis, fixLink, fixStrong, fixTable, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize, postFixText, postprocess, preprocess, preprocessLaTeX, preprocessThinkTag, proprocessContent, remend, save, separatorPattern, singleAsteriskPattern, singleBacktickPattern, singleUnderscorePattern, svgToPngBlob, tableDataToCSV, tableDataToMarkdown, tableDataToTSV, tableRowPattern, trailingBackticksPattern, trailingWhitespacePattern, transformUrl, tripleBacktickPattern, useContext, useControls, useHardenSanitizers, useI18n, useKatex, useMathRenderer, useMermaid, useShiki, useTailwindV3Theme, useTippy, useZoom };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as CODE_PREVIEWERS } from "./previewers-
|
|
2
|
-
import { A as transformUrl, C as findNodeParent, D as flow, E as hasShiki, F as
|
|
1
|
+
import { t as CODE_PREVIEWERS } from "./previewers-CoU4RlpQ.js";
|
|
2
|
+
import { A as transformUrl, B as useContext, C as findNodeParent, D as flow, E as hasShiki, F as DEFAULT_LIGHT_THEME, I as LANGUAGE_ALIAS, L as LANGUAGE_EXTENSIONS, M as ICONS, N as DEFAULT_HARDEN_OPTIONS, O as save, P as DEFAULT_DARK_THEME, R as LANGUAGE_ICONS, S as findLastLeafNode, T as hasMermaid, _ as escapeMarkdownTableCell, a as useMermaid, b as tableDataToMarkdown, c as _defineProperty, d as SUPPORT_LANGUAGES, f as currentLocale, g as useHardenSanitizers, h as localesGlob, i as useShiki, j as SHADCN_SCHEMAS, k as svgToPngBlob, l as useKatex, m as localeMessages, n as useTippy, o as useMathRenderer, p as loadLocaleMessages, r as useTailwindV3Theme, t as useZoom, u as useI18n, v as extractTableDataFromElement, w as hasKatex, x as tableDataToTSV, y as tableDataToCSV, z as useControls } from "./composables-BwAY_BDJ.js";
|
|
3
3
|
import { t as node_list_default } from "./node-list-CGr_EVtn.js";
|
|
4
4
|
import { computed, createElementBlock, createVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeClass, onBeforeUnmount, openBlock, ref, toRefs, unref, watch } from "vue";
|
|
5
5
|
import mediumZoom from "medium-zoom";
|
|
6
6
|
import { MarkdownItAsync } from "markdown-it-async";
|
|
7
|
+
import remend from "remend";
|
|
7
8
|
import "medium-zoom/dist/style.css";
|
|
8
9
|
|
|
9
10
|
//#region rolldown:runtime
|
|
@@ -50,20 +51,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
50
51
|
//#region src/components/renderers/index.ts
|
|
51
52
|
const NODE_RENDERERS = {
|
|
52
53
|
blockquote: defineAsyncComponent(() => import("./blockquote-DdEg2gww.js")),
|
|
53
|
-
code: defineAsyncComponent(() => import("./code-
|
|
54
|
+
code: defineAsyncComponent(() => import("./code-BfJ58lYO.js")),
|
|
54
55
|
delete: defineAsyncComponent(() => import("./delete-BdWzKJCy.js")),
|
|
55
56
|
emphasis: defineAsyncComponent(() => import("./emphasis-CTuGt1Ok.js")),
|
|
56
57
|
heading: defineAsyncComponent(() => import("./heading-2vpQQtTH.js")),
|
|
57
|
-
image: defineAsyncComponent(() => import("./image-
|
|
58
|
+
image: defineAsyncComponent(() => import("./image-BporCeem.js")),
|
|
58
59
|
inlineCode: defineAsyncComponent(() => import("./inline-code-CBoqhfz7.js")),
|
|
59
|
-
inlineMath: defineAsyncComponent(() => import("./inline-math-
|
|
60
|
-
link: defineAsyncComponent(() => import("./link-
|
|
60
|
+
inlineMath: defineAsyncComponent(() => import("./inline-math-BfG4600m.js")),
|
|
61
|
+
link: defineAsyncComponent(() => import("./link-D-OnakwP.js")),
|
|
61
62
|
list: defineAsyncComponent(() => import("./list-BCiFKGaz.js")),
|
|
62
63
|
listItem: defineAsyncComponent(() => import("./list-item-p-OLUR_9.js")),
|
|
63
|
-
math: defineAsyncComponent(() => import("./math-
|
|
64
|
+
math: defineAsyncComponent(() => import("./math-CvKkCYb9.js")),
|
|
64
65
|
paragraph: defineAsyncComponent(() => import("./paragraph-DYjqr_Sa.js")),
|
|
65
66
|
strong: defineAsyncComponent(() => import("./strong-CvOjLZiq.js")),
|
|
66
|
-
table: defineAsyncComponent(() => import("./table-
|
|
67
|
+
table: defineAsyncComponent(() => import("./table-B__TdLr7.js")),
|
|
67
68
|
text: defineAsyncComponent(() => import("./text-DuONUqRA.js")),
|
|
68
69
|
thematicBreak: defineAsyncComponent(() => import("./thematic-break-CcNPEI9Y.js")),
|
|
69
70
|
yaml: defineAsyncComponent(() => import("./yaml-DJHrmzSe.js"))
|
|
@@ -72,17 +73,17 @@ const NODE_RENDERERS = {
|
|
|
72
73
|
//#endregion
|
|
73
74
|
//#region src/components/index.ts
|
|
74
75
|
const COMMON_COMPONENTS = {
|
|
75
|
-
Button: defineAsyncComponent(() => import("./button-
|
|
76
|
-
CodeBlock: defineAsyncComponent(() => import("./code-block-
|
|
77
|
-
Dropdown: defineAsyncComponent(() => import("./dropdown-
|
|
78
|
-
ErrorComponent: defineAsyncComponent(() => import("./error-component-
|
|
76
|
+
Button: defineAsyncComponent(() => import("./button-Bz0s_F3s.js")),
|
|
77
|
+
CodeBlock: defineAsyncComponent(() => import("./code-block-BFUXyGQH.js")),
|
|
78
|
+
Dropdown: defineAsyncComponent(() => import("./dropdown-RWgcV-8w.js")),
|
|
79
|
+
ErrorComponent: defineAsyncComponent(() => import("./error-component-CR9t-T1D.js")),
|
|
79
80
|
Modal: defineAsyncComponent(() => import("./modal-DcpxxDDX.js")),
|
|
80
81
|
NodeList: defineAsyncComponent(() => import("./node-list-lgY1wbfQ.js")),
|
|
81
|
-
Segmented: defineAsyncComponent(() => import("./segmented-
|
|
82
|
+
Segmented: defineAsyncComponent(() => import("./segmented-C0uEAYuJ.js")),
|
|
82
83
|
Spin: defineAsyncComponent(() => import("./spin-Bz4zGBEo.js")),
|
|
83
84
|
Table: defineAsyncComponent(() => import("./table-CZLbUHiJ.js")),
|
|
84
|
-
Tooltip: defineAsyncComponent(() => import("./tooltip-
|
|
85
|
-
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-
|
|
85
|
+
Tooltip: defineAsyncComponent(() => import("./tooltip-DoIUaZgq.js")),
|
|
86
|
+
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-BPbftW_I.js"))
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
//#endregion
|
|
@@ -17705,15 +17706,15 @@ function fixDelete(content$2) {
|
|
|
17705
17706
|
const matches = lastParagraph.match(doubleTildePattern);
|
|
17706
17707
|
const count = matches ? matches.length : 0;
|
|
17707
17708
|
if (content$2.endsWith("~") && !content$2.endsWith("~~")) {
|
|
17708
|
-
const
|
|
17709
|
+
const contentWithoutLastTilde = content$2.slice(0, -1);
|
|
17710
|
+
const lastParagraphWithoutTilde = contentWithoutLastTilde.split("\n").slice(paragraphStartIndex).join("\n");
|
|
17709
17711
|
const matchesWithoutTilde = lastParagraphWithoutTilde.match(doubleTildePattern);
|
|
17710
17712
|
if ((matchesWithoutTilde ? matchesWithoutTilde.length : 0) % 2 === 1) {
|
|
17711
17713
|
const lastTildePos = lastParagraphWithoutTilde.lastIndexOf("~~");
|
|
17712
17714
|
if (lastTildePos >= 0) {
|
|
17713
17715
|
if (lastParagraphWithoutTilde.substring(lastTildePos + 2).length > 0) return `${content$2}~`;
|
|
17714
17716
|
}
|
|
17715
|
-
}
|
|
17716
|
-
return content$2;
|
|
17717
|
+
} else return contentWithoutLastTilde;
|
|
17717
17718
|
}
|
|
17718
17719
|
if (count % 2 === 1) {
|
|
17719
17720
|
const lastTildePos = lastParagraph.lastIndexOf("~~");
|
|
@@ -18093,307 +18094,6 @@ function preprocessThinkTag(content$2) {
|
|
|
18093
18094
|
])(content$2);
|
|
18094
18095
|
}
|
|
18095
18096
|
|
|
18096
|
-
//#endregion
|
|
18097
|
-
//#region src/preprocess/vendored/parse-incomplete-markdown.ts
|
|
18098
|
-
const boldPattern = /(\*\*)([^*]*)$/;
|
|
18099
|
-
const italicPattern = /(__)([^_]*)$/;
|
|
18100
|
-
const boldItalicPattern = /(\*\*\*)([^*]*)$/;
|
|
18101
|
-
const singleAsteriskPattern$1 = /(\*)([^*]*)$/;
|
|
18102
|
-
const singleUnderscorePattern$1 = /(_)([^_]*)$/;
|
|
18103
|
-
const inlineCodePattern = /(`)([^`]*)$/;
|
|
18104
|
-
const strikethroughPattern = /(~~)([^~]*)$/;
|
|
18105
|
-
const whitespaceOrMarkersPattern = /^[\s_~*`]*$/;
|
|
18106
|
-
const listItemPattern = /^\s*[-*+]\s+$/;
|
|
18107
|
-
const letterNumberUnderscorePattern = /[\p{L}\p{N}_]/u;
|
|
18108
|
-
const inlineTripleBacktickPattern = /^```[^`\n]*```?$/;
|
|
18109
|
-
const fourOrMoreAsterisksPattern = /^\*{4,}$/;
|
|
18110
|
-
function isWordChar(char) {
|
|
18111
|
-
if (!char) return false;
|
|
18112
|
-
const code$2 = char.charCodeAt(0);
|
|
18113
|
-
if (code$2 >= 48 && code$2 <= 57 || code$2 >= 65 && code$2 <= 90 || code$2 >= 97 && code$2 <= 122 || code$2 === 95) return true;
|
|
18114
|
-
return letterNumberUnderscorePattern.test(char);
|
|
18115
|
-
}
|
|
18116
|
-
function hasCompleteCodeBlock(text$4) {
|
|
18117
|
-
const tripleBackticks = (text$4.match(/```/g) || []).length;
|
|
18118
|
-
return tripleBackticks > 0 && tripleBackticks % 2 === 0 && text$4.includes("\n");
|
|
18119
|
-
}
|
|
18120
|
-
function findMatchingOpeningBracket(text$4, closeIndex) {
|
|
18121
|
-
let depth = 1;
|
|
18122
|
-
for (let i = closeIndex - 1; i >= 0; i -= 1) if (text$4[i] === "]") depth += 1;
|
|
18123
|
-
else if (text$4[i] === "[") {
|
|
18124
|
-
depth -= 1;
|
|
18125
|
-
if (depth === 0) return i;
|
|
18126
|
-
}
|
|
18127
|
-
return -1;
|
|
18128
|
-
}
|
|
18129
|
-
function findMatchingClosingBracket(text$4, openIndex) {
|
|
18130
|
-
let depth = 1;
|
|
18131
|
-
for (let i = openIndex + 1; i < text$4.length; i += 1) if (text$4[i] === "[") depth += 1;
|
|
18132
|
-
else if (text$4[i] === "]") {
|
|
18133
|
-
depth -= 1;
|
|
18134
|
-
if (depth === 0) return i;
|
|
18135
|
-
}
|
|
18136
|
-
return -1;
|
|
18137
|
-
}
|
|
18138
|
-
function isInsideCodeBlock(text$4, position$1) {
|
|
18139
|
-
let inInlineCode = false;
|
|
18140
|
-
let inMultilineCode = false;
|
|
18141
|
-
for (let i = 0; i < position$1; i += 1) {
|
|
18142
|
-
if (text$4.substring(i, i + 3) === "```") {
|
|
18143
|
-
inMultilineCode = !inMultilineCode;
|
|
18144
|
-
i += 2;
|
|
18145
|
-
continue;
|
|
18146
|
-
}
|
|
18147
|
-
if (!inMultilineCode && text$4[i] === "`") inInlineCode = !inInlineCode;
|
|
18148
|
-
}
|
|
18149
|
-
return inInlineCode || inMultilineCode;
|
|
18150
|
-
}
|
|
18151
|
-
function handleIncompleteLinksAndImages(text$4) {
|
|
18152
|
-
const lastParenIndex = text$4.lastIndexOf("](");
|
|
18153
|
-
if (lastParenIndex !== -1 && !isInsideCodeBlock(text$4, lastParenIndex)) {
|
|
18154
|
-
if (!text$4.substring(lastParenIndex + 2).includes(")")) {
|
|
18155
|
-
const openBracketIndex = findMatchingOpeningBracket(text$4, lastParenIndex);
|
|
18156
|
-
if (openBracketIndex !== -1 && !isInsideCodeBlock(text$4, openBracketIndex)) {
|
|
18157
|
-
const isImage = openBracketIndex > 0 && text$4[openBracketIndex - 1] === "!";
|
|
18158
|
-
const startIndex = isImage ? openBracketIndex - 1 : openBracketIndex;
|
|
18159
|
-
const beforeLink = text$4.substring(0, startIndex);
|
|
18160
|
-
const linkText = text$4.substring(openBracketIndex + 1, lastParenIndex);
|
|
18161
|
-
if (isImage) return beforeLink;
|
|
18162
|
-
return `${beforeLink}[${linkText}](streamdown:incomplete-link)`;
|
|
18163
|
-
}
|
|
18164
|
-
}
|
|
18165
|
-
}
|
|
18166
|
-
for (let i = text$4.length - 1; i >= 0; i -= 1) if (text$4[i] === "[" && !isInsideCodeBlock(text$4, i)) {
|
|
18167
|
-
const isImage = i > 0 && text$4[i - 1] === "!";
|
|
18168
|
-
const openIndex = isImage ? i - 1 : i;
|
|
18169
|
-
if (!text$4.substring(i + 1).includes("]")) {
|
|
18170
|
-
const beforeLink = text$4.substring(0, openIndex);
|
|
18171
|
-
if (isImage) return beforeLink;
|
|
18172
|
-
return `${text$4}](streamdown:incomplete-link)`;
|
|
18173
|
-
}
|
|
18174
|
-
if (findMatchingClosingBracket(text$4, i) === -1) {
|
|
18175
|
-
const beforeLink = text$4.substring(0, openIndex);
|
|
18176
|
-
if (isImage) return beforeLink;
|
|
18177
|
-
return `${text$4}](streamdown:incomplete-link)`;
|
|
18178
|
-
}
|
|
18179
|
-
}
|
|
18180
|
-
return text$4;
|
|
18181
|
-
}
|
|
18182
|
-
function handleIncompleteBold(text$4) {
|
|
18183
|
-
if (hasCompleteCodeBlock(text$4)) return text$4;
|
|
18184
|
-
const boldMatch = text$4.match(boldPattern);
|
|
18185
|
-
if (boldMatch) {
|
|
18186
|
-
const contentAfterMarker = boldMatch[2];
|
|
18187
|
-
if (!contentAfterMarker || whitespaceOrMarkersPattern.test(contentAfterMarker)) return text$4;
|
|
18188
|
-
const markerIndex = text$4.lastIndexOf(boldMatch[1]);
|
|
18189
|
-
const lastNewlineBeforeMarker = text$4.substring(0, markerIndex).lastIndexOf("\n");
|
|
18190
|
-
const lineStart = lastNewlineBeforeMarker === -1 ? 0 : lastNewlineBeforeMarker + 1;
|
|
18191
|
-
const lineBeforeMarker = text$4.substring(lineStart, markerIndex);
|
|
18192
|
-
if (listItemPattern.test(lineBeforeMarker)) {
|
|
18193
|
-
if (contentAfterMarker.includes("\n")) return text$4;
|
|
18194
|
-
}
|
|
18195
|
-
if ((text$4.match(/\*\*/g) || []).length % 2 === 1) return `${text$4}**`;
|
|
18196
|
-
}
|
|
18197
|
-
return text$4;
|
|
18198
|
-
}
|
|
18199
|
-
function handleIncompleteDoubleUnderscoreItalic(text$4) {
|
|
18200
|
-
const italicMatch = text$4.match(italicPattern);
|
|
18201
|
-
if (italicMatch) {
|
|
18202
|
-
const contentAfterMarker = italicMatch[2];
|
|
18203
|
-
if (!contentAfterMarker || whitespaceOrMarkersPattern.test(contentAfterMarker)) return text$4;
|
|
18204
|
-
const markerIndex = text$4.lastIndexOf(italicMatch[1]);
|
|
18205
|
-
const lastNewlineBeforeMarker = text$4.substring(0, markerIndex).lastIndexOf("\n");
|
|
18206
|
-
const lineStart = lastNewlineBeforeMarker === -1 ? 0 : lastNewlineBeforeMarker + 1;
|
|
18207
|
-
const lineBeforeMarker = text$4.substring(lineStart, markerIndex);
|
|
18208
|
-
if (listItemPattern.test(lineBeforeMarker)) {
|
|
18209
|
-
if (contentAfterMarker.includes("\n")) return text$4;
|
|
18210
|
-
}
|
|
18211
|
-
if ((text$4.match(/__/g) || []).length % 2 === 1) return `${text$4}__`;
|
|
18212
|
-
}
|
|
18213
|
-
return text$4;
|
|
18214
|
-
}
|
|
18215
|
-
function countSingleAsterisks(text$4) {
|
|
18216
|
-
let count = 0;
|
|
18217
|
-
const len = text$4.length;
|
|
18218
|
-
for (let index$1 = 0; index$1 < len; index$1 += 1) {
|
|
18219
|
-
if (text$4[index$1] !== "*") continue;
|
|
18220
|
-
const prevChar = index$1 > 0 ? text$4[index$1 - 1] : "";
|
|
18221
|
-
const nextChar = index$1 < len - 1 ? text$4[index$1 + 1] : "";
|
|
18222
|
-
if (prevChar === "\\") continue;
|
|
18223
|
-
if (prevChar === "*" || nextChar === "*") continue;
|
|
18224
|
-
if (prevChar && nextChar && isWordChar(prevChar) && isWordChar(nextChar)) continue;
|
|
18225
|
-
let lineStartIndex = 0;
|
|
18226
|
-
for (let i = index$1 - 1; i >= 0; i -= 1) if (text$4[i] === "\n") {
|
|
18227
|
-
lineStartIndex = i + 1;
|
|
18228
|
-
break;
|
|
18229
|
-
}
|
|
18230
|
-
let isListMarker = true;
|
|
18231
|
-
for (let i = lineStartIndex; i < index$1; i += 1) if (text$4[i] !== " " && text$4[i] !== " ") {
|
|
18232
|
-
isListMarker = false;
|
|
18233
|
-
break;
|
|
18234
|
-
}
|
|
18235
|
-
if (isListMarker && (nextChar === " " || nextChar === " ")) continue;
|
|
18236
|
-
count += 1;
|
|
18237
|
-
}
|
|
18238
|
-
return count;
|
|
18239
|
-
}
|
|
18240
|
-
function handleIncompleteSingleAsteriskItalic(text$4) {
|
|
18241
|
-
if (hasCompleteCodeBlock(text$4)) return text$4;
|
|
18242
|
-
if (text$4.match(singleAsteriskPattern$1)) {
|
|
18243
|
-
let firstSingleAsteriskIndex = -1;
|
|
18244
|
-
for (let i = 0; i < text$4.length; i += 1) if (text$4[i] === "*" && text$4[i - 1] !== "*" && text$4[i + 1] !== "*" && text$4[i - 1] !== "\\") {
|
|
18245
|
-
const prevChar = i > 0 ? text$4[i - 1] : "";
|
|
18246
|
-
const nextChar = i < text$4.length - 1 ? text$4[i + 1] : "";
|
|
18247
|
-
if (prevChar && nextChar && isWordChar(prevChar) && isWordChar(nextChar)) continue;
|
|
18248
|
-
firstSingleAsteriskIndex = i;
|
|
18249
|
-
break;
|
|
18250
|
-
}
|
|
18251
|
-
if (firstSingleAsteriskIndex === -1) return text$4;
|
|
18252
|
-
const contentAfterFirstAsterisk = text$4.substring(firstSingleAsteriskIndex + 1);
|
|
18253
|
-
if (!contentAfterFirstAsterisk || whitespaceOrMarkersPattern.test(contentAfterFirstAsterisk)) return text$4;
|
|
18254
|
-
if (countSingleAsterisks(text$4) % 2 === 1) return `${text$4}*`;
|
|
18255
|
-
}
|
|
18256
|
-
return text$4;
|
|
18257
|
-
}
|
|
18258
|
-
function isWithinMathBlock(text$4, position$1) {
|
|
18259
|
-
let inInlineMath = false;
|
|
18260
|
-
let inBlockMath = false;
|
|
18261
|
-
for (let i = 0; i < text$4.length && i < position$1; i += 1) {
|
|
18262
|
-
if (text$4[i] === "\\" && text$4[i + 1] === "$") {
|
|
18263
|
-
i += 1;
|
|
18264
|
-
continue;
|
|
18265
|
-
}
|
|
18266
|
-
if (text$4[i] === "$") {
|
|
18267
|
-
if (text$4[i + 1] === "$") {
|
|
18268
|
-
inBlockMath = !inBlockMath;
|
|
18269
|
-
i += 1;
|
|
18270
|
-
inInlineMath = false;
|
|
18271
|
-
} else if (!inBlockMath) inInlineMath = !inInlineMath;
|
|
18272
|
-
}
|
|
18273
|
-
}
|
|
18274
|
-
return inInlineMath || inBlockMath;
|
|
18275
|
-
}
|
|
18276
|
-
function countSingleUnderscores(text$4) {
|
|
18277
|
-
const hasMathBlocks = text$4.includes("$");
|
|
18278
|
-
let count = 0;
|
|
18279
|
-
const len = text$4.length;
|
|
18280
|
-
for (let index$1 = 0; index$1 < len; index$1 += 1) {
|
|
18281
|
-
if (text$4[index$1] !== "_") continue;
|
|
18282
|
-
const prevChar = index$1 > 0 ? text$4[index$1 - 1] : "";
|
|
18283
|
-
const nextChar = index$1 < len - 1 ? text$4[index$1 + 1] : "";
|
|
18284
|
-
if (prevChar === "\\") continue;
|
|
18285
|
-
if (hasMathBlocks && isWithinMathBlock(text$4, index$1)) continue;
|
|
18286
|
-
if (prevChar === "_" || nextChar === "_") continue;
|
|
18287
|
-
if (prevChar && nextChar && isWordChar(prevChar) && isWordChar(nextChar)) continue;
|
|
18288
|
-
count += 1;
|
|
18289
|
-
}
|
|
18290
|
-
return count;
|
|
18291
|
-
}
|
|
18292
|
-
function handleIncompleteSingleUnderscoreItalic(text$4) {
|
|
18293
|
-
if (hasCompleteCodeBlock(text$4)) return text$4;
|
|
18294
|
-
if (text$4.match(singleUnderscorePattern$1)) {
|
|
18295
|
-
let firstSingleUnderscoreIndex = -1;
|
|
18296
|
-
for (let i = 0; i < text$4.length; i += 1) if (text$4[i] === "_" && text$4[i - 1] !== "_" && text$4[i + 1] !== "_" && text$4[i - 1] !== "\\" && !isWithinMathBlock(text$4, i)) {
|
|
18297
|
-
const prevChar = i > 0 ? text$4[i - 1] : "";
|
|
18298
|
-
const nextChar = i < text$4.length - 1 ? text$4[i + 1] : "";
|
|
18299
|
-
if (prevChar && nextChar && isWordChar(prevChar) && isWordChar(nextChar)) continue;
|
|
18300
|
-
firstSingleUnderscoreIndex = i;
|
|
18301
|
-
break;
|
|
18302
|
-
}
|
|
18303
|
-
if (firstSingleUnderscoreIndex === -1) return text$4;
|
|
18304
|
-
const contentAfterFirstUnderscore = text$4.substring(firstSingleUnderscoreIndex + 1);
|
|
18305
|
-
if (!contentAfterFirstUnderscore || whitespaceOrMarkersPattern.test(contentAfterFirstUnderscore)) return text$4;
|
|
18306
|
-
if (countSingleUnderscores(text$4) % 2 === 1) {
|
|
18307
|
-
let endIndex = text$4.length;
|
|
18308
|
-
while (endIndex > 0 && text$4[endIndex - 1] === "\n") endIndex -= 1;
|
|
18309
|
-
if (endIndex < text$4.length) return `${text$4.slice(0, endIndex)}_${text$4.slice(endIndex)}`;
|
|
18310
|
-
return `${text$4}_`;
|
|
18311
|
-
}
|
|
18312
|
-
}
|
|
18313
|
-
return text$4;
|
|
18314
|
-
}
|
|
18315
|
-
function isPartOfTripleBacktick(text$4, i) {
|
|
18316
|
-
const isTripleStart = text$4.substring(i, i + 3) === "```";
|
|
18317
|
-
const isTripleMiddle = i > 0 && text$4.substring(i - 1, i + 2) === "```";
|
|
18318
|
-
const isTripleEnd = i > 1 && text$4.substring(i - 2, i + 1) === "```";
|
|
18319
|
-
return isTripleStart || isTripleMiddle || isTripleEnd;
|
|
18320
|
-
}
|
|
18321
|
-
function countSingleBackticks(text$4) {
|
|
18322
|
-
let count = 0;
|
|
18323
|
-
for (let i = 0; i < text$4.length; i += 1) if (text$4[i] === "`" && !isPartOfTripleBacktick(text$4, i)) count += 1;
|
|
18324
|
-
return count;
|
|
18325
|
-
}
|
|
18326
|
-
function handleIncompleteInlineCode(text$4) {
|
|
18327
|
-
if (text$4.match(inlineTripleBacktickPattern) && !text$4.includes("\n")) {
|
|
18328
|
-
if (text$4.endsWith("``") && !text$4.endsWith("```")) return `${text$4}\``;
|
|
18329
|
-
return text$4;
|
|
18330
|
-
}
|
|
18331
|
-
const allTripleBackticks = (text$4.match(/```/g) || []).length;
|
|
18332
|
-
const insideIncompleteCodeBlock = allTripleBackticks % 2 === 1;
|
|
18333
|
-
if (allTripleBackticks > 0 && allTripleBackticks % 2 === 0 && text$4.includes("\n")) return text$4;
|
|
18334
|
-
if ((text$4.endsWith("```\n") || text$4.endsWith("```")) && allTripleBackticks % 2 === 0) return text$4;
|
|
18335
|
-
const inlineCodeMatch = text$4.match(inlineCodePattern);
|
|
18336
|
-
if (inlineCodeMatch && !insideIncompleteCodeBlock) {
|
|
18337
|
-
const contentAfterMarker = inlineCodeMatch[2];
|
|
18338
|
-
if (!contentAfterMarker || whitespaceOrMarkersPattern.test(contentAfterMarker)) return text$4;
|
|
18339
|
-
if (countSingleBackticks(text$4) % 2 === 1) return `${text$4}\``;
|
|
18340
|
-
}
|
|
18341
|
-
return text$4;
|
|
18342
|
-
}
|
|
18343
|
-
function handleIncompleteStrikethrough(text$4) {
|
|
18344
|
-
const strikethroughMatch = text$4.match(strikethroughPattern);
|
|
18345
|
-
if (strikethroughMatch) {
|
|
18346
|
-
const contentAfterMarker = strikethroughMatch[2];
|
|
18347
|
-
if (!contentAfterMarker || whitespaceOrMarkersPattern.test(contentAfterMarker)) return text$4;
|
|
18348
|
-
if ((text$4.match(/~~/g) || []).length % 2 === 1) return `${text$4}~~`;
|
|
18349
|
-
}
|
|
18350
|
-
return text$4;
|
|
18351
|
-
}
|
|
18352
|
-
function handleIncompleteBlockKatex(text$4) {
|
|
18353
|
-
if ((text$4.match(/\$\$/g) || []).length % 2 === 0) return text$4;
|
|
18354
|
-
const firstDollarIndex = text$4.indexOf("$$");
|
|
18355
|
-
if (firstDollarIndex !== -1 && text$4.includes("\n", firstDollarIndex) && !text$4.endsWith("\n")) return `${text$4}\n$$`;
|
|
18356
|
-
return `${text$4}$$`;
|
|
18357
|
-
}
|
|
18358
|
-
function countTripleAsterisks(text$4) {
|
|
18359
|
-
let count = 0;
|
|
18360
|
-
let consecutiveAsterisks = 0;
|
|
18361
|
-
for (let i = 0; i < text$4.length; i += 1) if (text$4[i] === "*") consecutiveAsterisks += 1;
|
|
18362
|
-
else {
|
|
18363
|
-
if (consecutiveAsterisks >= 3) count += Math.floor(consecutiveAsterisks / 3);
|
|
18364
|
-
consecutiveAsterisks = 0;
|
|
18365
|
-
}
|
|
18366
|
-
if (consecutiveAsterisks >= 3) count += Math.floor(consecutiveAsterisks / 3);
|
|
18367
|
-
return count;
|
|
18368
|
-
}
|
|
18369
|
-
function handleIncompleteBoldItalic(text$4) {
|
|
18370
|
-
if (hasCompleteCodeBlock(text$4)) return text$4;
|
|
18371
|
-
if (fourOrMoreAsterisksPattern.test(text$4)) return text$4;
|
|
18372
|
-
const boldItalicMatch = text$4.match(boldItalicPattern);
|
|
18373
|
-
if (boldItalicMatch) {
|
|
18374
|
-
const contentAfterMarker = boldItalicMatch[2];
|
|
18375
|
-
if (!contentAfterMarker || whitespaceOrMarkersPattern.test(contentAfterMarker)) return text$4;
|
|
18376
|
-
if (countTripleAsterisks(text$4) % 2 === 1) return `${text$4}***`;
|
|
18377
|
-
}
|
|
18378
|
-
return text$4;
|
|
18379
|
-
}
|
|
18380
|
-
function parseIncompleteMarkdown(text$4) {
|
|
18381
|
-
if (!text$4 || typeof text$4 !== "string") return text$4;
|
|
18382
|
-
let result = text$4;
|
|
18383
|
-
const processedResult = handleIncompleteLinksAndImages(result);
|
|
18384
|
-
if (processedResult.endsWith("](streamdown:incomplete-link)")) return processedResult;
|
|
18385
|
-
result = processedResult;
|
|
18386
|
-
result = handleIncompleteBoldItalic(result);
|
|
18387
|
-
result = handleIncompleteBold(result);
|
|
18388
|
-
result = handleIncompleteDoubleUnderscoreItalic(result);
|
|
18389
|
-
result = handleIncompleteSingleAsteriskItalic(result);
|
|
18390
|
-
result = handleIncompleteSingleUnderscoreItalic(result);
|
|
18391
|
-
result = handleIncompleteInlineCode(result);
|
|
18392
|
-
result = handleIncompleteStrikethrough(result);
|
|
18393
|
-
result = handleIncompleteBlockKatex(result);
|
|
18394
|
-
return result;
|
|
18395
|
-
}
|
|
18396
|
-
|
|
18397
18097
|
//#endregion
|
|
18398
18098
|
//#region src/preprocess/index.ts
|
|
18399
18099
|
function proprocessContent(content$2) {
|
|
@@ -18415,7 +18115,7 @@ function preprocess(content$2) {
|
|
|
18415
18115
|
fixCode,
|
|
18416
18116
|
fixTable,
|
|
18417
18117
|
fixInlineMath,
|
|
18418
|
-
|
|
18118
|
+
remend
|
|
18419
18119
|
])(content$2);
|
|
18420
18120
|
}
|
|
18421
18121
|
|
|
@@ -18593,11 +18293,11 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
18593
18293
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18594
18294
|
const props = __props;
|
|
18595
18295
|
const emits = __emit;
|
|
18596
|
-
const { provideContext } = useContext();
|
|
18597
18296
|
const { isDark } = toRefs(props);
|
|
18598
18297
|
const containerRef = ref();
|
|
18599
|
-
const
|
|
18298
|
+
const { provideContext } = useContext();
|
|
18600
18299
|
const { initTippy } = useTippy({ isDark });
|
|
18300
|
+
const zoom = mediumZoom("[data-zoomable]", { background: "color-mix(in oklab, var(--background) 80%, transparent)" });
|
|
18601
18301
|
const markdownParser = new MarkdownParser({
|
|
18602
18302
|
mode: props.mode,
|
|
18603
18303
|
mdastOptions: props.mdastOptions,
|
|
@@ -18671,4 +18371,4 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
18671
18371
|
var src_default = index_vue_vue_type_script_setup_true_lang_default;
|
|
18672
18372
|
|
|
18673
18373
|
//#endregion
|
|
18674
|
-
export { CODE_PREVIEWERS, COMMON_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_HARDEN_OPTIONS, DEFAULT_LIGHT_THEME, ICONS, LANGUAGE_ALIAS, LANGUAGE_EXTENSIONS, LANGUAGE_ICONS, src_default as Markdown, MarkdownParser, NODE_RENDERERS, SUPPORT_LANGUAGES, codeBlockPattern, crlfPattern, currentLocale, doubleAsteriskPattern, doubleDollarPattern, doubleTildePattern, doubleUnderscorePattern, escapeMarkdownTableCell, extractTableDataFromElement, findLastLeafNode, findNodeParent, fixCode, fixDelete, fixEmphasis, fixLink, fixStrong, fixTable, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize,
|
|
18374
|
+
export { CODE_PREVIEWERS, COMMON_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_HARDEN_OPTIONS, DEFAULT_LIGHT_THEME, ICONS, LANGUAGE_ALIAS, LANGUAGE_EXTENSIONS, LANGUAGE_ICONS, src_default as Markdown, MarkdownParser, NODE_RENDERERS, SHADCN_SCHEMAS, SUPPORT_LANGUAGES, codeBlockPattern, crlfPattern, currentLocale, doubleAsteriskPattern, doubleDollarPattern, doubleTildePattern, doubleUnderscorePattern, escapeMarkdownTableCell, extractTableDataFromElement, findLastLeafNode, findNodeParent, fixCode, fixDelete, fixEmphasis, fixLink, fixStrong, fixTable, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize, postFixText, postprocess, preprocess, preprocessLaTeX, preprocessThinkTag, proprocessContent, remend, save, separatorPattern, singleAsteriskPattern, singleBacktickPattern, singleUnderscorePattern, svgToPngBlob, tableDataToCSV, tableDataToMarkdown, tableDataToTSV, tableRowPattern, trailingBackticksPattern, trailingWhitespacePattern, transformUrl, tripleBacktickPattern, useContext, useControls, useHardenSanitizers, useI18n, useKatex, useMathRenderer, useMermaid, useShiki, useTailwindV3Theme, useTippy, useZoom };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as error_component_default } from "./error-component-
|
|
1
|
+
import { o as useMathRenderer } from "./composables-BwAY_BDJ.js";
|
|
2
|
+
import { t as error_component_default } from "./error-component-CiIR_1Cg.js";
|
|
3
3
|
import { Transition, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, resolveDynamicComponent, toRefs, unref, withCtx } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/inline-math.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as useHardenSanitizers } from "./composables-
|
|
1
|
+
import { g as useHardenSanitizers } from "./composables-BwAY_BDJ.js";
|
|
2
2
|
import { t as node_list_default } from "./node-list-CGr_EVtn.js";
|
|
3
|
-
import { t as error_component_default } from "./error-component-
|
|
3
|
+
import { t as error_component_default } from "./error-component-CiIR_1Cg.js";
|
|
4
4
|
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, openBlock, resolveDynamicComponent, toRefs, unref, withCtx } from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/components/renderers/link.vue?vue&type=script&setup=true&lang.ts
|