vue-stream-markdown 0.1.2 → 0.1.3
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 +8 -0
- package/dist/button-2wMU7qkH.js +5 -0
- package/dist/{button-vKhxUL3C.js → button-CJyeXWq2.js} +1 -1
- package/dist/{code-_dL6Qk0F.js → code-CJ4tMt6L.js} +8 -8
- package/dist/code-block-BucFZooo.js +9 -0
- package/dist/{code-block-wYeMwBck.js → code-block-CQ4lgva1.js} +13 -17
- package/dist/{composables-CZ7YmjNl.js → composables-Cj6_jbwr.js} +48 -17
- package/dist/dropdown-dsCfq0Hl.js +5 -0
- package/dist/error-component-B0mmLhh6.js +4 -0
- package/dist/{error-component-ChEpOmSX.js → error-component-ClGLfmwy.js} +1 -1
- package/dist/{image-DB-4Sv8R.js → image-xeiC5YFM.js} +4 -4
- package/dist/index.css +58 -73
- package/dist/index.d.ts +58 -28
- package/dist/index.js +63 -17
- package/dist/{inline-math-rChhv_1j.js → inline-math-C2NUSasr.js} +12 -15
- package/dist/{link-CJk67Kbh.js → link-BceXudNH.js} +2 -2
- package/dist/{math-ZLxqHT_f.js → math-DXOLG3Xg.js} +12 -15
- package/dist/{mermaid-CNFU7Pg8.js → mermaid-CU4hpB6S.js} +5 -5
- package/dist/{previewers-CMreQ4TA.js → previewers-qHMi6xZ3.js} +1 -1
- package/dist/segmented-BeHqXuFx.js +6 -0
- package/dist/{segmented-RoWxDIP3.js → segmented-CF6exjdD.js} +1 -1
- package/dist/{shiki-4529WbJJ.js → shiki-BlfngIRi.js} +9 -14
- package/dist/{renderer-CZ41eK_V.js → shiki-token-renderer-D164wC7Y.js} +10 -23
- package/dist/{table-BmGwZIPR.js → table-C5VHgkTQ.js} +3 -3
- package/dist/tooltip-BzVZqo7w.js +4 -0
- package/dist/{tooltip-KcTe6tBF.js → tooltip-gxsqaBNg.js} +1 -1
- package/dist/vanilla-CKj7EQLx.js +4 -0
- package/dist/vanilla-D5DzB31q.js +39 -0
- package/dist/zoom-container-CwEDlKRx.js +6 -0
- package/dist/{zoom-container-D1Mys9gv.js → zoom-container-D_fBClW2.js} +2 -2
- package/package.json +1 -1
- package/dist/button-DBgeYAZy.js +0 -5
- package/dist/code-block-DGZ48hb0.js +0 -9
- package/dist/dropdown-DR-uQ215.js +0 -5
- package/dist/error-component-CKCT9gXy.js +0 -4
- package/dist/segmented-63wrfRNo.js +0 -6
- package/dist/tooltip--rusT8LZ.js +0 -4
- package/dist/vanilla-CA9QO96X.js +0 -3
- package/dist/vanilla-DkX6g0dm.js +0 -87
- package/dist/zoom-container-C-CB2LTY.js +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue12 from "vue";
|
|
2
2
|
import { Component, MaybeRef, MaybeRefOrGetter } from "vue";
|
|
3
3
|
import "tippy.js/dist/tippy.css";
|
|
4
4
|
import "tippy.js/themes/light.css";
|
|
@@ -8,7 +8,6 @@ import { Zoom } from "medium-zoom";
|
|
|
8
8
|
import { MarkdownItAsync } from "markdown-it-async";
|
|
9
9
|
import { KatexOptions as KatexOptions$1 } from "katex";
|
|
10
10
|
import remend from "remend";
|
|
11
|
-
import "medium-zoom/dist/style.css";
|
|
12
11
|
import { BuiltinLanguage, BuiltinTheme, BundledLanguage, BundledTheme, CodeToTokensOptions, Highlighter, SpecialLanguage, TokensResult } from "shiki";
|
|
13
12
|
import { Mermaid, MermaidConfig } from "mermaid";
|
|
14
13
|
import { Extension, fromMarkdown } from "mdast-util-from-markdown";
|
|
@@ -211,6 +210,18 @@ interface CodeOptions {
|
|
|
211
210
|
languageIcon?: boolean;
|
|
212
211
|
languageName?: boolean;
|
|
213
212
|
lineNumbers?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Language specific code options
|
|
215
|
+
* @example
|
|
216
|
+
* {
|
|
217
|
+
* mermaid: {
|
|
218
|
+
* languageIcon: false,
|
|
219
|
+
* languageName: false,
|
|
220
|
+
* lineNumbers: true,
|
|
221
|
+
* },
|
|
222
|
+
* }
|
|
223
|
+
*/
|
|
224
|
+
language?: Record<string, CodeOptions>;
|
|
214
225
|
}
|
|
215
226
|
interface HardenOptions {
|
|
216
227
|
defaultOrigin?: string;
|
|
@@ -349,6 +360,18 @@ declare const NODE_RENDERERS: NodeRenderers;
|
|
|
349
360
|
//#region src/components/index.d.ts
|
|
350
361
|
declare const COMMON_COMPONENTS: Record<string, Component>;
|
|
351
362
|
//#endregion
|
|
363
|
+
//#region src/composables/use-code-options.d.ts
|
|
364
|
+
interface UseCodeOptionsOptions {
|
|
365
|
+
codeOptions?: MaybeRef<CodeOptions | undefined>;
|
|
366
|
+
language?: MaybeRef<string>;
|
|
367
|
+
}
|
|
368
|
+
declare function useCodeOptions(options: UseCodeOptionsOptions): {
|
|
369
|
+
languageCodeOptions: vue12.ComputedRef<CodeOptions | undefined>;
|
|
370
|
+
showLanguageIcon: vue12.ComputedRef<boolean>;
|
|
371
|
+
showLanguageName: vue12.ComputedRef<boolean>;
|
|
372
|
+
showLineNumbers: vue12.ComputedRef<boolean>;
|
|
373
|
+
};
|
|
374
|
+
//#endregion
|
|
352
375
|
//#region src/composables/use-context.d.ts
|
|
353
376
|
interface Context {
|
|
354
377
|
isDark?: MaybeRef<boolean>;
|
|
@@ -359,7 +382,7 @@ declare function useContext(): {
|
|
|
359
382
|
context: Context;
|
|
360
383
|
provideContext: (ctx: Partial<Context>) => void;
|
|
361
384
|
injectContext: () => Context;
|
|
362
|
-
isDark:
|
|
385
|
+
isDark: vue12.ComputedRef<boolean>;
|
|
363
386
|
readonly getContainer: () => HTMLElement | undefined;
|
|
364
387
|
readonly onCopied: (content: string) => void;
|
|
365
388
|
};
|
|
@@ -381,10 +404,10 @@ interface UseHardenSanitizersOptions {
|
|
|
381
404
|
isImage?: MaybeRef<boolean | undefined>;
|
|
382
405
|
}
|
|
383
406
|
declare function useHardenSanitizers(options: UseHardenSanitizersOptions): {
|
|
384
|
-
hardenOptions:
|
|
407
|
+
hardenOptions: vue12.ComputedRef<HardenOptions>;
|
|
385
408
|
transformHardenUrl: (url: string) => string | null;
|
|
386
|
-
transformedUrl:
|
|
387
|
-
isHardenUrl:
|
|
409
|
+
transformedUrl: vue12.ComputedRef<string | null>;
|
|
410
|
+
isHardenUrl: vue12.ComputedRef<boolean>;
|
|
388
411
|
};
|
|
389
412
|
//#endregion
|
|
390
413
|
//#region src/composables/use-i18n.d.ts
|
|
@@ -394,7 +417,7 @@ declare function useI18n(): {
|
|
|
394
417
|
//#endregion
|
|
395
418
|
//#region src/composables/use-katex.d.ts
|
|
396
419
|
declare function useKatex(): {
|
|
397
|
-
installed:
|
|
420
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
398
421
|
render: (code: string, options?: KatexOptions$1) => Promise<{
|
|
399
422
|
html?: string;
|
|
400
423
|
error?: string;
|
|
@@ -410,9 +433,9 @@ interface UseMathRendererOptions {
|
|
|
410
433
|
throttle?: MaybeRef<number>;
|
|
411
434
|
}
|
|
412
435
|
declare function useMathRenderer(options: UseMathRendererOptions): {
|
|
413
|
-
html:
|
|
414
|
-
error:
|
|
415
|
-
errorMessage:
|
|
436
|
+
html: vue12.Ref<string, string>;
|
|
437
|
+
error: vue12.ComputedRef<boolean>;
|
|
438
|
+
errorMessage: vue12.Ref<string, string>;
|
|
416
439
|
};
|
|
417
440
|
//#endregion
|
|
418
441
|
//#region src/composables/use-mermaid.d.ts
|
|
@@ -421,7 +444,7 @@ interface UseMermaidOptions {
|
|
|
421
444
|
isDark?: MaybeRef<boolean>;
|
|
422
445
|
}
|
|
423
446
|
declare function useMermaid(options?: UseMermaidOptions): {
|
|
424
|
-
installed:
|
|
447
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
425
448
|
getMermaid: () => Promise<Mermaid>;
|
|
426
449
|
parseMermaid: (code: string) => Promise<boolean>;
|
|
427
450
|
renderMermaid: (code: string) => Promise<string | null>;
|
|
@@ -437,7 +460,7 @@ interface UseShikiOptions {
|
|
|
437
460
|
isDark?: MaybeRef<boolean>;
|
|
438
461
|
}
|
|
439
462
|
declare function useShiki(options?: UseShikiOptions): {
|
|
440
|
-
installed:
|
|
463
|
+
installed: vue12.Ref<boolean, boolean>;
|
|
441
464
|
getHighlighter: () => Promise<Highlighter>;
|
|
442
465
|
codeToTokens: (code: string) => Promise<TokensResult>;
|
|
443
466
|
preload: () => Promise<void>;
|
|
@@ -450,12 +473,12 @@ interface UseTailwindV3ThemeOptions {
|
|
|
450
473
|
styleScope?: MaybeRef<string>;
|
|
451
474
|
}
|
|
452
475
|
declare function useTailwindV3Theme(options: UseTailwindV3ThemeOptions): {
|
|
453
|
-
element:
|
|
476
|
+
element: vue12.ComputedRef<Element | undefined>;
|
|
454
477
|
id: string;
|
|
455
|
-
css:
|
|
478
|
+
css: vue12.ShallowRef<string>;
|
|
456
479
|
load: () => void;
|
|
457
480
|
unload: () => void;
|
|
458
|
-
isLoaded: Readonly<
|
|
481
|
+
isLoaded: Readonly<vue12.ShallowRef<boolean>>;
|
|
459
482
|
generateCSS: () => void;
|
|
460
483
|
};
|
|
461
484
|
//#endregion
|
|
@@ -484,11 +507,11 @@ interface ZoomPanState {
|
|
|
484
507
|
translateY: number;
|
|
485
508
|
}
|
|
486
509
|
declare function useZoom(options?: UseZoomOptions): {
|
|
487
|
-
zoom:
|
|
488
|
-
translateX:
|
|
489
|
-
translateY:
|
|
490
|
-
isDragging:
|
|
491
|
-
transformStyle:
|
|
510
|
+
zoom: vue12.Ref<number, number>;
|
|
511
|
+
translateX: vue12.Ref<number, number>;
|
|
512
|
+
translateY: vue12.Ref<number, number>;
|
|
513
|
+
isDragging: vue12.Ref<boolean, boolean>;
|
|
514
|
+
transformStyle: vue12.ComputedRef<{
|
|
492
515
|
transform: string;
|
|
493
516
|
}>;
|
|
494
517
|
zoomIn: () => void;
|
|
@@ -520,29 +543,29 @@ declare const ICONS: Record<string, Component>;
|
|
|
520
543
|
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
544
|
//#endregion
|
|
522
545
|
//#region src/index.vue.d.ts
|
|
523
|
-
declare const __VLS_export:
|
|
546
|
+
declare const __VLS_export: vue12.DefineComponent<StreamMarkdownProps, {
|
|
524
547
|
getMarkdownParser: () => MarkdownParser;
|
|
525
548
|
getParsedNodes: () => ParsedNode[];
|
|
526
|
-
}, {}, {}, {},
|
|
549
|
+
}, {}, {}, {}, vue12.ComponentOptionsMixin, vue12.ComponentOptionsMixin, {} & {
|
|
527
550
|
copied: (content: string) => any;
|
|
528
|
-
}, string,
|
|
551
|
+
}, string, vue12.PublicProps, Readonly<StreamMarkdownProps> & Readonly<{
|
|
529
552
|
onCopied?: ((content: string) => any) | undefined;
|
|
530
553
|
}>, {
|
|
531
554
|
mode: "static" | "streaming";
|
|
532
555
|
content: string;
|
|
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",
|
|
556
|
+
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>>;
|
|
534
557
|
locale: string | LocaleConfig;
|
|
535
558
|
controls: ControlsConfig;
|
|
536
559
|
previewers: PreviewerConfig;
|
|
537
560
|
isDark: boolean;
|
|
538
|
-
}, {}, {}, {}, string,
|
|
561
|
+
}, {}, {}, {}, string, vue12.ComponentProvideOptions, false, {}, any>;
|
|
539
562
|
declare const _default: typeof __VLS_export;
|
|
540
563
|
//#endregion
|
|
541
564
|
//#region src/locales/index.d.ts
|
|
542
565
|
declare const SUPPORT_LANGUAGES: string[];
|
|
543
566
|
declare const localesGlob: Record<string, () => Promise<unknown>>;
|
|
544
|
-
declare const localeMessages:
|
|
545
|
-
declare const currentLocale:
|
|
567
|
+
declare const localeMessages: vue12.Ref<LocaleConfig | undefined, LocaleConfig | undefined>;
|
|
568
|
+
declare const currentLocale: vue12.Ref<string, string>;
|
|
546
569
|
declare function loadLocaleMessages(language: string | LocaleConfig): Promise<void>;
|
|
547
570
|
//#endregion
|
|
548
571
|
//#region src/postprocess/text.d.ts
|
|
@@ -708,6 +731,9 @@ declare function fixStrong(content: string): string;
|
|
|
708
731
|
*/
|
|
709
732
|
declare function fixTable(content: string): string;
|
|
710
733
|
//#endregion
|
|
734
|
+
//#region src/preprocess/task-list.d.ts
|
|
735
|
+
declare function fixTaskList(content: string): string;
|
|
736
|
+
//#endregion
|
|
711
737
|
//#region src/preprocess/vendored/markdown-utils.d.ts
|
|
712
738
|
declare function preprocessLaTeX(content: string): string;
|
|
713
739
|
declare function preprocessThinkTag(content: string): string;
|
|
@@ -730,6 +756,10 @@ declare const incompleteLinkTextPattern: RegExp;
|
|
|
730
756
|
declare const incompleteUrlPattern: RegExp;
|
|
731
757
|
declare const tableRowPattern: RegExp;
|
|
732
758
|
declare const separatorPattern: RegExp;
|
|
759
|
+
declare const standaloneDashPattern: RegExp;
|
|
760
|
+
declare const taskListPattern: RegExp;
|
|
761
|
+
declare const quoteStandaloneDashPattern: RegExp;
|
|
762
|
+
declare const quoteTaskListPattern: RegExp;
|
|
733
763
|
//#endregion
|
|
734
764
|
//#region src/preprocess/index.d.ts
|
|
735
765
|
declare function proprocessContent(content: string): string;
|
|
@@ -773,4 +803,4 @@ declare function tableDataToTSV(data: TableData): string;
|
|
|
773
803
|
declare function escapeMarkdownTableCell(cell: string): string;
|
|
774
804
|
declare function tableDataToMarkdown(data: TableData): string;
|
|
775
805
|
//#endregion
|
|
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 };
|
|
806
|
+
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, fixTaskList, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize, postFixText, postprocess, preprocess, preprocessLaTeX, preprocessThinkTag, proprocessContent, quoteStandaloneDashPattern, quoteTaskListPattern, remend, save, separatorPattern, singleAsteriskPattern, singleBacktickPattern, singleUnderscorePattern, standaloneDashPattern, svgToPngBlob, tableDataToCSV, tableDataToMarkdown, tableDataToTSV, tableRowPattern, taskListPattern, trailingBackticksPattern, trailingWhitespacePattern, transformUrl, tripleBacktickPattern, useCodeOptions, useContext, useControls, useHardenSanitizers, useI18n, useKatex, useMathRenderer, useMermaid, useShiki, useTailwindV3Theme, useTippy, useZoom };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { t as CODE_PREVIEWERS } from "./previewers-
|
|
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-
|
|
1
|
+
import { t as CODE_PREVIEWERS } from "./previewers-qHMi6xZ3.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, V as useCodeOptions, _ 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-Cj6_jbwr.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
7
|
import remend from "remend";
|
|
8
|
-
import "medium-zoom/dist/style.css";
|
|
9
8
|
|
|
10
9
|
//#region rolldown:runtime
|
|
11
10
|
var __create = Object.create;
|
|
@@ -51,20 +50,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
51
50
|
//#region src/components/renderers/index.ts
|
|
52
51
|
const NODE_RENDERERS = {
|
|
53
52
|
blockquote: defineAsyncComponent(() => import("./blockquote-DdEg2gww.js")),
|
|
54
|
-
code: defineAsyncComponent(() => import("./code-
|
|
53
|
+
code: defineAsyncComponent(() => import("./code-CJ4tMt6L.js")),
|
|
55
54
|
delete: defineAsyncComponent(() => import("./delete-BdWzKJCy.js")),
|
|
56
55
|
emphasis: defineAsyncComponent(() => import("./emphasis-CTuGt1Ok.js")),
|
|
57
56
|
heading: defineAsyncComponent(() => import("./heading-2vpQQtTH.js")),
|
|
58
|
-
image: defineAsyncComponent(() => import("./image-
|
|
57
|
+
image: defineAsyncComponent(() => import("./image-xeiC5YFM.js")),
|
|
59
58
|
inlineCode: defineAsyncComponent(() => import("./inline-code-CBoqhfz7.js")),
|
|
60
|
-
inlineMath: defineAsyncComponent(() => import("./inline-math-
|
|
61
|
-
link: defineAsyncComponent(() => import("./link-
|
|
59
|
+
inlineMath: defineAsyncComponent(() => import("./inline-math-C2NUSasr.js")),
|
|
60
|
+
link: defineAsyncComponent(() => import("./link-BceXudNH.js")),
|
|
62
61
|
list: defineAsyncComponent(() => import("./list-BCiFKGaz.js")),
|
|
63
62
|
listItem: defineAsyncComponent(() => import("./list-item-p-OLUR_9.js")),
|
|
64
|
-
math: defineAsyncComponent(() => import("./math-
|
|
63
|
+
math: defineAsyncComponent(() => import("./math-DXOLG3Xg.js")),
|
|
65
64
|
paragraph: defineAsyncComponent(() => import("./paragraph-DYjqr_Sa.js")),
|
|
66
65
|
strong: defineAsyncComponent(() => import("./strong-CvOjLZiq.js")),
|
|
67
|
-
table: defineAsyncComponent(() => import("./table-
|
|
66
|
+
table: defineAsyncComponent(() => import("./table-C5VHgkTQ.js")),
|
|
68
67
|
text: defineAsyncComponent(() => import("./text-DuONUqRA.js")),
|
|
69
68
|
thematicBreak: defineAsyncComponent(() => import("./thematic-break-CcNPEI9Y.js")),
|
|
70
69
|
yaml: defineAsyncComponent(() => import("./yaml-DJHrmzSe.js"))
|
|
@@ -73,17 +72,17 @@ const NODE_RENDERERS = {
|
|
|
73
72
|
//#endregion
|
|
74
73
|
//#region src/components/index.ts
|
|
75
74
|
const COMMON_COMPONENTS = {
|
|
76
|
-
Button: defineAsyncComponent(() => import("./button-
|
|
77
|
-
CodeBlock: defineAsyncComponent(() => import("./code-block-
|
|
78
|
-
Dropdown: defineAsyncComponent(() => import("./dropdown-
|
|
79
|
-
ErrorComponent: defineAsyncComponent(() => import("./error-component-
|
|
75
|
+
Button: defineAsyncComponent(() => import("./button-2wMU7qkH.js")),
|
|
76
|
+
CodeBlock: defineAsyncComponent(() => import("./code-block-BucFZooo.js")),
|
|
77
|
+
Dropdown: defineAsyncComponent(() => import("./dropdown-dsCfq0Hl.js")),
|
|
78
|
+
ErrorComponent: defineAsyncComponent(() => import("./error-component-B0mmLhh6.js")),
|
|
80
79
|
Modal: defineAsyncComponent(() => import("./modal-DcpxxDDX.js")),
|
|
81
80
|
NodeList: defineAsyncComponent(() => import("./node-list-lgY1wbfQ.js")),
|
|
82
|
-
Segmented: defineAsyncComponent(() => import("./segmented-
|
|
81
|
+
Segmented: defineAsyncComponent(() => import("./segmented-BeHqXuFx.js")),
|
|
83
82
|
Spin: defineAsyncComponent(() => import("./spin-Bz4zGBEo.js")),
|
|
84
83
|
Table: defineAsyncComponent(() => import("./table-CZLbUHiJ.js")),
|
|
85
|
-
Tooltip: defineAsyncComponent(() => import("./tooltip
|
|
86
|
-
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-
|
|
84
|
+
Tooltip: defineAsyncComponent(() => import("./tooltip-BzVZqo7w.js")),
|
|
85
|
+
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-CwEDlKRx.js"))
|
|
87
86
|
};
|
|
88
87
|
|
|
89
88
|
//#endregion
|
|
@@ -17536,6 +17535,10 @@ const incompleteLinkTextPattern = /!?\[[^\]]+\]\s*$/;
|
|
|
17536
17535
|
const incompleteUrlPattern = /!?\[[^\]]+\]\([^)]*$/;
|
|
17537
17536
|
const tableRowPattern = /^\|.*\|.*\|/;
|
|
17538
17537
|
const separatorPattern = /^\|[\s:]*-{3,}[\s:]*(?:\|[\s:]*-{3,}[\s:]*)+\|?$/;
|
|
17538
|
+
const standaloneDashPattern = /^\s*-$/;
|
|
17539
|
+
const taskListPattern = /^\s*- \[[x ]\]/i;
|
|
17540
|
+
const quoteStandaloneDashPattern = /^>\s*-$/;
|
|
17541
|
+
const quoteTaskListPattern = /^>\s*- \[[x ]\]/i;
|
|
17539
17542
|
|
|
17540
17543
|
//#endregion
|
|
17541
17544
|
//#region src/preprocess/code.ts
|
|
@@ -18064,6 +18067,48 @@ function generateSeparator(columns) {
|
|
|
18064
18067
|
return `|${parts.join("|")}|`;
|
|
18065
18068
|
}
|
|
18066
18069
|
|
|
18070
|
+
//#endregion
|
|
18071
|
+
//#region src/preprocess/task-list.ts
|
|
18072
|
+
/**
|
|
18073
|
+
* Fix incomplete task list syntax in streaming markdown
|
|
18074
|
+
*
|
|
18075
|
+
* Removes standalone `-` that appears on the last line without `[ ]` or `[x]` syntax.
|
|
18076
|
+
* This prevents AST parsing jitter when task list items are being typed incrementally.
|
|
18077
|
+
* Also handles quote blocks (lines starting with `>`) to prevent leaving `> ` which could
|
|
18078
|
+
* cause the previous line to be misparsed as a heading.
|
|
18079
|
+
*
|
|
18080
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
18081
|
+
* @returns Content with standalone `-` removed from the last line if incomplete
|
|
18082
|
+
*
|
|
18083
|
+
* @example
|
|
18084
|
+
* fixTaskList('- [ ] Task 1\n-')
|
|
18085
|
+
* // Returns: '- [ ] Task 1\n'
|
|
18086
|
+
*
|
|
18087
|
+
* @example
|
|
18088
|
+
* fixTaskList('- [ ] Task 1\n- [x] Task 2\n-')
|
|
18089
|
+
* // Returns: '- [ ] Task 1\n- [x] Task 2\n'
|
|
18090
|
+
*
|
|
18091
|
+
* @example
|
|
18092
|
+
* fixTaskList('> **Note**: Here\'s a quote with tasks:\n\n> -')
|
|
18093
|
+
* // Returns: '> **Note**: Here\'s a quote with tasks:\n\n'
|
|
18094
|
+
*/
|
|
18095
|
+
function fixTaskList(content$2) {
|
|
18096
|
+
const lines = content$2.split("\n");
|
|
18097
|
+
if (lines.length === 0) return content$2;
|
|
18098
|
+
const lastLine = lines[lines.length - 1];
|
|
18099
|
+
if (quoteStandaloneDashPattern.test(lastLine) && !quoteTaskListPattern.test(lastLine)) {
|
|
18100
|
+
const result = lines.slice(0, -1).join("\n");
|
|
18101
|
+
if (lines.length > 1) return `${result}\n`;
|
|
18102
|
+
return result;
|
|
18103
|
+
}
|
|
18104
|
+
if (standaloneDashPattern.test(lastLine) && !taskListPattern.test(lastLine)) {
|
|
18105
|
+
const result = lines.slice(0, -1).join("\n");
|
|
18106
|
+
if (lines.length > 1) return `${result}\n`;
|
|
18107
|
+
return result;
|
|
18108
|
+
}
|
|
18109
|
+
return content$2;
|
|
18110
|
+
}
|
|
18111
|
+
|
|
18067
18112
|
//#endregion
|
|
18068
18113
|
//#region src/preprocess/vendored/markdown-utils.ts
|
|
18069
18114
|
function preprocessLaTeX(content$2) {
|
|
@@ -18115,6 +18160,7 @@ function preprocess(content$2) {
|
|
|
18115
18160
|
fixCode,
|
|
18116
18161
|
fixTable,
|
|
18117
18162
|
fixInlineMath,
|
|
18163
|
+
fixTaskList,
|
|
18118
18164
|
remend
|
|
18119
18165
|
])(content$2);
|
|
18120
18166
|
}
|
|
@@ -18371,4 +18417,4 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
18371
18417
|
var src_default = index_vue_vue_type_script_setup_true_lang_default;
|
|
18372
18418
|
|
|
18373
18419
|
//#endregion
|
|
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 };
|
|
18420
|
+
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, fixTaskList, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize, postFixText, postprocess, preprocess, preprocessLaTeX, preprocessThinkTag, proprocessContent, quoteStandaloneDashPattern, quoteTaskListPattern, remend, save, separatorPattern, singleAsteriskPattern, singleBacktickPattern, singleUnderscorePattern, standaloneDashPattern, svgToPngBlob, tableDataToCSV, tableDataToMarkdown, tableDataToTSV, tableRowPattern, taskListPattern, trailingBackticksPattern, trailingWhitespacePattern, transformUrl, tripleBacktickPattern, useCodeOptions, useContext, useControls, useHardenSanitizers, useI18n, useKatex, useMathRenderer, useMermaid, useShiki, useTailwindV3Theme, useTippy, useZoom };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as useMathRenderer } from "./composables-
|
|
2
|
-
import { t as error_component_default } from "./error-component-
|
|
3
|
-
import {
|
|
1
|
+
import { o as useMathRenderer } from "./composables-Cj6_jbwr.js";
|
|
2
|
+
import { t as error_component_default } from "./error-component-ClGLfmwy.js";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, resolveDynamicComponent, toRefs, unref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/inline-math.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
const _hoisted_1 = ["innerHTML"];
|
|
@@ -86,18 +86,15 @@ var inline_math_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
86
86
|
return ((_katexOptions$value = katexOptions.value) === null || _katexOptions$value === void 0 ? void 0 : _katexOptions$value.errorComponent) ?? error_component_default;
|
|
87
87
|
});
|
|
88
88
|
return (_ctx, _cache) => {
|
|
89
|
-
return openBlock(), createBlock(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, null, 8, _hoisted_1))]),
|
|
99
|
-
_: 1
|
|
100
|
-
});
|
|
89
|
+
return unref(error) ? (openBlock(), createBlock(resolveDynamicComponent(Error.value), mergeProps({
|
|
90
|
+
key: 0,
|
|
91
|
+
variant: "katex",
|
|
92
|
+
message: unref(errorMessage)
|
|
93
|
+
}, props), null, 16, ["message"])) : (openBlock(), createElementBlock("span", {
|
|
94
|
+
key: 1,
|
|
95
|
+
"data-stream-markdown": "inline-math",
|
|
96
|
+
innerHTML: unref(html)
|
|
97
|
+
}, null, 8, _hoisted_1));
|
|
101
98
|
};
|
|
102
99
|
}
|
|
103
100
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as useHardenSanitizers } from "./composables-
|
|
1
|
+
import { g as useHardenSanitizers } from "./composables-Cj6_jbwr.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-ClGLfmwy.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as useMathRenderer } from "./composables-
|
|
2
|
-
import { t as error_component_default } from "./error-component-
|
|
3
|
-
import {
|
|
1
|
+
import { o as useMathRenderer } from "./composables-Cj6_jbwr.js";
|
|
2
|
+
import { t as error_component_default } from "./error-component-ClGLfmwy.js";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, resolveDynamicComponent, toRefs, unref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/math.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
const _hoisted_1 = ["innerHTML"];
|
|
@@ -86,18 +86,15 @@ var math_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
86
86
|
return ((_katexOptions$value = katexOptions.value) === null || _katexOptions$value === void 0 ? void 0 : _katexOptions$value.errorComponent) ?? error_component_default;
|
|
87
87
|
});
|
|
88
88
|
return (_ctx, _cache) => {
|
|
89
|
-
return openBlock(), createBlock(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, null, 8, _hoisted_1))]),
|
|
99
|
-
_: 1
|
|
100
|
-
});
|
|
89
|
+
return unref(error) ? (openBlock(), createBlock(resolveDynamicComponent(Error.value), mergeProps({
|
|
90
|
+
key: 0,
|
|
91
|
+
variant: "katex",
|
|
92
|
+
message: unref(errorMessage)
|
|
93
|
+
}, props), null, 16, ["message"])) : (openBlock(), createElementBlock("div", {
|
|
94
|
+
key: 1,
|
|
95
|
+
"data-stream-markdown": "math",
|
|
96
|
+
innerHTML: unref(html)
|
|
97
|
+
}, null, 8, _hoisted_1));
|
|
101
98
|
};
|
|
102
99
|
}
|
|
103
100
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as useMermaid, s as throttle, z as useControls } from "./composables-
|
|
2
|
-
import "./tooltip-
|
|
3
|
-
import "./button-
|
|
4
|
-
import { t as error_component_default } from "./error-component-
|
|
1
|
+
import { a as useMermaid, s as throttle, z as useControls } from "./composables-Cj6_jbwr.js";
|
|
2
|
+
import "./tooltip-gxsqaBNg.js";
|
|
3
|
+
import "./button-CJyeXWq2.js";
|
|
4
|
+
import { t as error_component_default } from "./error-component-ClGLfmwy.js";
|
|
5
5
|
import { t as spin_default } from "./spin-Ds5W7qC_.js";
|
|
6
|
-
import { t as zoom_container_default } from "./zoom-container-
|
|
6
|
+
import { t as zoom_container_default } from "./zoom-container-D_fBClW2.js";
|
|
7
7
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, ref, resolveDynamicComponent, toRefs, watch, withCtx } from "vue";
|
|
8
8
|
import { useResizeObserver } from "@vueuse/core";
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import { defineAsyncComponent } from "vue";
|
|
|
3
3
|
//#region src/components/previewers/index.ts
|
|
4
4
|
const CODE_PREVIEWERS = {
|
|
5
5
|
html: defineAsyncComponent(() => import("./html-DL0PcUXX.js")),
|
|
6
|
-
mermaid: defineAsyncComponent(() => import("./mermaid-
|
|
6
|
+
mermaid: defineAsyncComponent(() => import("./mermaid-CU4hpB6S.js"))
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as button_default } from "./button-
|
|
1
|
+
import { t as button_default } from "./button-CJyeXWq2.js";
|
|
2
2
|
import { Fragment, createBlock, createElementBlock, defineComponent, mergeModels, openBlock, renderList, useModel } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/segmented.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as useShiki } from "./composables-
|
|
2
|
-
import { t as vanilla_default } from "./vanilla-
|
|
1
|
+
import { V as useCodeOptions, i as useShiki } from "./composables-Cj6_jbwr.js";
|
|
2
|
+
import { t as vanilla_default } from "./vanilla-D5DzB31q.js";
|
|
3
3
|
import { computed, createBlock, createCommentVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeProps, openBlock, ref, toRefs, unref, watch } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/code/shiki.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -70,12 +70,12 @@ var shiki_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
70
70
|
setup(__props) {
|
|
71
71
|
const props = __props;
|
|
72
72
|
const { shikiOptions, codeOptions, isDark } = toRefs(props);
|
|
73
|
-
const ShikiTokensRenderer = defineAsyncComponent(() => import("./renderer-
|
|
73
|
+
const ShikiTokensRenderer = defineAsyncComponent(() => import("./shiki-token-renderer-D164wC7Y.js"));
|
|
74
74
|
const code = computed(() => props.node.value.trim());
|
|
75
75
|
const lang = computed(() => props.node.lang || "");
|
|
76
|
-
const showLineNumbers =
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const { showLineNumbers } = useCodeOptions({
|
|
77
|
+
codeOptions,
|
|
78
|
+
language: lang
|
|
79
79
|
});
|
|
80
80
|
const { codeToTokens } = useShiki({
|
|
81
81
|
lang,
|
|
@@ -94,14 +94,9 @@ var shiki_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
94
94
|
return tokens.value ? (openBlock(), createBlock(unref(ShikiTokensRenderer), {
|
|
95
95
|
key: 0,
|
|
96
96
|
"data-stream-markdown": "code",
|
|
97
|
-
"data-show-line-numbers": showLineNumbers
|
|
98
|
-
tokens: tokens.value
|
|
99
|
-
|
|
100
|
-
}, null, 8, [
|
|
101
|
-
"data-show-line-numbers",
|
|
102
|
-
"tokens",
|
|
103
|
-
"show-line-numbers"
|
|
104
|
-
])) : (openBlock(), createBlock(vanilla_default, normalizeProps(mergeProps({ key: 1 }, props)), null, 16));
|
|
97
|
+
"data-show-line-numbers": unref(showLineNumbers),
|
|
98
|
+
tokens: tokens.value
|
|
99
|
+
}, null, 8, ["data-show-line-numbers", "tokens"])) : (openBlock(), createBlock(unref(vanilla_default), normalizeProps(mergeProps({ key: 1 }, props)), null, 16));
|
|
105
100
|
};
|
|
106
101
|
}
|
|
107
102
|
});
|
|
@@ -1,36 +1,23 @@
|
|
|
1
1
|
import { defineComponent, h, renderList } from "vue";
|
|
2
2
|
import { getTokenStyleObject } from "shiki";
|
|
3
3
|
|
|
4
|
-
//#region src/components/renderers/code/renderer.ts
|
|
5
|
-
var
|
|
4
|
+
//#region src/components/renderers/code/shiki-token-renderer.ts
|
|
5
|
+
var shiki_token_renderer_default = defineComponent({
|
|
6
6
|
name: "ShikiTokensRenderer",
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
showLineNumbers: {
|
|
13
|
-
type: Boolean,
|
|
14
|
-
default: true
|
|
15
|
-
}
|
|
16
|
-
},
|
|
7
|
+
props: { tokens: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: true
|
|
10
|
+
} },
|
|
17
11
|
setup(props) {
|
|
18
12
|
return () => {
|
|
19
13
|
var _props$tokens$grammar;
|
|
20
14
|
return h("pre", {
|
|
21
15
|
"class": ["shiki", props.tokens.themeName],
|
|
22
16
|
"data-language": (_props$tokens$grammar = props.tokens.grammarState) === null || _props$tokens$grammar === void 0 ? void 0 : _props$tokens$grammar.lang,
|
|
23
|
-
"style": {
|
|
24
|
-
padding: "1rem",
|
|
25
|
-
counterReset: "line"
|
|
26
|
-
}
|
|
17
|
+
"style": { counterReset: "line" }
|
|
27
18
|
}, h("code", renderList(props.tokens.tokens, (line, index) => h("div", {
|
|
28
|
-
|
|
29
|
-
key: index
|
|
30
|
-
style: {
|
|
31
|
-
fontSize: "0.875rem",
|
|
32
|
-
minHeight: "1rem"
|
|
33
|
-
}
|
|
19
|
+
"data-stream-markdown": "code-line",
|
|
20
|
+
"key": index
|
|
34
21
|
}, renderList(line, (token, tokenIndex) => h("span", {
|
|
35
22
|
key: tokenIndex,
|
|
36
23
|
style: token.htmlStyle || getTokenStyleObject(token)
|
|
@@ -40,4 +27,4 @@ var renderer_default = defineComponent({
|
|
|
40
27
|
});
|
|
41
28
|
|
|
42
29
|
//#endregion
|
|
43
|
-
export {
|
|
30
|
+
export { shiki_token_renderer_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as useContext, M as ICONS, O as save, b as tableDataToMarkdown, u as useI18n, v as extractTableDataFromElement, x as tableDataToTSV, y as tableDataToCSV, z as useControls } from "./composables-
|
|
1
|
+
import { B as useContext, M as ICONS, O as save, b as tableDataToMarkdown, u as useI18n, v as extractTableDataFromElement, x as tableDataToTSV, y as tableDataToCSV, z as useControls } from "./composables-Cj6_jbwr.js";
|
|
2
2
|
import { t as node_list_default } from "./node-list-CGr_EVtn.js";
|
|
3
|
-
import "./tooltip-
|
|
4
|
-
import { t as button_default } from "./button-
|
|
3
|
+
import "./tooltip-gxsqaBNg.js";
|
|
4
|
+
import { t as button_default } from "./button-CJyeXWq2.js";
|
|
5
5
|
import { t as spin_default } from "./spin-Ds5W7qC_.js";
|
|
6
6
|
import { t as table_default$1 } from "./table-4ec9FVB_.js";
|
|
7
7
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderList, withCtx } from "vue";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as useContext } from "./composables-
|
|
1
|
+
import { B as useContext } from "./composables-Cj6_jbwr.js";
|
|
2
2
|
import { computed, createBlock, createElementVNode, defineComponent, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
3
3
|
import { Tippy } from "vue-tippy";
|
|
4
4
|
|