@incremark/react 0.2.7 → 0.3.0
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.en.md +216 -47
- package/dist/index.d.ts +19 -1
- package/dist/index.js +420 -253
- package/package.json +19 -6
package/dist/index.js
CHANGED
|
@@ -536,6 +536,44 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
// src/hooks/useLocale.ts
|
|
540
|
+
import { useContext as useContext2 } from "react";
|
|
541
|
+
|
|
542
|
+
// src/components/ConfigProvider.tsx
|
|
543
|
+
import { createContext as createContext2, useMemo as useMemo3 } from "react";
|
|
544
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
545
|
+
var LocaleContext = createContext2(null);
|
|
546
|
+
function ConfigProvider({ children, locale = enShared }) {
|
|
547
|
+
const contextValue = useMemo3(() => ({ locale }), [locale]);
|
|
548
|
+
return /* @__PURE__ */ jsx2(LocaleContext.Provider, { value: contextValue, children });
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/hooks/useLocale.ts
|
|
552
|
+
function useLocale() {
|
|
553
|
+
const context = useContext2(LocaleContext);
|
|
554
|
+
if (!context) {
|
|
555
|
+
const t2 = (key) => {
|
|
556
|
+
const keys = key.split(".");
|
|
557
|
+
let value = enShared;
|
|
558
|
+
for (const k of keys) {
|
|
559
|
+
value = value?.[k];
|
|
560
|
+
}
|
|
561
|
+
return value || key;
|
|
562
|
+
};
|
|
563
|
+
return { t: t2 };
|
|
564
|
+
}
|
|
565
|
+
const { locale } = context;
|
|
566
|
+
const t = (key) => {
|
|
567
|
+
const keys = key.split(".");
|
|
568
|
+
let value = locale;
|
|
569
|
+
for (const k of keys) {
|
|
570
|
+
value = value?.[k];
|
|
571
|
+
}
|
|
572
|
+
return value || key;
|
|
573
|
+
};
|
|
574
|
+
return { t };
|
|
575
|
+
}
|
|
576
|
+
|
|
539
577
|
// src/components/IncremarkInline.tsx
|
|
540
578
|
import React3 from "react";
|
|
541
579
|
import {
|
|
@@ -546,7 +584,7 @@ import {
|
|
|
546
584
|
|
|
547
585
|
// src/components/IncremarkHtmlElement.tsx
|
|
548
586
|
import React2 from "react";
|
|
549
|
-
import { jsx as
|
|
587
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
550
588
|
var INLINE_ELEMENTS = [
|
|
551
589
|
"a",
|
|
552
590
|
"abbr",
|
|
@@ -668,22 +706,22 @@ function toReactProps(attrs) {
|
|
|
668
706
|
function renderChildren(children) {
|
|
669
707
|
if (!children || children.length === 0) return null;
|
|
670
708
|
if (hasOnlyInlineChildren(children)) {
|
|
671
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ jsx3(IncremarkInline, { nodes: children });
|
|
672
710
|
}
|
|
673
711
|
return children.map((child, idx) => {
|
|
674
712
|
if (child.type === "htmlElement") {
|
|
675
|
-
return /* @__PURE__ */
|
|
713
|
+
return /* @__PURE__ */ jsx3(IncremarkHtmlElement, { node: child }, idx);
|
|
676
714
|
}
|
|
677
715
|
if (child.type === "text") {
|
|
678
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsx3(React2.Fragment, { children: child.value }, idx);
|
|
679
717
|
}
|
|
680
718
|
if (["strong", "emphasis", "inlineCode", "link", "image", "break"].includes(child.type)) {
|
|
681
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsx3(IncremarkInline, { nodes: [child] }, idx);
|
|
682
720
|
}
|
|
683
721
|
if (child.type === "paragraph") {
|
|
684
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ jsx3("p", { children: /* @__PURE__ */ jsx3(IncremarkInline, { nodes: child.children }) }, idx);
|
|
685
723
|
}
|
|
686
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ jsx3("div", { className: "incremark-unknown-child", children: child.type }, idx);
|
|
687
725
|
});
|
|
688
726
|
}
|
|
689
727
|
var IncremarkHtmlElement = ({ node }) => {
|
|
@@ -691,13 +729,13 @@ var IncremarkHtmlElement = ({ node }) => {
|
|
|
691
729
|
const Tag = tagName;
|
|
692
730
|
const reactProps = toReactProps(attrs);
|
|
693
731
|
if (isVoidElement(tagName)) {
|
|
694
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ jsx3(Tag, { ...reactProps, className: `incremark-html-element incremark-${tagName} ${reactProps.className || ""}` });
|
|
695
733
|
}
|
|
696
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ jsx3(Tag, { ...reactProps, className: `incremark-html-element incremark-${tagName} ${reactProps.className || ""}`, children: renderChildren(children) });
|
|
697
735
|
};
|
|
698
736
|
|
|
699
737
|
// src/components/IncremarkInline.tsx
|
|
700
|
-
import { Fragment, jsx as
|
|
738
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
701
739
|
function isHtmlElementNode(node) {
|
|
702
740
|
return node.type === "htmlElement";
|
|
703
741
|
}
|
|
@@ -710,45 +748,45 @@ function isLinkReference(node) {
|
|
|
710
748
|
var IncremarkInline = ({ nodes }) => {
|
|
711
749
|
if (!nodes || nodes.length === 0) return null;
|
|
712
750
|
const { definitions, footnoteDefinitions } = useDefinitions();
|
|
713
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: nodes.map((node, i) => {
|
|
714
752
|
if (node.type === "text") {
|
|
715
753
|
const textNode = node;
|
|
716
754
|
if (hasChunks(node) && textNode.chunks && textNode.chunks.length > 0) {
|
|
717
755
|
return /* @__PURE__ */ jsxs(React3.Fragment, { children: [
|
|
718
756
|
getStableText(textNode),
|
|
719
|
-
textNode.chunks.map((chunk) => /* @__PURE__ */
|
|
757
|
+
textNode.chunks.map((chunk) => /* @__PURE__ */ jsx4("span", { "data-chunk-key": chunk.createdAt, className: "incremark-fade-in", children: chunk.text }, chunk.createdAt))
|
|
720
758
|
] }, i);
|
|
721
759
|
}
|
|
722
|
-
return /* @__PURE__ */
|
|
760
|
+
return /* @__PURE__ */ jsx4(React3.Fragment, { children: node.value }, i);
|
|
723
761
|
}
|
|
724
762
|
if (isHtmlElementNode(node)) {
|
|
725
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ jsx4(IncremarkHtmlElement, { node }, i);
|
|
726
764
|
}
|
|
727
765
|
if (isHtmlNode(node)) {
|
|
728
|
-
return /* @__PURE__ */
|
|
766
|
+
return /* @__PURE__ */ jsx4(
|
|
729
767
|
"span",
|
|
730
768
|
{
|
|
731
|
-
|
|
769
|
+
className: "incremark-inline-html",
|
|
732
770
|
dangerouslySetInnerHTML: { __html: node.value }
|
|
733
771
|
},
|
|
734
772
|
i
|
|
735
773
|
);
|
|
736
774
|
}
|
|
737
775
|
if (node.type === "strong") {
|
|
738
|
-
return /* @__PURE__ */
|
|
776
|
+
return /* @__PURE__ */ jsx4("strong", { children: /* @__PURE__ */ jsx4(IncremarkInline, { nodes: node.children }) }, i);
|
|
739
777
|
}
|
|
740
778
|
if (node.type === "emphasis") {
|
|
741
|
-
return /* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ jsx4("em", { children: /* @__PURE__ */ jsx4(IncremarkInline, { nodes: node.children }) }, i);
|
|
742
780
|
}
|
|
743
781
|
if (node.type === "inlineCode") {
|
|
744
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ jsx4("code", { className: "incremark-inline-code", children: node.value }, i);
|
|
745
783
|
}
|
|
746
784
|
if (node.type === "link") {
|
|
747
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ jsx4("a", { href: node.url, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx4(IncremarkInline, { nodes: node.children }) }, i);
|
|
748
786
|
}
|
|
749
787
|
if (node.type === "image") {
|
|
750
788
|
const imageNode = node;
|
|
751
|
-
return /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ jsx4(
|
|
752
790
|
"img",
|
|
753
791
|
{
|
|
754
792
|
src: imageNode.url,
|
|
@@ -762,7 +800,7 @@ var IncremarkInline = ({ nodes }) => {
|
|
|
762
800
|
if (isImageReference(node)) {
|
|
763
801
|
const definition = definitions[node.identifier];
|
|
764
802
|
if (definition) {
|
|
765
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ jsx4(
|
|
766
804
|
"img",
|
|
767
805
|
{
|
|
768
806
|
src: definition.url,
|
|
@@ -784,14 +822,14 @@ var IncremarkInline = ({ nodes }) => {
|
|
|
784
822
|
if (isLinkReference(node)) {
|
|
785
823
|
const definition = definitions[node.identifier];
|
|
786
824
|
if (definition) {
|
|
787
|
-
return /* @__PURE__ */
|
|
825
|
+
return /* @__PURE__ */ jsx4(
|
|
788
826
|
"a",
|
|
789
827
|
{
|
|
790
828
|
href: definition.url,
|
|
791
829
|
title: definition.title || void 0,
|
|
792
830
|
target: "_blank",
|
|
793
831
|
rel: "noopener noreferrer",
|
|
794
|
-
children: /* @__PURE__ */
|
|
832
|
+
children: /* @__PURE__ */ jsx4(IncremarkInline, { nodes: node.children })
|
|
795
833
|
},
|
|
796
834
|
i
|
|
797
835
|
);
|
|
@@ -807,36 +845,175 @@ var IncremarkInline = ({ nodes }) => {
|
|
|
807
845
|
if (node.type === "footnoteReference") {
|
|
808
846
|
const footnoteRef = node;
|
|
809
847
|
const hasDefinition = footnoteDefinitions[footnoteRef.identifier];
|
|
810
|
-
return /* @__PURE__ */
|
|
848
|
+
return /* @__PURE__ */ jsx4("sup", { className: "incremark-footnote-ref", children: /* @__PURE__ */ jsx4("a", { href: `#fn-${footnoteRef.identifier}`, id: `fnref-${footnoteRef.identifier}`, children: hasDefinition ? `[${footnoteRef.identifier}]` : `[^${footnoteRef.identifier}]` }) }, i);
|
|
811
849
|
}
|
|
812
850
|
if (node.type === "break") {
|
|
813
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ jsx4("br", {}, i);
|
|
814
852
|
}
|
|
815
853
|
if (node.type === "delete") {
|
|
816
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsx4("del", { children: /* @__PURE__ */ jsx4(IncremarkInline, { nodes: node.children }) }, i);
|
|
817
855
|
}
|
|
818
|
-
return /* @__PURE__ */
|
|
856
|
+
return /* @__PURE__ */ jsx4("span", { children: node.value || "" }, i);
|
|
819
857
|
}) });
|
|
820
858
|
};
|
|
821
859
|
|
|
822
860
|
// src/components/IncremarkHeading.tsx
|
|
823
|
-
import { jsx as
|
|
861
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
824
862
|
var IncremarkHeading = ({ node }) => {
|
|
825
863
|
const Tag = `h${node.depth}`;
|
|
826
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ jsx5(Tag, { className: `incremark-heading h${node.depth}`, children: /* @__PURE__ */ jsx5(IncremarkInline, { nodes: node.children }) });
|
|
827
865
|
};
|
|
828
866
|
|
|
829
867
|
// src/components/IncremarkParagraph.tsx
|
|
830
|
-
import { jsx as
|
|
868
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
831
869
|
var IncremarkParagraph = ({ node }) => {
|
|
832
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ jsx6("p", { className: "incremark-paragraph", children: /* @__PURE__ */ jsx6(IncremarkInline, { nodes: node.children }) });
|
|
833
871
|
};
|
|
834
872
|
|
|
835
873
|
// src/components/IncremarkCode.tsx
|
|
836
|
-
import
|
|
874
|
+
import React7 from "react";
|
|
875
|
+
|
|
876
|
+
// src/components/IncremarkCodeMermaid.tsx
|
|
877
|
+
import { useState as useState5, useEffect as useEffect4, useRef as useRef5, useCallback as useCallback5 } from "react";
|
|
878
|
+
import { GravityMermaid, LucideCode, LucideEye, LucideCopy, LucideCopyCheck } from "@incremark/icons";
|
|
879
|
+
import { isClipboardAvailable } from "@incremark/shared";
|
|
880
|
+
|
|
881
|
+
// src/components/SvgIcon.tsx
|
|
882
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
883
|
+
var SvgIcon = ({
|
|
884
|
+
svg,
|
|
885
|
+
sizeClass,
|
|
886
|
+
className
|
|
887
|
+
}) => {
|
|
888
|
+
return /* @__PURE__ */ jsx7(
|
|
889
|
+
"span",
|
|
890
|
+
{
|
|
891
|
+
className: `incremark-icon ${sizeClass || ""} ${className || ""}`.trim(),
|
|
892
|
+
dangerouslySetInnerHTML: { __html: svg },
|
|
893
|
+
"aria-hidden": "true"
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/components/IncremarkCodeMermaid.tsx
|
|
899
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
900
|
+
var IncremarkCodeMermaid = ({
|
|
901
|
+
node,
|
|
902
|
+
mermaidDelay = 500
|
|
903
|
+
}) => {
|
|
904
|
+
const [copied, setCopied] = useState5(false);
|
|
905
|
+
const { t } = useLocale();
|
|
906
|
+
const [mermaidSvg, setMermaidSvg] = useState5("");
|
|
907
|
+
const [mermaidLoading, setMermaidLoading] = useState5(false);
|
|
908
|
+
const [mermaidViewMode, setMermaidViewMode] = useState5("preview");
|
|
909
|
+
const mermaidRef = useRef5(null);
|
|
910
|
+
const mermaidTimerRef = useRef5(null);
|
|
911
|
+
const copyTimeoutRef = useRef5(null);
|
|
912
|
+
const code = node.value;
|
|
913
|
+
const toggleMermaidView = useCallback5(() => {
|
|
914
|
+
setMermaidViewMode((prev) => prev === "preview" ? "source" : "preview");
|
|
915
|
+
}, []);
|
|
916
|
+
const copyCode = useCallback5(async () => {
|
|
917
|
+
if (!isClipboardAvailable()) return;
|
|
918
|
+
try {
|
|
919
|
+
await navigator.clipboard.writeText(code);
|
|
920
|
+
setCopied(true);
|
|
921
|
+
if (copyTimeoutRef.current) {
|
|
922
|
+
clearTimeout(copyTimeoutRef.current);
|
|
923
|
+
}
|
|
924
|
+
copyTimeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
925
|
+
} catch {
|
|
926
|
+
}
|
|
927
|
+
}, [code]);
|
|
928
|
+
const doRenderMermaid = useCallback5(async () => {
|
|
929
|
+
if (!code) return;
|
|
930
|
+
try {
|
|
931
|
+
if (!mermaidRef.current) {
|
|
932
|
+
const mermaidModule = await import("mermaid");
|
|
933
|
+
mermaidRef.current = mermaidModule.default;
|
|
934
|
+
mermaidRef.current.initialize({
|
|
935
|
+
startOnLoad: false,
|
|
936
|
+
theme: "dark",
|
|
937
|
+
securityLevel: "loose",
|
|
938
|
+
suppressErrorRendering: true
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
const mermaid = mermaidRef.current;
|
|
942
|
+
const id = `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
943
|
+
const { svg } = await mermaid.render(id, code);
|
|
944
|
+
setMermaidSvg(svg);
|
|
945
|
+
} catch {
|
|
946
|
+
setMermaidSvg("");
|
|
947
|
+
} finally {
|
|
948
|
+
setMermaidLoading(false);
|
|
949
|
+
}
|
|
950
|
+
}, [code]);
|
|
951
|
+
const scheduleRenderMermaid = useCallback5(() => {
|
|
952
|
+
if (!code) return;
|
|
953
|
+
if (mermaidTimerRef.current) {
|
|
954
|
+
clearTimeout(mermaidTimerRef.current);
|
|
955
|
+
}
|
|
956
|
+
setMermaidLoading(true);
|
|
957
|
+
mermaidTimerRef.current = setTimeout(() => {
|
|
958
|
+
doRenderMermaid();
|
|
959
|
+
}, mermaidDelay);
|
|
960
|
+
}, [code, mermaidDelay, doRenderMermaid]);
|
|
961
|
+
useEffect4(() => {
|
|
962
|
+
scheduleRenderMermaid();
|
|
963
|
+
}, [scheduleRenderMermaid]);
|
|
964
|
+
useEffect4(() => {
|
|
965
|
+
return () => {
|
|
966
|
+
if (mermaidTimerRef.current) {
|
|
967
|
+
clearTimeout(mermaidTimerRef.current);
|
|
968
|
+
}
|
|
969
|
+
if (copyTimeoutRef.current) {
|
|
970
|
+
clearTimeout(copyTimeoutRef.current);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
}, []);
|
|
974
|
+
return /* @__PURE__ */ jsxs2("div", { className: "incremark-mermaid", children: [
|
|
975
|
+
/* @__PURE__ */ jsxs2("div", { className: "mermaid-header", children: [
|
|
976
|
+
/* @__PURE__ */ jsxs2("span", { className: "language", children: [
|
|
977
|
+
/* @__PURE__ */ jsx8(SvgIcon, { svg: GravityMermaid, className: "language-icon" }),
|
|
978
|
+
"MERMAID"
|
|
979
|
+
] }),
|
|
980
|
+
/* @__PURE__ */ jsxs2("div", { className: "mermaid-actions", children: [
|
|
981
|
+
/* @__PURE__ */ jsx8(
|
|
982
|
+
"button",
|
|
983
|
+
{
|
|
984
|
+
className: "code-btn",
|
|
985
|
+
onClick: toggleMermaidView,
|
|
986
|
+
type: "button",
|
|
987
|
+
disabled: !mermaidSvg,
|
|
988
|
+
"aria-label": mermaidViewMode === "preview" ? t("mermaid.viewSource") : t("mermaid.preview"),
|
|
989
|
+
title: mermaidViewMode === "preview" ? "View Source" : "Preview",
|
|
990
|
+
children: /* @__PURE__ */ jsx8(SvgIcon, { svg: mermaidViewMode === "preview" ? LucideCode : LucideEye })
|
|
991
|
+
}
|
|
992
|
+
),
|
|
993
|
+
/* @__PURE__ */ jsx8(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
className: "code-btn",
|
|
997
|
+
onClick: copyCode,
|
|
998
|
+
type: "button",
|
|
999
|
+
"aria-label": copied ? t("mermaid.copied") : t("mermaid.copy"),
|
|
1000
|
+
title: copied ? "Copied!" : "Copy",
|
|
1001
|
+
children: /* @__PURE__ */ jsx8(SvgIcon, { svg: copied ? LucideCopyCheck : LucideCopy })
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
] })
|
|
1005
|
+
] }),
|
|
1006
|
+
/* @__PURE__ */ jsx8("div", { className: "mermaid-content", children: mermaidLoading && !mermaidSvg ? /* @__PURE__ */ jsx8("div", { className: "mermaid-loading", children: /* @__PURE__ */ jsx8("pre", { className: "mermaid-source-code", children: code }) }) : mermaidViewMode === "source" ? /* @__PURE__ */ jsx8("pre", { className: "mermaid-source-code", children: code }) : mermaidSvg ? /* @__PURE__ */ jsx8("div", { className: "mermaid-svg", dangerouslySetInnerHTML: { __html: mermaidSvg } }) : /* @__PURE__ */ jsx8("pre", { className: "mermaid-source-code", children: code }) })
|
|
1007
|
+
] });
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
// src/components/IncremarkCodeDefault.tsx
|
|
1011
|
+
import { useState as useState6, useEffect as useEffect5, useCallback as useCallback6, useRef as useRef6 } from "react";
|
|
1012
|
+
import { LucideCopy as LucideCopy2, LucideCopyCheck as LucideCopyCheck2 } from "@incremark/icons";
|
|
1013
|
+
import { isClipboardAvailable as isClipboardAvailable2 } from "@incremark/shared";
|
|
837
1014
|
|
|
838
1015
|
// src/hooks/useShiki.ts
|
|
839
|
-
import
|
|
1016
|
+
import React5 from "react";
|
|
840
1017
|
var ShikiManager = class _ShikiManager {
|
|
841
1018
|
static instance = null;
|
|
842
1019
|
/** 存储 highlighter 实例,key 为主题名称 */
|
|
@@ -928,27 +1105,34 @@ var ShikiManager = class _ShikiManager {
|
|
|
928
1105
|
this.highlighters.clear();
|
|
929
1106
|
}
|
|
930
1107
|
};
|
|
931
|
-
var
|
|
1108
|
+
var shikiManagerInstance = null;
|
|
1109
|
+
function getShikiManager() {
|
|
1110
|
+
if (!shikiManagerInstance) {
|
|
1111
|
+
shikiManagerInstance = ShikiManager.getInstance();
|
|
1112
|
+
}
|
|
1113
|
+
return shikiManagerInstance;
|
|
1114
|
+
}
|
|
932
1115
|
function useShiki(theme) {
|
|
933
|
-
const [isHighlighting, setIsHighlighting] =
|
|
934
|
-
const highlighterInfoRef =
|
|
935
|
-
const getHighlighter =
|
|
1116
|
+
const [isHighlighting, setIsHighlighting] = React5.useState(false);
|
|
1117
|
+
const highlighterInfoRef = React5.useRef(null);
|
|
1118
|
+
const getHighlighter = React5.useCallback(async () => {
|
|
936
1119
|
if (!highlighterInfoRef.current) {
|
|
937
|
-
highlighterInfoRef.current = await
|
|
1120
|
+
highlighterInfoRef.current = await getShikiManager().getHighlighter(theme);
|
|
938
1121
|
}
|
|
939
1122
|
return highlighterInfoRef.current;
|
|
940
1123
|
}, [theme]);
|
|
941
|
-
const highlight =
|
|
1124
|
+
const highlight = React5.useCallback(async (code, lang, fallbackTheme) => {
|
|
942
1125
|
setIsHighlighting(true);
|
|
943
1126
|
try {
|
|
944
1127
|
const info = await getHighlighter();
|
|
1128
|
+
const manager = getShikiManager();
|
|
945
1129
|
if (!info.loadedLanguages.has(lang) && lang !== "text") {
|
|
946
|
-
await
|
|
1130
|
+
await manager.loadLanguage(theme, lang);
|
|
947
1131
|
}
|
|
948
1132
|
if (!info.loadedThemes.has(theme)) {
|
|
949
|
-
await
|
|
1133
|
+
await manager.loadTheme(theme);
|
|
950
1134
|
}
|
|
951
|
-
return await
|
|
1135
|
+
return await manager.codeToHtml(theme, code, lang, fallbackTheme);
|
|
952
1136
|
} catch (e) {
|
|
953
1137
|
throw e;
|
|
954
1138
|
} finally {
|
|
@@ -961,90 +1145,41 @@ function useShiki(theme) {
|
|
|
961
1145
|
};
|
|
962
1146
|
}
|
|
963
1147
|
|
|
964
|
-
// src/components/
|
|
965
|
-
import { jsx as
|
|
966
|
-
var
|
|
1148
|
+
// src/components/IncremarkCodeDefault.tsx
|
|
1149
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1150
|
+
var IncremarkCodeDefault = ({
|
|
967
1151
|
node,
|
|
968
1152
|
theme = "github-dark",
|
|
969
1153
|
fallbackTheme = "github-dark",
|
|
970
|
-
disableHighlight = false
|
|
971
|
-
mermaidDelay = 500,
|
|
972
|
-
customCodeBlocks,
|
|
973
|
-
blockStatus = "completed",
|
|
974
|
-
codeBlockConfigs
|
|
1154
|
+
disableHighlight = false
|
|
975
1155
|
}) => {
|
|
976
|
-
const [copied, setCopied] =
|
|
977
|
-
const [highlightedHtml, setHighlightedHtml] =
|
|
978
|
-
const [mermaidSvg, setMermaidSvg] = useState5("");
|
|
979
|
-
const [mermaidLoading, setMermaidLoading] = useState5(false);
|
|
980
|
-
const [mermaidViewMode, setMermaidViewMode] = useState5("preview");
|
|
981
|
-
const mermaidRef = useRef5(null);
|
|
982
|
-
const mermaidTimerRef = useRef5(null);
|
|
1156
|
+
const [copied, setCopied] = useState6(false);
|
|
1157
|
+
const [highlightedHtml, setHighlightedHtml] = useState6("");
|
|
983
1158
|
const language = node.lang || "text";
|
|
984
1159
|
const code = node.value;
|
|
985
|
-
const
|
|
1160
|
+
const { t } = useLocale();
|
|
986
1161
|
const { isHighlighting, highlight } = useShiki(theme);
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
if (!
|
|
990
|
-
const config = codeBlockConfigs?.[language];
|
|
991
|
-
if (config?.takeOver) {
|
|
992
|
-
return component;
|
|
993
|
-
}
|
|
994
|
-
if (blockStatus !== "completed") {
|
|
995
|
-
return null;
|
|
996
|
-
}
|
|
997
|
-
return component;
|
|
998
|
-
}, [customCodeBlocks, language, blockStatus, codeBlockConfigs]);
|
|
999
|
-
const toggleMermaidView = useCallback5(() => {
|
|
1000
|
-
setMermaidViewMode((prev) => prev === "preview" ? "source" : "preview");
|
|
1001
|
-
}, []);
|
|
1002
|
-
const copyCode = useCallback5(async () => {
|
|
1162
|
+
const copyTimeoutRef = useRef6(null);
|
|
1163
|
+
const copyCode = useCallback6(async () => {
|
|
1164
|
+
if (!isClipboardAvailable2()) return;
|
|
1003
1165
|
try {
|
|
1004
1166
|
await navigator.clipboard.writeText(code);
|
|
1005
1167
|
setCopied(true);
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
}
|
|
1009
|
-
}, [code]);
|
|
1010
|
-
const doRenderMermaid = useCallback5(async () => {
|
|
1011
|
-
if (!code) return;
|
|
1012
|
-
try {
|
|
1013
|
-
if (!mermaidRef.current) {
|
|
1014
|
-
const mermaidModule = await import("mermaid");
|
|
1015
|
-
mermaidRef.current = mermaidModule.default;
|
|
1016
|
-
mermaidRef.current.initialize({
|
|
1017
|
-
startOnLoad: false,
|
|
1018
|
-
theme: "dark",
|
|
1019
|
-
securityLevel: "loose",
|
|
1020
|
-
suppressErrorRendering: true
|
|
1021
|
-
});
|
|
1168
|
+
if (copyTimeoutRef.current) {
|
|
1169
|
+
clearTimeout(copyTimeoutRef.current);
|
|
1022
1170
|
}
|
|
1023
|
-
|
|
1024
|
-
const id = `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1025
|
-
const { svg } = await mermaid.render(id, code);
|
|
1026
|
-
setMermaidSvg(svg);
|
|
1171
|
+
copyTimeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
1027
1172
|
} catch {
|
|
1028
|
-
setMermaidSvg("");
|
|
1029
|
-
} finally {
|
|
1030
|
-
setMermaidLoading(false);
|
|
1031
1173
|
}
|
|
1032
1174
|
}, [code]);
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
}, mermaidDelay);
|
|
1042
|
-
}, [isMermaid, code, mermaidDelay, doRenderMermaid]);
|
|
1043
|
-
const doHighlight = useCallback5(async () => {
|
|
1044
|
-
if (isMermaid) {
|
|
1045
|
-
scheduleRenderMermaid();
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1175
|
+
useEffect5(() => {
|
|
1176
|
+
return () => {
|
|
1177
|
+
if (copyTimeoutRef.current) {
|
|
1178
|
+
clearTimeout(copyTimeoutRef.current);
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
}, []);
|
|
1182
|
+
const doHighlight = useCallback6(async () => {
|
|
1048
1183
|
if (!code || disableHighlight) {
|
|
1049
1184
|
setHighlightedHtml("");
|
|
1050
1185
|
return;
|
|
@@ -1055,20 +1190,60 @@ var IncremarkCode = ({
|
|
|
1055
1190
|
} catch {
|
|
1056
1191
|
setHighlightedHtml("");
|
|
1057
1192
|
}
|
|
1058
|
-
}, [code, language, fallbackTheme, disableHighlight,
|
|
1059
|
-
|
|
1193
|
+
}, [code, language, fallbackTheme, disableHighlight, highlight]);
|
|
1194
|
+
useEffect5(() => {
|
|
1060
1195
|
doHighlight();
|
|
1061
1196
|
}, [doHighlight]);
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1197
|
+
return /* @__PURE__ */ jsxs3("div", { className: "incremark-code", children: [
|
|
1198
|
+
/* @__PURE__ */ jsxs3("div", { className: "code-header", children: [
|
|
1199
|
+
/* @__PURE__ */ jsx9("span", { className: "language", children: language }),
|
|
1200
|
+
/* @__PURE__ */ jsx9(
|
|
1201
|
+
"button",
|
|
1202
|
+
{
|
|
1203
|
+
className: "code-btn",
|
|
1204
|
+
onClick: copyCode,
|
|
1205
|
+
type: "button",
|
|
1206
|
+
"aria-label": copied ? t("code.copied") : t("code.copy"),
|
|
1207
|
+
title: copied ? "Copied!" : "Copy",
|
|
1208
|
+
children: /* @__PURE__ */ jsx9(SvgIcon, { svg: copied ? LucideCopyCheck2 : LucideCopy2 })
|
|
1209
|
+
}
|
|
1210
|
+
)
|
|
1211
|
+
] }),
|
|
1212
|
+
/* @__PURE__ */ jsx9("div", { className: "code-content", children: isHighlighting && !highlightedHtml ? /* @__PURE__ */ jsx9("div", { className: "code-loading", children: /* @__PURE__ */ jsx9("pre", { children: /* @__PURE__ */ jsx9("code", { children: code }) }) }) : highlightedHtml ? /* @__PURE__ */ jsx9("div", { className: "shiki-wrapper", dangerouslySetInnerHTML: { __html: highlightedHtml } }) : /* @__PURE__ */ jsx9("pre", { className: "code-fallback", children: /* @__PURE__ */ jsx9("code", { children: code }) }) })
|
|
1213
|
+
] });
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
// src/components/IncremarkCode.tsx
|
|
1217
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1218
|
+
var IncremarkCode = ({
|
|
1219
|
+
node,
|
|
1220
|
+
theme = "github-dark",
|
|
1221
|
+
fallbackTheme = "github-dark",
|
|
1222
|
+
disableHighlight = false,
|
|
1223
|
+
mermaidDelay = 500,
|
|
1224
|
+
customCodeBlocks,
|
|
1225
|
+
blockStatus = "completed",
|
|
1226
|
+
codeBlockConfigs,
|
|
1227
|
+
defaultCodeComponent: DefaultCodeComponent = IncremarkCodeDefault
|
|
1228
|
+
}) => {
|
|
1229
|
+
const language = node.lang || "text";
|
|
1230
|
+
const code = node.value;
|
|
1231
|
+
const isMermaid = language === "mermaid";
|
|
1232
|
+
const CustomCodeBlock = React7.useMemo(() => {
|
|
1233
|
+
const component = customCodeBlocks?.[language];
|
|
1234
|
+
if (!component) return null;
|
|
1235
|
+
const config = codeBlockConfigs?.[language];
|
|
1236
|
+
if (config?.takeOver) {
|
|
1237
|
+
return component;
|
|
1238
|
+
}
|
|
1239
|
+
if (blockStatus !== "completed") {
|
|
1240
|
+
return null;
|
|
1241
|
+
}
|
|
1242
|
+
return component;
|
|
1243
|
+
}, [customCodeBlocks, language, blockStatus, codeBlockConfigs]);
|
|
1069
1244
|
if (CustomCodeBlock) {
|
|
1070
1245
|
const config = codeBlockConfigs?.[language];
|
|
1071
|
-
return /* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ jsx10(
|
|
1072
1247
|
CustomCodeBlock,
|
|
1073
1248
|
{
|
|
1074
1249
|
codeStr: code,
|
|
@@ -1079,38 +1254,28 @@ var IncremarkCode = ({
|
|
|
1079
1254
|
);
|
|
1080
1255
|
}
|
|
1081
1256
|
if (isMermaid) {
|
|
1082
|
-
return /* @__PURE__ */
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
className: "code-btn",
|
|
1090
|
-
onClick: toggleMermaidView,
|
|
1091
|
-
type: "button",
|
|
1092
|
-
disabled: !mermaidSvg,
|
|
1093
|
-
children: mermaidViewMode === "preview" ? "\u6E90\u7801" : "\u9884\u89C8"
|
|
1094
|
-
}
|
|
1095
|
-
),
|
|
1096
|
-
/* @__PURE__ */ jsx6("button", { className: "code-btn", onClick: copyCode, type: "button", children: copied ? "\u2713 \u5DF2\u590D\u5236" : "\u590D\u5236" })
|
|
1097
|
-
] })
|
|
1098
|
-
] }),
|
|
1099
|
-
/* @__PURE__ */ jsx6("div", { className: "mermaid-content", children: mermaidLoading && !mermaidSvg ? /* @__PURE__ */ jsx6("div", { className: "mermaid-loading", children: /* @__PURE__ */ jsx6("pre", { className: "mermaid-source-code", children: code }) }) : mermaidViewMode === "source" ? /* @__PURE__ */ jsx6("pre", { className: "mermaid-source-code", children: code }) : mermaidSvg ? /* @__PURE__ */ jsx6("div", { className: "mermaid-svg", dangerouslySetInnerHTML: { __html: mermaidSvg } }) : /* @__PURE__ */ jsx6("pre", { className: "mermaid-source-code", children: code }) })
|
|
1100
|
-
] });
|
|
1257
|
+
return /* @__PURE__ */ jsx10(
|
|
1258
|
+
IncremarkCodeMermaid,
|
|
1259
|
+
{
|
|
1260
|
+
node,
|
|
1261
|
+
mermaidDelay
|
|
1262
|
+
}
|
|
1263
|
+
);
|
|
1101
1264
|
}
|
|
1102
|
-
return /* @__PURE__ */
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1265
|
+
return /* @__PURE__ */ jsx10(
|
|
1266
|
+
DefaultCodeComponent,
|
|
1267
|
+
{
|
|
1268
|
+
node,
|
|
1269
|
+
theme,
|
|
1270
|
+
fallbackTheme,
|
|
1271
|
+
disableHighlight
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1109
1274
|
};
|
|
1110
1275
|
|
|
1111
1276
|
// src/components/IncremarkList.tsx
|
|
1112
|
-
import
|
|
1113
|
-
import { jsx as
|
|
1277
|
+
import React8 from "react";
|
|
1278
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1114
1279
|
function getItemInlineContent(item) {
|
|
1115
1280
|
const firstChild = item.children[0];
|
|
1116
1281
|
if (firstChild?.type === "paragraph") {
|
|
@@ -1129,13 +1294,13 @@ function getItemBlockChildren(item) {
|
|
|
1129
1294
|
var IncremarkList = ({ node }) => {
|
|
1130
1295
|
const Tag = node.ordered ? "ol" : "ul";
|
|
1131
1296
|
const isTaskList = node.children?.some((item) => item.checked !== null && item.checked !== void 0);
|
|
1132
|
-
return /* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ jsx11(Tag, { className: `incremark-list ${isTaskList ? "task-list" : ""}`, start: node.start || void 0, children: node.children?.map((item, index) => {
|
|
1133
1298
|
const isTaskItem = item.checked !== null && item.checked !== void 0;
|
|
1134
1299
|
const inlineContent = getItemInlineContent(item);
|
|
1135
1300
|
const blockChildren = getItemBlockChildren(item);
|
|
1136
1301
|
if (isTaskItem) {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ jsx11("li", { className: "incremark-list-item task-item", children: /* @__PURE__ */ jsxs4("label", { className: "task-label", children: [
|
|
1303
|
+
/* @__PURE__ */ jsx11(
|
|
1139
1304
|
"input",
|
|
1140
1305
|
{
|
|
1141
1306
|
type: "checkbox",
|
|
@@ -1144,43 +1309,43 @@ var IncremarkList = ({ node }) => {
|
|
|
1144
1309
|
className: "checkbox"
|
|
1145
1310
|
}
|
|
1146
1311
|
),
|
|
1147
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ jsx11("span", { className: "task-content", children: /* @__PURE__ */ jsx11(IncremarkInline, { nodes: inlineContent }) })
|
|
1148
1313
|
] }) }, index);
|
|
1149
1314
|
}
|
|
1150
|
-
return /* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
blockChildren.map((child, childIndex) => /* @__PURE__ */
|
|
1315
|
+
return /* @__PURE__ */ jsxs4("li", { className: "incremark-list-item", children: [
|
|
1316
|
+
/* @__PURE__ */ jsx11(IncremarkInline, { nodes: inlineContent }),
|
|
1317
|
+
blockChildren.map((child, childIndex) => /* @__PURE__ */ jsx11(React8.Fragment, { children: /* @__PURE__ */ jsx11(IncremarkRenderer, { node: child }) }, childIndex))
|
|
1153
1318
|
] }, index);
|
|
1154
1319
|
}) });
|
|
1155
1320
|
};
|
|
1156
1321
|
|
|
1157
1322
|
// src/components/IncremarkBlockquote.tsx
|
|
1158
|
-
import
|
|
1159
|
-
import { jsx as
|
|
1323
|
+
import React9 from "react";
|
|
1324
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1160
1325
|
var IncremarkBlockquote = ({ node }) => {
|
|
1161
|
-
return /* @__PURE__ */
|
|
1326
|
+
return /* @__PURE__ */ jsx12("blockquote", { className: "incremark-blockquote", children: node.children.map((child, index) => /* @__PURE__ */ jsx12(React9.Fragment, { children: /* @__PURE__ */ jsx12(IncremarkRenderer, { node: child }) }, index)) });
|
|
1162
1327
|
};
|
|
1163
1328
|
|
|
1164
1329
|
// src/components/IncremarkTable.tsx
|
|
1165
|
-
import { jsx as
|
|
1330
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1166
1331
|
function getCellContent(cell) {
|
|
1167
1332
|
return cell.children;
|
|
1168
1333
|
}
|
|
1169
1334
|
var IncremarkTable = ({ node }) => {
|
|
1170
|
-
return /* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ jsx13("div", { className: "incremark-table-wrapper", children: /* @__PURE__ */ jsxs5("table", { className: "incremark-table", children: [
|
|
1336
|
+
/* @__PURE__ */ jsx13("thead", { children: node.children?.[0] && /* @__PURE__ */ jsx13("tr", { children: node.children[0].children.map((cell, cellIndex) => /* @__PURE__ */ jsx13(
|
|
1172
1337
|
"th",
|
|
1173
1338
|
{
|
|
1174
|
-
|
|
1175
|
-
children: /* @__PURE__ */
|
|
1339
|
+
className: `incremark-table-align-${node.align?.[cellIndex] || "left"}`,
|
|
1340
|
+
children: /* @__PURE__ */ jsx13(IncremarkInline, { nodes: getCellContent(cell) })
|
|
1176
1341
|
},
|
|
1177
1342
|
cellIndex
|
|
1178
1343
|
)) }) }),
|
|
1179
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ jsx13("tbody", { children: node.children?.slice(1).map((row, rowIndex) => /* @__PURE__ */ jsx13("tr", { children: row.children.map((cell, cellIndex) => /* @__PURE__ */ jsx13(
|
|
1180
1345
|
"td",
|
|
1181
1346
|
{
|
|
1182
|
-
|
|
1183
|
-
children: /* @__PURE__ */
|
|
1347
|
+
className: `incremark-table-align-${node.align?.[cellIndex] || "left"}`,
|
|
1348
|
+
children: /* @__PURE__ */ jsx13(IncremarkInline, { nodes: getCellContent(cell) })
|
|
1184
1349
|
},
|
|
1185
1350
|
cellIndex
|
|
1186
1351
|
)) }, rowIndex)) })
|
|
@@ -1188,25 +1353,25 @@ var IncremarkTable = ({ node }) => {
|
|
|
1188
1353
|
};
|
|
1189
1354
|
|
|
1190
1355
|
// src/components/IncremarkThematicBreak.tsx
|
|
1191
|
-
import { jsx as
|
|
1356
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1192
1357
|
var IncremarkThematicBreak = () => {
|
|
1193
|
-
return /* @__PURE__ */
|
|
1358
|
+
return /* @__PURE__ */ jsx14("hr", { className: "incremark-hr" });
|
|
1194
1359
|
};
|
|
1195
1360
|
|
|
1196
1361
|
// src/components/IncremarkMath.tsx
|
|
1197
|
-
import { useState as
|
|
1198
|
-
import { jsx as
|
|
1362
|
+
import { useState as useState7, useEffect as useEffect6, useRef as useRef7, useCallback as useCallback7 } from "react";
|
|
1363
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1199
1364
|
var IncremarkMath = ({
|
|
1200
1365
|
node,
|
|
1201
1366
|
renderDelay = 300
|
|
1202
1367
|
}) => {
|
|
1203
|
-
const [renderedHtml, setRenderedHtml] =
|
|
1204
|
-
const [isLoading, setIsLoading] =
|
|
1205
|
-
const katexRef =
|
|
1206
|
-
const renderTimerRef =
|
|
1368
|
+
const [renderedHtml, setRenderedHtml] = useState7("");
|
|
1369
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1370
|
+
const katexRef = useRef7(null);
|
|
1371
|
+
const renderTimerRef = useRef7(null);
|
|
1207
1372
|
const isInline = node.type === "inlineMath";
|
|
1208
1373
|
const formula = node.value;
|
|
1209
|
-
const doRender =
|
|
1374
|
+
const doRender = useCallback7(async () => {
|
|
1210
1375
|
if (!formula) return;
|
|
1211
1376
|
try {
|
|
1212
1377
|
if (!katexRef.current) {
|
|
@@ -1226,7 +1391,7 @@ var IncremarkMath = ({
|
|
|
1226
1391
|
setIsLoading(false);
|
|
1227
1392
|
}
|
|
1228
1393
|
}, [formula, isInline]);
|
|
1229
|
-
const scheduleRender =
|
|
1394
|
+
const scheduleRender = useCallback7(() => {
|
|
1230
1395
|
if (!formula) {
|
|
1231
1396
|
setRenderedHtml("");
|
|
1232
1397
|
return;
|
|
@@ -1239,10 +1404,10 @@ var IncremarkMath = ({
|
|
|
1239
1404
|
doRender();
|
|
1240
1405
|
}, renderDelay);
|
|
1241
1406
|
}, [formula, renderDelay, doRender]);
|
|
1242
|
-
|
|
1407
|
+
useEffect6(() => {
|
|
1243
1408
|
scheduleRender();
|
|
1244
1409
|
}, [scheduleRender]);
|
|
1245
|
-
|
|
1410
|
+
useEffect6(() => {
|
|
1246
1411
|
return () => {
|
|
1247
1412
|
if (renderTimerRef.current) {
|
|
1248
1413
|
clearTimeout(renderTimerRef.current);
|
|
@@ -1250,13 +1415,13 @@ var IncremarkMath = ({
|
|
|
1250
1415
|
};
|
|
1251
1416
|
}, []);
|
|
1252
1417
|
if (isInline) {
|
|
1253
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ jsx15("span", { className: "incremark-math-inline", children: renderedHtml && !isLoading ? /* @__PURE__ */ jsx15("span", { dangerouslySetInnerHTML: { __html: renderedHtml } }) : /* @__PURE__ */ jsx15("code", { className: "math-source", children: formula }) });
|
|
1254
1419
|
}
|
|
1255
|
-
return /* @__PURE__ */
|
|
1420
|
+
return /* @__PURE__ */ jsx15("div", { className: "incremark-math-block", children: renderedHtml && !isLoading ? /* @__PURE__ */ jsx15("div", { className: "math-rendered", dangerouslySetInnerHTML: { __html: renderedHtml } }) : /* @__PURE__ */ jsx15("pre", { className: "math-source-block", children: /* @__PURE__ */ jsx15("code", { children: formula }) }) });
|
|
1256
1421
|
};
|
|
1257
1422
|
|
|
1258
1423
|
// src/components/IncremarkContainer.tsx
|
|
1259
|
-
import { jsx as
|
|
1424
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1260
1425
|
function parseOptions(attributes) {
|
|
1261
1426
|
if (!attributes) return {};
|
|
1262
1427
|
const options = {};
|
|
@@ -1274,22 +1439,22 @@ var IncremarkContainer = ({ node, customContainers }) => {
|
|
|
1274
1439
|
const options = parseOptions(node.attributes);
|
|
1275
1440
|
const CustomContainer = customContainers?.[containerName];
|
|
1276
1441
|
if (CustomContainer) {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ jsx16(CustomContainer, { name: containerName, options, children: node.children?.map((child, index) => /* @__PURE__ */ jsx16(IncremarkRenderer, { node: child }, index)) });
|
|
1278
1443
|
}
|
|
1279
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ jsx16("div", { className: `incremark-container incremark-container-${containerName}`, children: node.children && node.children.length > 0 && /* @__PURE__ */ jsx16("div", { className: "incremark-container-content", children: node.children.map((child, index) => /* @__PURE__ */ jsx16(IncremarkRenderer, { node: child }, index)) }) });
|
|
1280
1445
|
};
|
|
1281
1446
|
|
|
1282
1447
|
// src/components/IncremarkDefault.tsx
|
|
1283
|
-
import { jsx as
|
|
1448
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1284
1449
|
var IncremarkDefault = ({ node }) => {
|
|
1285
|
-
return /* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1450
|
+
return /* @__PURE__ */ jsxs6("div", { className: "incremark-default", children: [
|
|
1451
|
+
/* @__PURE__ */ jsx17("span", { className: "type-badge", children: node.type }),
|
|
1452
|
+
/* @__PURE__ */ jsx17("pre", { children: JSON.stringify(node, null, 2) })
|
|
1288
1453
|
] });
|
|
1289
1454
|
};
|
|
1290
1455
|
|
|
1291
1456
|
// src/components/IncremarkRenderer.tsx
|
|
1292
|
-
import { jsx as
|
|
1457
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1293
1458
|
var defaultComponents = {
|
|
1294
1459
|
heading: IncremarkHeading,
|
|
1295
1460
|
paragraph: IncremarkParagraph,
|
|
@@ -1325,10 +1490,10 @@ var IncremarkRenderer = ({
|
|
|
1325
1490
|
return null;
|
|
1326
1491
|
}
|
|
1327
1492
|
if (isHtmlNode2(node)) {
|
|
1328
|
-
return /* @__PURE__ */
|
|
1493
|
+
return /* @__PURE__ */ jsx18("pre", { className: "incremark-html-code", children: /* @__PURE__ */ jsx18("code", { children: node.value }) });
|
|
1329
1494
|
}
|
|
1330
1495
|
if (isContainerNode(node)) {
|
|
1331
|
-
return /* @__PURE__ */
|
|
1496
|
+
return /* @__PURE__ */ jsx18(
|
|
1332
1497
|
IncremarkContainer,
|
|
1333
1498
|
{
|
|
1334
1499
|
node,
|
|
@@ -1337,26 +1502,27 @@ var IncremarkRenderer = ({
|
|
|
1337
1502
|
);
|
|
1338
1503
|
}
|
|
1339
1504
|
if (node.type === "code") {
|
|
1340
|
-
return /* @__PURE__ */
|
|
1505
|
+
return /* @__PURE__ */ jsx18(
|
|
1341
1506
|
IncremarkCode,
|
|
1342
1507
|
{
|
|
1343
1508
|
node,
|
|
1344
1509
|
customCodeBlocks,
|
|
1345
1510
|
codeBlockConfigs,
|
|
1346
|
-
blockStatus
|
|
1511
|
+
blockStatus,
|
|
1512
|
+
defaultCodeComponent: components?.["code"]
|
|
1347
1513
|
}
|
|
1348
1514
|
);
|
|
1349
1515
|
}
|
|
1350
1516
|
const Component = getComponent(node.type, components);
|
|
1351
|
-
return /* @__PURE__ */
|
|
1517
|
+
return /* @__PURE__ */ jsx18(Component, { node });
|
|
1352
1518
|
};
|
|
1353
1519
|
|
|
1354
1520
|
// src/components/IncremarkFootnotes.tsx
|
|
1355
|
-
import
|
|
1356
|
-
import { jsx as
|
|
1521
|
+
import React11 from "react";
|
|
1522
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1357
1523
|
var IncremarkFootnotes = () => {
|
|
1358
1524
|
const { footnoteDefinitions, footnoteReferenceOrder } = useDefinitions();
|
|
1359
|
-
const orderedFootnotes =
|
|
1525
|
+
const orderedFootnotes = React11.useMemo(() => {
|
|
1360
1526
|
return footnoteReferenceOrder.map((identifier) => ({
|
|
1361
1527
|
identifier,
|
|
1362
1528
|
definition: footnoteDefinitions[identifier]
|
|
@@ -1365,22 +1531,22 @@ var IncremarkFootnotes = () => {
|
|
|
1365
1531
|
if (orderedFootnotes.length === 0) {
|
|
1366
1532
|
return null;
|
|
1367
1533
|
}
|
|
1368
|
-
return /* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1534
|
+
return /* @__PURE__ */ jsxs7("section", { className: "incremark-footnotes", children: [
|
|
1535
|
+
/* @__PURE__ */ jsx19("hr", { className: "incremark-footnotes-divider" }),
|
|
1536
|
+
/* @__PURE__ */ jsx19("ol", { className: "incremark-footnotes-list", children: orderedFootnotes.map((item, index) => /* @__PURE__ */ jsxs7(
|
|
1371
1537
|
"li",
|
|
1372
1538
|
{
|
|
1373
1539
|
id: `fn-${item.identifier}`,
|
|
1374
1540
|
className: "incremark-footnote-item",
|
|
1375
1541
|
children: [
|
|
1376
|
-
/* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ jsxs7("div", { className: "incremark-footnote-content", children: [
|
|
1543
|
+
/* @__PURE__ */ jsxs7("span", { className: "incremark-footnote-number", children: [
|
|
1378
1544
|
index + 1,
|
|
1379
1545
|
"."
|
|
1380
1546
|
] }),
|
|
1381
|
-
/* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ jsx19("div", { className: "incremark-footnote-body", children: item.definition.children.map((child, childIndex) => /* @__PURE__ */ jsx19(IncremarkRenderer, { node: child }, childIndex)) })
|
|
1382
1548
|
] }),
|
|
1383
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ jsx19(
|
|
1384
1550
|
"a",
|
|
1385
1551
|
{
|
|
1386
1552
|
href: `#fnref-${item.identifier}`,
|
|
@@ -1397,13 +1563,13 @@ var IncremarkFootnotes = () => {
|
|
|
1397
1563
|
};
|
|
1398
1564
|
|
|
1399
1565
|
// src/components/IncremarkContainerProvider.tsx
|
|
1400
|
-
import { jsx as
|
|
1566
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1401
1567
|
var IncremarkContainerProvider = ({ children, definitions }) => {
|
|
1402
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ jsx20(DefinitionsContext.Provider, { value: definitions, children });
|
|
1403
1569
|
};
|
|
1404
1570
|
|
|
1405
1571
|
// src/components/Incremark.tsx
|
|
1406
|
-
import { jsx as
|
|
1572
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1407
1573
|
var Incremark = (props) => {
|
|
1408
1574
|
const {
|
|
1409
1575
|
blocks: propsBlocks,
|
|
@@ -1419,7 +1585,7 @@ var Incremark = (props) => {
|
|
|
1419
1585
|
} = props;
|
|
1420
1586
|
if (incremark) {
|
|
1421
1587
|
const { blocks: blocks2, isDisplayComplete: isDisplayComplete2, _definitionsContextValue } = incremark;
|
|
1422
|
-
return /* @__PURE__ */
|
|
1588
|
+
return /* @__PURE__ */ jsx21(IncremarkContainerProvider, { definitions: _definitionsContextValue, children: /* @__PURE__ */ jsx21(
|
|
1423
1589
|
IncremarkInternal,
|
|
1424
1590
|
{
|
|
1425
1591
|
blocks: blocks2,
|
|
@@ -1436,7 +1602,7 @@ var Incremark = (props) => {
|
|
|
1436
1602
|
}
|
|
1437
1603
|
const blocks = propsBlocks || [];
|
|
1438
1604
|
const isDisplayComplete = propsIsDisplayComplete;
|
|
1439
|
-
return /* @__PURE__ */
|
|
1605
|
+
return /* @__PURE__ */ jsx21(
|
|
1440
1606
|
IncremarkInternal,
|
|
1441
1607
|
{
|
|
1442
1608
|
blocks,
|
|
@@ -1463,7 +1629,7 @@ var IncremarkInternal = ({
|
|
|
1463
1629
|
completedClass,
|
|
1464
1630
|
isDisplayComplete
|
|
1465
1631
|
}) => {
|
|
1466
|
-
return /* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ jsxs8("div", { className: `incremark ${className}`, children: [
|
|
1467
1633
|
blocks.map((block) => {
|
|
1468
1634
|
if (block.node.type === "definition" || block.node.type === "footnoteDefinition") {
|
|
1469
1635
|
return null;
|
|
@@ -1475,7 +1641,7 @@ var IncremarkInternal = ({
|
|
|
1475
1641
|
showBlockStatus && "incremark-show-status",
|
|
1476
1642
|
block.isLastPending && "incremark-last-pending"
|
|
1477
1643
|
].filter(Boolean).join(" ");
|
|
1478
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ jsx21("div", { className: classes, children: /* @__PURE__ */ jsx21(
|
|
1479
1645
|
IncremarkRenderer,
|
|
1480
1646
|
{
|
|
1481
1647
|
node: block.node,
|
|
@@ -1487,13 +1653,13 @@ var IncremarkInternal = ({
|
|
|
1487
1653
|
}
|
|
1488
1654
|
) }, block.id);
|
|
1489
1655
|
}),
|
|
1490
|
-
isDisplayComplete && /* @__PURE__ */
|
|
1656
|
+
isDisplayComplete && /* @__PURE__ */ jsx21(IncremarkFootnotes, {})
|
|
1491
1657
|
] });
|
|
1492
1658
|
};
|
|
1493
1659
|
|
|
1494
1660
|
// src/components/IncremarkContent.tsx
|
|
1495
|
-
import { useEffect as
|
|
1496
|
-
import { jsx as
|
|
1661
|
+
import { useEffect as useEffect7, useRef as useRef8, useMemo as useMemo4, useCallback as useCallback8 } from "react";
|
|
1662
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1497
1663
|
var IncremarkContent = (props) => {
|
|
1498
1664
|
const {
|
|
1499
1665
|
stream,
|
|
@@ -1507,7 +1673,7 @@ var IncremarkContent = (props) => {
|
|
|
1507
1673
|
showBlockStatus,
|
|
1508
1674
|
pendingClass
|
|
1509
1675
|
} = props;
|
|
1510
|
-
const initialOptionsRef =
|
|
1676
|
+
const initialOptionsRef = useRef8({
|
|
1511
1677
|
gfm: true,
|
|
1512
1678
|
htmlTree: true,
|
|
1513
1679
|
containers: true,
|
|
@@ -1515,15 +1681,15 @@ var IncremarkContent = (props) => {
|
|
|
1515
1681
|
...incremarkOptions
|
|
1516
1682
|
});
|
|
1517
1683
|
const { blocks, append, finalize, render, reset, isDisplayComplete, markdown, typewriter, _definitionsContextValue } = useIncremark(initialOptionsRef.current);
|
|
1518
|
-
|
|
1684
|
+
useEffect7(() => {
|
|
1519
1685
|
if (incremarkOptions?.typewriter) {
|
|
1520
1686
|
typewriter.setOptions(incremarkOptions.typewriter);
|
|
1521
1687
|
}
|
|
1522
1688
|
}, [incremarkOptions?.typewriter, typewriter]);
|
|
1523
|
-
const isStreamMode =
|
|
1524
|
-
const prevContentRef =
|
|
1525
|
-
const isStreamingRef =
|
|
1526
|
-
const handleStreamInput =
|
|
1689
|
+
const isStreamMode = useMemo4(() => typeof stream === "function", [stream]);
|
|
1690
|
+
const prevContentRef = useRef8(void 0);
|
|
1691
|
+
const isStreamingRef = useRef8(false);
|
|
1692
|
+
const handleStreamInput = useCallback8(async () => {
|
|
1527
1693
|
if (!stream || isStreamingRef.current) return;
|
|
1528
1694
|
isStreamingRef.current = true;
|
|
1529
1695
|
try {
|
|
@@ -1539,7 +1705,7 @@ var IncremarkContent = (props) => {
|
|
|
1539
1705
|
isStreamingRef.current = false;
|
|
1540
1706
|
}
|
|
1541
1707
|
}, [stream, append, finalize]);
|
|
1542
|
-
const handleContentInput =
|
|
1708
|
+
const handleContentInput = useCallback8((newContent, oldContent) => {
|
|
1543
1709
|
if (!newContent) {
|
|
1544
1710
|
if (oldContent) {
|
|
1545
1711
|
reset();
|
|
@@ -1553,7 +1719,7 @@ var IncremarkContent = (props) => {
|
|
|
1553
1719
|
render(newContent);
|
|
1554
1720
|
}
|
|
1555
1721
|
}, [append, render, reset]);
|
|
1556
|
-
|
|
1722
|
+
useEffect7(() => {
|
|
1557
1723
|
if (isStreamMode) {
|
|
1558
1724
|
handleStreamInput();
|
|
1559
1725
|
} else {
|
|
@@ -1561,12 +1727,12 @@ var IncremarkContent = (props) => {
|
|
|
1561
1727
|
}
|
|
1562
1728
|
prevContentRef.current = content;
|
|
1563
1729
|
}, [content, isStreamMode, handleStreamInput, handleContentInput]);
|
|
1564
|
-
|
|
1730
|
+
useEffect7(() => {
|
|
1565
1731
|
if (isFinished && content === markdown) {
|
|
1566
1732
|
finalize();
|
|
1567
1733
|
}
|
|
1568
1734
|
}, [isFinished, content, markdown, finalize]);
|
|
1569
|
-
return /* @__PURE__ */
|
|
1735
|
+
return /* @__PURE__ */ jsx22(IncremarkContainerProvider, { definitions: _definitionsContextValue, children: /* @__PURE__ */ jsx22(
|
|
1570
1736
|
Incremark,
|
|
1571
1737
|
{
|
|
1572
1738
|
blocks,
|
|
@@ -1583,14 +1749,14 @@ var IncremarkContent = (props) => {
|
|
|
1583
1749
|
|
|
1584
1750
|
// src/components/AutoScrollContainer.tsx
|
|
1585
1751
|
import {
|
|
1586
|
-
useRef as
|
|
1587
|
-
useEffect as
|
|
1588
|
-
useCallback as
|
|
1589
|
-
useState as
|
|
1752
|
+
useRef as useRef9,
|
|
1753
|
+
useEffect as useEffect8,
|
|
1754
|
+
useCallback as useCallback9,
|
|
1755
|
+
useState as useState8,
|
|
1590
1756
|
forwardRef,
|
|
1591
1757
|
useImperativeHandle
|
|
1592
1758
|
} from "react";
|
|
1593
|
-
import { jsx as
|
|
1759
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1594
1760
|
var AutoScrollContainer = forwardRef(
|
|
1595
1761
|
({
|
|
1596
1762
|
children,
|
|
@@ -1600,17 +1766,17 @@ var AutoScrollContainer = forwardRef(
|
|
|
1600
1766
|
style,
|
|
1601
1767
|
className
|
|
1602
1768
|
}, ref) => {
|
|
1603
|
-
const containerRef =
|
|
1604
|
-
const [isUserScrolledUp, setIsUserScrolledUp] =
|
|
1605
|
-
const lastScrollTopRef =
|
|
1606
|
-
const lastScrollHeightRef =
|
|
1607
|
-
const isNearBottom =
|
|
1769
|
+
const containerRef = useRef9(null);
|
|
1770
|
+
const [isUserScrolledUp, setIsUserScrolledUp] = useState8(false);
|
|
1771
|
+
const lastScrollTopRef = useRef9(0);
|
|
1772
|
+
const lastScrollHeightRef = useRef9(0);
|
|
1773
|
+
const isNearBottom = useCallback9(() => {
|
|
1608
1774
|
const container = containerRef.current;
|
|
1609
1775
|
if (!container) return true;
|
|
1610
1776
|
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
1611
1777
|
return scrollHeight - scrollTop - clientHeight <= threshold;
|
|
1612
1778
|
}, [threshold]);
|
|
1613
|
-
const scrollToBottom =
|
|
1779
|
+
const scrollToBottom = useCallback9(
|
|
1614
1780
|
(force = false) => {
|
|
1615
1781
|
const container = containerRef.current;
|
|
1616
1782
|
if (!container) return;
|
|
@@ -1622,12 +1788,12 @@ var AutoScrollContainer = forwardRef(
|
|
|
1622
1788
|
},
|
|
1623
1789
|
[isUserScrolledUp, behavior]
|
|
1624
1790
|
);
|
|
1625
|
-
const hasScrollbar =
|
|
1791
|
+
const hasScrollbar = useCallback9(() => {
|
|
1626
1792
|
const container = containerRef.current;
|
|
1627
1793
|
if (!container) return false;
|
|
1628
1794
|
return container.scrollHeight > container.clientHeight;
|
|
1629
1795
|
}, []);
|
|
1630
|
-
const handleScroll =
|
|
1796
|
+
const handleScroll = useCallback9(() => {
|
|
1631
1797
|
const container = containerRef.current;
|
|
1632
1798
|
if (!container) return;
|
|
1633
1799
|
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
@@ -1649,14 +1815,14 @@ var AutoScrollContainer = forwardRef(
|
|
|
1649
1815
|
lastScrollTopRef.current = scrollTop;
|
|
1650
1816
|
lastScrollHeightRef.current = scrollHeight;
|
|
1651
1817
|
}, [isNearBottom]);
|
|
1652
|
-
|
|
1818
|
+
useEffect8(() => {
|
|
1653
1819
|
const container = containerRef.current;
|
|
1654
1820
|
if (container) {
|
|
1655
1821
|
lastScrollTopRef.current = container.scrollTop;
|
|
1656
1822
|
lastScrollHeightRef.current = container.scrollHeight;
|
|
1657
1823
|
}
|
|
1658
1824
|
}, []);
|
|
1659
|
-
|
|
1825
|
+
useEffect8(() => {
|
|
1660
1826
|
const container = containerRef.current;
|
|
1661
1827
|
if (!container || !enabled) return;
|
|
1662
1828
|
const observer = new MutationObserver(() => {
|
|
@@ -1688,16 +1854,12 @@ var AutoScrollContainer = forwardRef(
|
|
|
1688
1854
|
}),
|
|
1689
1855
|
[scrollToBottom, isUserScrolledUp]
|
|
1690
1856
|
);
|
|
1691
|
-
return /* @__PURE__ */
|
|
1857
|
+
return /* @__PURE__ */ jsx23(
|
|
1692
1858
|
"div",
|
|
1693
1859
|
{
|
|
1694
1860
|
ref: containerRef,
|
|
1695
1861
|
className: `auto-scroll-container ${className || ""}`.trim(),
|
|
1696
|
-
style
|
|
1697
|
-
overflowY: "auto",
|
|
1698
|
-
height: "100%",
|
|
1699
|
-
...style
|
|
1700
|
-
},
|
|
1862
|
+
style,
|
|
1701
1863
|
onScroll: handleScroll,
|
|
1702
1864
|
children
|
|
1703
1865
|
}
|
|
@@ -1707,21 +1869,21 @@ var AutoScrollContainer = forwardRef(
|
|
|
1707
1869
|
AutoScrollContainer.displayName = "AutoScrollContainer";
|
|
1708
1870
|
|
|
1709
1871
|
// src/ThemeProvider.tsx
|
|
1710
|
-
import { useEffect as
|
|
1872
|
+
import { useEffect as useEffect9, useRef as useRef10 } from "react";
|
|
1711
1873
|
import { applyTheme } from "@incremark/theme";
|
|
1712
|
-
import { jsx as
|
|
1874
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1713
1875
|
var ThemeProvider = ({
|
|
1714
1876
|
theme,
|
|
1715
1877
|
children,
|
|
1716
1878
|
className = ""
|
|
1717
1879
|
}) => {
|
|
1718
|
-
const containerRef =
|
|
1719
|
-
|
|
1880
|
+
const containerRef = useRef10(null);
|
|
1881
|
+
useEffect9(() => {
|
|
1720
1882
|
if (containerRef.current) {
|
|
1721
1883
|
applyTheme(containerRef.current, theme);
|
|
1722
1884
|
}
|
|
1723
1885
|
}, [theme]);
|
|
1724
|
-
return /* @__PURE__ */
|
|
1886
|
+
return /* @__PURE__ */ jsx24("div", { ref: containerRef, className: `incremark-theme-provider ${className}`.trim(), children });
|
|
1725
1887
|
};
|
|
1726
1888
|
|
|
1727
1889
|
// src/index.ts
|
|
@@ -1747,9 +1909,11 @@ import {
|
|
|
1747
1909
|
mergeTheme,
|
|
1748
1910
|
applyTheme as applyTheme2
|
|
1749
1911
|
} from "@incremark/theme";
|
|
1912
|
+
import { en as enShared, zhCN as zhCNShared } from "@incremark/shared";
|
|
1750
1913
|
export {
|
|
1751
1914
|
AutoScrollContainer,
|
|
1752
1915
|
BlockTransformer2 as BlockTransformer,
|
|
1916
|
+
ConfigProvider,
|
|
1753
1917
|
DefinitionsProvider,
|
|
1754
1918
|
Incremark,
|
|
1755
1919
|
IncremarkContainerProvider,
|
|
@@ -1769,6 +1933,7 @@ export {
|
|
|
1769
1933
|
darkTheme,
|
|
1770
1934
|
defaultPlugins2 as defaultPlugins,
|
|
1771
1935
|
defaultTheme,
|
|
1936
|
+
enShared as en,
|
|
1772
1937
|
generateCSSVars,
|
|
1773
1938
|
imagePlugin,
|
|
1774
1939
|
mathPlugin,
|
|
@@ -1779,7 +1944,9 @@ export {
|
|
|
1779
1944
|
useBlockTransformer,
|
|
1780
1945
|
useDefinitions,
|
|
1781
1946
|
useDevTools,
|
|
1782
|
-
useIncremark
|
|
1947
|
+
useIncremark,
|
|
1948
|
+
useLocale,
|
|
1949
|
+
zhCNShared as zhCN
|
|
1783
1950
|
};
|
|
1784
1951
|
/**
|
|
1785
1952
|
* @file Definitions Context - 管理 Markdown 引用定义
|