@lobehub/ui 2.8.5 → 2.9.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.
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { HighlighterProps } from './type';
3
3
  interface HighlighterFullFeaturedProps extends Omit<HighlighterProps, 'children' | 'bodyRender' | 'enableTransformer'> {
4
4
  content: string;
5
+ setLanguage?: (language: string) => void;
5
6
  }
6
7
  export declare const HighlighterFullFeatured: import("react").NamedExoticComponent<HighlighterFullFeaturedProps & {
7
8
  children: ReactNode;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- var _excluded = ["content", "language", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "actionsRender", "copyable", "variant", "shadow", "wrap", "defaultExpand", "children"];
4
+ var _excluded = ["content", "language", "setLanguage", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "actionsRender", "copyable", "variant", "shadow", "wrap", "defaultExpand", "children"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -15,26 +15,23 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
17
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
- import { Select } from 'antd';
19
18
  import { cva } from 'class-variance-authority';
20
19
  import { ChevronDown, ChevronRight } from 'lucide-react';
21
20
  import { memo, useMemo, useState } from 'react';
22
21
  import { Flexbox } from 'react-layout-kit';
23
22
  import ActionIcon from "../ActionIcon";
24
23
  import CopyButton from "../CopyButton";
25
- import { languages } from "./const";
24
+ import { getCodeLanguageDisplayName, getCodeLanguageFilename } from "./const";
25
+ import MaterialFileTypeIcon from "../MaterialFileTypeIcon";
26
+ import Text from "../Text";
27
+ import LangSelect from "./LangSelect";
26
28
  import { useStyles } from "./style";
27
29
  import { jsx as _jsx } from "react/jsx-runtime";
28
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
- var options = languages.map(function (item) {
30
- return {
31
- label: item,
32
- value: item.toLowerCase()
33
- };
34
- });
35
31
  export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
36
32
  var content = _ref.content,
37
33
  language = _ref.language,
34
+ setLanguage = _ref.setLanguage,
38
35
  showLanguage = _ref.showLanguage,
39
36
  className = _ref.className,
40
37
  style = _ref.style,
@@ -55,10 +52,6 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
55
52
  _useState2 = _slicedToArray(_useState, 2),
56
53
  expand = _useState2[0],
57
54
  setExpand = _useState2[1];
58
- var _useState3 = useState(language),
59
- _useState4 = _slicedToArray(_useState3, 2),
60
- lang = _useState4[0],
61
- setLang = _useState4[1];
62
55
  var _useStyles = useStyles(),
63
56
  styles = _useStyles.styles,
64
57
  cx = _useStyles.cx;
@@ -127,6 +120,14 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
127
120
  language: language,
128
121
  originalNode: originalActions
129
122
  }) : originalActions;
123
+ var displayName = useMemo(function () {
124
+ if (fileName) return fileName;
125
+ return getCodeLanguageDisplayName(language);
126
+ }, [fileName, language]);
127
+ var filetype = useMemo(function () {
128
+ if (fileName) return fileName;
129
+ return getCodeLanguageFilename(language);
130
+ }, [fileName, language]);
130
131
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
131
132
  className: cx(variants({
132
133
  shadow: shadow,
@@ -149,22 +150,24 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
149
150
  return setExpand(!expand);
150
151
  },
151
152
  size: 'small'
152
- }), allowChangeLanguage && !fileName ? showLanguage && /*#__PURE__*/_jsx(Select, {
153
- className: styles.select,
154
- onSelect: setLang,
155
- options: options,
156
- size: 'small',
157
- suffixIcon: false,
158
- value: lang.toLowerCase(),
159
- variant: 'borderless'
153
+ }), allowChangeLanguage && !fileName ? showLanguage && /*#__PURE__*/_jsx(LangSelect, {
154
+ onSelect: setLanguage,
155
+ value: language.toLowerCase()
160
156
  }) : /*#__PURE__*/_jsxs(Flexbox, {
161
157
  align: 'center',
162
- className: styles.select,
163
- gap: 2,
158
+ className: 'languageTitle',
159
+ gap: 4,
164
160
  horizontal: true,
165
- justify: 'center',
166
- children: [icon, /*#__PURE__*/_jsx("span", {
167
- children: fileName || lang
161
+ children: [icon || /*#__PURE__*/_jsx(MaterialFileTypeIcon, {
162
+ fallbackUnknownType: false,
163
+ filename: filetype,
164
+ size: 18,
165
+ type: 'file',
166
+ variant: 'raw'
167
+ }), /*#__PURE__*/_jsx(Text, {
168
+ ellipsis: true,
169
+ fontSize: 13,
170
+ children: displayName
168
171
  })]
169
172
  }), /*#__PURE__*/_jsx(Flexbox, {
170
173
  align: 'center',
@@ -7,12 +7,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
17
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
18
  import { cva } from 'class-variance-authority';
13
- import { memo, useMemo } from 'react';
19
+ import { memo, useMemo, useState } from 'react';
14
20
  import { Flexbox } from 'react-layout-kit';
15
21
  import CopyButton from "../CopyButton";
22
+ import { getCodeLanguageDisplayName } from "./const";
16
23
  import Tag from "../Tag";
17
24
  import FullFeatured from "./FullFeatured";
18
25
  import SyntaxHighlighter from "./SyntaxHighlighter";
@@ -48,6 +55,10 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
48
55
  var _useStyles = useStyles(),
49
56
  styles = _useStyles.styles,
50
57
  cx = _useStyles.cx;
58
+ var _useState = useState(language),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ lang = _useState2[0],
61
+ setLang = _useState2[1];
51
62
  var variants = useMemo(function () {
52
63
  return cva(styles.root, {
53
64
  defaultVariants: {
@@ -83,20 +94,24 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
83
94
  var actions = actionsRender ? actionsRender({
84
95
  actionIconSize: actionIconSize,
85
96
  content: tirmedChildren,
86
- language: language,
97
+ language: lang,
87
98
  originalNode: originalActions
88
99
  }) : originalActions;
89
100
  var originalBody = /*#__PURE__*/_jsx(SyntaxHighlighter, {
90
101
  animated: animated,
91
102
  enableTransformer: enableTransformer,
92
- language: language === null || language === void 0 ? void 0 : language.toLowerCase(),
103
+ language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
93
104
  theme: theme,
94
105
  variant: variant,
95
106
  children: tirmedChildren
96
107
  });
108
+ var displayName = useMemo(function () {
109
+ if (fileName) return fileName;
110
+ return getCodeLanguageDisplayName(language);
111
+ }, [fileName, language]);
97
112
  var body = bodyRender ? bodyRender({
98
113
  content: tirmedChildren,
99
- language: language,
114
+ language: lang,
100
115
  originalNode: originalBody
101
116
  }) : originalBody;
102
117
  if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread(_objectSpread({
@@ -109,6 +124,7 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
109
124
  fileName: fileName,
110
125
  icon: icon,
111
126
  language: language,
127
+ setLanguage: setLang,
112
128
  shadow: shadow,
113
129
  showLanguage: showLanguage,
114
130
  variant: variant,
@@ -133,7 +149,7 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
133
149
  children: actions
134
150
  }), showLanguage && language && /*#__PURE__*/_jsx(Tag, {
135
151
  className: styles.lang,
136
- children: language.toLowerCase()
152
+ children: displayName
137
153
  }), body]
138
154
  }));
139
155
  });
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type SelectProps } from 'antd';
3
+ export declare const LangSelect: import("react").NamedExoticComponent<Omit<SelectProps<any, import("rc-select/lib/Select").DefaultOptionType>, "options">>;
4
+ export default LangSelect;
@@ -0,0 +1,85 @@
1
+ 'use client';
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
16
+ import { Select } from 'antd';
17
+ import { memo, useMemo } from 'react';
18
+ import { Flexbox } from 'react-layout-kit';
19
+ import { bundledLanguagesInfo } from 'shiki';
20
+ import MaterialFileTypeIcon from "../MaterialFileTypeIcon";
21
+ import Text from "../Text";
22
+ import { useStyles } from "./style";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { jsxs as _jsxs } from "react/jsx-runtime";
25
+ export var LangSelect = /*#__PURE__*/memo(function (_ref) {
26
+ var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
27
+ var _useStyles = useStyles(),
28
+ styles = _useStyles.styles;
29
+ var options = useMemo(function () {
30
+ return [{
31
+ aliases: ['text', 'txt'],
32
+ label: /*#__PURE__*/_jsxs(Flexbox, {
33
+ align: 'center',
34
+ gap: 4,
35
+ horizontal: true,
36
+ children: [/*#__PURE__*/_jsx(MaterialFileTypeIcon, {
37
+ fallbackUnknownType: false,
38
+ filename: "*.txt",
39
+ size: 18,
40
+ type: 'file',
41
+ variant: 'raw'
42
+ }), /*#__PURE__*/_jsx(Text, {
43
+ ellipsis: true,
44
+ fontSize: 13,
45
+ children: "Plaintext"
46
+ })]
47
+ }),
48
+ value: 'plaintext'
49
+ }].concat(_toConsumableArray(bundledLanguagesInfo.map(function (item) {
50
+ var _item$aliases;
51
+ return {
52
+ aliases: item.aliases,
53
+ label: /*#__PURE__*/_jsxs(Flexbox, {
54
+ align: 'center',
55
+ gap: 4,
56
+ horizontal: true,
57
+ children: [/*#__PURE__*/_jsx(MaterialFileTypeIcon, {
58
+ fallbackUnknownType: false,
59
+ filename: "*.".concat((item === null || item === void 0 || (_item$aliases = item.aliases) === null || _item$aliases === void 0 ? void 0 : _item$aliases[0]) || item.id),
60
+ size: 18,
61
+ type: 'file',
62
+ variant: 'raw'
63
+ }), /*#__PURE__*/_jsx(Text, {
64
+ ellipsis: true,
65
+ fontSize: 13,
66
+ children: item.name
67
+ })]
68
+ }),
69
+ title: (item.aliases || [item.id]).filter(Boolean).map(function (item) {
70
+ return "*.".concat(item);
71
+ }).join(','),
72
+ value: item.id
73
+ };
74
+ })));
75
+ }, []);
76
+ return /*#__PURE__*/_jsx(Select, _objectSpread({
77
+ className: styles.select,
78
+ options: options,
79
+ showSearch: true,
80
+ size: 'small',
81
+ suffixIcon: false,
82
+ variant: 'borderless'
83
+ }, rest));
84
+ });
85
+ export default LangSelect;
@@ -3,5 +3,8 @@ interface HighlighterThemeItem {
3
3
  id: string;
4
4
  }
5
5
  export declare const highlighterThemes: HighlighterThemeItem[];
6
- export declare const languages: readonly ["abap", "actionscript-3", "ada", "apache", "apex", "apl", "applescript", "ara", "asm", "astro", "awk", "ballerina", "bat", "beancount", "berry", "bibtex", "bicep", "blade", "c", "cadence", "clarity", "clojure", "cmake", "cobol", "codeql", "coffee", "cpp", "crystal", "csharp", "css", "cue", "cypher", "d", "dart", "dax", "diff", "docker", "dream-maker", "elixir", "elm", "erb", "erlang", "fish", "fsharp", "gdresource", "gdscript", "gdshader", "gherkin", "git-commit", "git-rebase", "glimmer-js", "glimmer-ts", "glsl", "gnuplot", "go", "graphql", "groovy", "hack", "haml", "handlebars", "haskell", "hcl", "hjson", "hlsl", "html", "http", "imba", "ini", "java", "javascript", "jinja-html", "jison", "json", "json5", "jsonc", "jsonl", "jsonnet", "jssm", "jsx", "julia", "kotlin", "kusto", "latex", "less", "liquid", "lisp", "logo", "lua", "make", "markdown", "marko", "matlab", "mdc", "mdx", "mermaid", "mojo", "narrat", "nextflow", "nginx", "nim", "nix", "objective-c", "objective-cpp", "ocaml", "pascal", "perl", "php", "plsql", "postcss", "powerquery", "powershell", "prisma", "prolog", "proto", "pug", "puppet", "purescript", "python", "r", "raku", "razor", "reg", "rel", "riscv", "rst", "ruby", "rust", "sas", "sass", "scala", "scheme", "scss", "shaderlab", "shellscript", "shellsession", "smalltalk", "solidity", "sparql", "splunk", "sql", "ssh-config", "stata", "stylus", "svelte", "swift", "system-verilog", "tasl", "tcl", "tex", "toml", "tsx", "turtle", "twig", "typescript", "v", "vb", "verilog", "vhdl", "viml", "vue", "vue-html", "vyper", "wasm", "wenyan", "wgsl", "wolfram", "xml", "xsl", "yaml", "zenscript", "zig", "bash", "batch", "be", "c#", "cdc", "clj", "cmd", "console", "cql", "cs", "dockerfile", "erl", "f#", "fs", "fsl", "gjs", "gts", "hbs", "hs", "jade", "js", "kql", "makefile", "md", "nar", "nf", "objc", "perl6", "properties", "ps", "ps1", "py", "ql", "rb", "rs", "sh", "shader", "shell", "spl", "styl", "ts", "vim", "vimscript", "vy", "yml", "zsh", "文言"];
6
+ export declare const FALLBACK_LANG = "plaintext";
7
+ export declare const getCodeLanguageByInput: (input: string) => string;
8
+ export declare const getCodeLanguageFilename: (input: string) => string;
9
+ export declare const getCodeLanguageDisplayName: (input: string) => string;
7
10
  export {};
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- import { bundledThemesInfo } from 'shiki';
7
+ import { bundledLanguagesInfo, bundledThemesInfo } from 'shiki';
8
8
  export var highlighterThemes = [{
9
9
  displayName: 'Lobe Theme',
10
10
  id: 'lobe-theme'
@@ -14,4 +14,39 @@ export var highlighterThemes = [{
14
14
  id: item.id
15
15
  };
16
16
  })));
17
- export var languages = ['abap', 'actionscript-3', 'ada', 'apache', 'apex', 'apl', 'applescript', 'ara', 'asm', 'astro', 'awk', 'ballerina', 'bat', 'beancount', 'berry', 'bibtex', 'bicep', 'blade', 'c', 'cadence', 'clarity', 'clojure', 'cmake', 'cobol', 'codeql', 'coffee', 'cpp', 'crystal', 'csharp', 'css', 'cue', 'cypher', 'd', 'dart', 'dax', 'diff', 'docker', 'dream-maker', 'elixir', 'elm', 'erb', 'erlang', 'fish', 'fsharp', 'gdresource', 'gdscript', 'gdshader', 'gherkin', 'git-commit', 'git-rebase', 'glimmer-js', 'glimmer-ts', 'glsl', 'gnuplot', 'go', 'graphql', 'groovy', 'hack', 'haml', 'handlebars', 'haskell', 'hcl', 'hjson', 'hlsl', 'html', 'http', 'imba', 'ini', 'java', 'javascript', 'jinja-html', 'jison', 'json', 'json5', 'jsonc', 'jsonl', 'jsonnet', 'jssm', 'jsx', 'julia', 'kotlin', 'kusto', 'latex', 'less', 'liquid', 'lisp', 'logo', 'lua', 'make', 'markdown', 'marko', 'matlab', 'mdc', 'mdx', 'mermaid', 'mojo', 'narrat', 'nextflow', 'nginx', 'nim', 'nix', 'objective-c', 'objective-cpp', 'ocaml', 'pascal', 'perl', 'php', 'plsql', 'postcss', 'powerquery', 'powershell', 'prisma', 'prolog', 'proto', 'pug', 'puppet', 'purescript', 'python', 'r', 'raku', 'razor', 'reg', 'rel', 'riscv', 'rst', 'ruby', 'rust', 'sas', 'sass', 'scala', 'scheme', 'scss', 'shaderlab', 'shellscript', 'shellsession', 'smalltalk', 'solidity', 'sparql', 'splunk', 'sql', 'ssh-config', 'stata', 'stylus', 'svelte', 'swift', 'system-verilog', 'tasl', 'tcl', 'tex', 'toml', 'tsx', 'turtle', 'twig', 'typescript', 'v', 'vb', 'verilog', 'vhdl', 'viml', 'vue', 'vue-html', 'vyper', 'wasm', 'wenyan', 'wgsl', 'wolfram', 'xml', 'xsl', 'yaml', 'zenscript', 'zig', 'bash', 'batch', 'be', 'c#', 'cdc', 'clj', 'cmd', 'console', 'cql', 'cs', 'dockerfile', 'erl', 'f#', 'fs', 'fsl', 'gjs', 'gts', 'hbs', 'hs', 'jade', 'js', 'kql', 'makefile', 'md', 'nar', 'nf', 'objc', 'perl6', 'properties', 'ps', 'ps1', 'py', 'ql', 'rb', 'rs', 'sh', 'shader', 'shell', 'spl', 'styl', 'ts', 'vim', 'vimscript', 'vy', 'yml', 'zsh', '文言'];
17
+ export var FALLBACK_LANG = 'plaintext';
18
+ export var getCodeLanguageByInput = function getCodeLanguageByInput(input) {
19
+ if (!input) {
20
+ return 'plaintext';
21
+ }
22
+ var inputLang = input.toLocaleLowerCase();
23
+ var matchLang = bundledLanguagesInfo.find(function (lang) {
24
+ var _lang$aliases;
25
+ return lang.id === inputLang || ((_lang$aliases = lang.aliases) === null || _lang$aliases === void 0 ? void 0 : _lang$aliases.includes(inputLang));
26
+ });
27
+ return (matchLang === null || matchLang === void 0 ? void 0 : matchLang.id) || 'plaintext';
28
+ };
29
+ export var getCodeLanguageFilename = function getCodeLanguageFilename(input) {
30
+ var _matchLang$aliases;
31
+ if (!input) {
32
+ return 'Plaintext';
33
+ }
34
+ var inputLang = input.toLocaleLowerCase();
35
+ var matchLang = bundledLanguagesInfo.find(function (lang) {
36
+ var _lang$aliases2;
37
+ return lang.id === inputLang || ((_lang$aliases2 = lang.aliases) === null || _lang$aliases2 === void 0 ? void 0 : _lang$aliases2.includes(inputLang));
38
+ });
39
+ var type = (matchLang === null || matchLang === void 0 || (_matchLang$aliases = matchLang.aliases) === null || _matchLang$aliases === void 0 ? void 0 : _matchLang$aliases[0]) || (matchLang === null || matchLang === void 0 ? void 0 : matchLang.id) || 'txt';
40
+ return "*.".concat(type);
41
+ };
42
+ export var getCodeLanguageDisplayName = function getCodeLanguageDisplayName(input) {
43
+ if (!input) {
44
+ return 'Plaintext';
45
+ }
46
+ var inputLang = input.toLocaleLowerCase();
47
+ var matchLang = bundledLanguagesInfo.find(function (lang) {
48
+ var _lang$aliases3;
49
+ return lang.id === inputLang || ((_lang$aliases3 = lang.aliases) === null || _lang$aliases3 === void 0 ? void 0 : _lang$aliases3.includes(inputLang));
50
+ });
51
+ return (matchLang === null || matchLang === void 0 ? void 0 : matchLang.name) || 'Plaintext';
52
+ };
@@ -21,8 +21,8 @@ export var useStyles = createStyles(function (_ref) {
21
21
  headerBorderless: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-inline: 0;\n "]))),
22
22
  headerFilled: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n "])), token.colorFillQuaternary),
23
23
  headerOutlined: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n & + .", " {\n border-block-start: 1px solid ", ";\n }\n "])), expandCls, token.colorFillQuaternary),
24
- headerRoot: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n padding: 4px;\n "]))),
25
- lang: cx(langHoverCls, stylish.blur, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 0;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n background: ", ";\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary, token.colorFillQuaternary)),
24
+ headerRoot: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n padding: 4px;\n\n .languageTitle {\n opacity: 0.5;\n transition: opacity 0.2s ", ";\n }\n\n &:hover {\n .languageTitle {\n opacity: 1;\n }\n }\n "])), token.motionEaseInOut),
25
+ lang: cx(langHoverCls, stylish.blur, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 8px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n background: ", ";\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary, token.colorFillQuaternary)),
26
26
  nowrap: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n pre,\n code {\n text-wrap: nowrap;\n }\n "]))),
27
27
  outlined: stylish.variantOutlinedWithoutHover,
28
28
  root: cx(prefix, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n width: 100%;\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, actionsHoverCls, langHoverCls)),
@@ -7,7 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
- import { FALLBACK_LANG } from "../../hooks/useHighlight";
10
+ import { FALLBACK_LANG } from "../../Highlighter/const";
11
11
  import Pre, { PreMermaid, PreSingleLine } from "../../mdx/mdxComponents/Pre";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  var countLines = function countLines(str) {
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createStyles } from 'antd-style';
4
4
  var IGNORE_CLASSNAME = '.ignore-markdown-style';
@@ -18,21 +18,22 @@ export var useStyles = createStyles(function (_ref, _ref2) {
18
18
  var a = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n a:not(", " a) {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n }\n "])), IGNORE_CLASSNAME, token.colorInfoText, token.colorInfoHover);
19
19
  var blockquote = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n blockquote:not(", " blockquote) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n border-inline-start: solid 4px ", ";\n\n color: ", ";\n }\n "])), IGNORE_CLASSNAME, token.colorBorder, token.colorTextSecondary);
20
20
  var code = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n code:not(", " code) {\n &:not(:has(span)) {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n }\n }\n "])), IGNORE_CLASSNAME, token.fontFamilyCode, token.colorFillSecondary);
21
- var details = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n details:not(", " details) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-block: 0.75em;\n padding-inline: 1em;\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n summary {\n cursor: pointer;\n display: flex;\n align-items: center;\n list-style: none;\n\n &::before {\n content: '';\n\n position: absolute;\n inset-inline-end: 1.25em;\n transform: rotateZ(-45deg);\n\n display: block;\n\n width: 0.4em;\n height: 0.4em;\n border-block-end: 1.5px solid ", ";\n border-inline-end: 1.5px solid ", ";\n\n font-family: ", ";\n\n transition: transform 200ms ", ";\n }\n }\n\n &[open] {\n summary {\n padding-block-end: 0.75em;\n border-block-end: 1px dashed ", ";\n\n &::before {\n transform: rotateZ(45deg);\n }\n }\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillTertiary, token.colorTextSecondary, token.colorTextSecondary, token.fontFamily, token.motionEaseOut, token.colorBorder);
22
- var header = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n h1:not(", " h1),\n h2:not(", " h2),\n h3:not(", " h3),\n h4:not(", " h4),\n h5:not(", " h5),\n h6:not(", " h6) {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1:not(", " h1) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2:not(", " h2) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3:not(", " h3) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4:not(", " h4) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5:not(", " h5),\n h6:not(", " h6) {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
23
- var hr = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n hr:not(", " hr) {\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n "])), IGNORE_CLASSNAME, token.colorBorder);
24
- var img = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n img:not(", " img) {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])), IGNORE_CLASSNAME);
25
- var kbd = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n kbd:not(", " kbd) {\n cursor: default;\n\n display: inline-block;\n\n min-width: 1em;\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n\n background: ", ";\n }\n "])), IGNORE_CLASSNAME, token.colorBorderSecondary, token.fontFamily, token.colorBgLayout);
26
- var list = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n li:not(", " li) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p {\n display: inline;\n }\n }\n\n ul:not(", " ul),\n ol:not(", " ol) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > ul,\n > ol {\n margin-block: 0;\n }\n\n > li {\n margin-inline-start: 1em;\n }\n }\n\n ol:not(", " ol) {\n list-style: auto;\n }\n\n ul:not(", " ul) {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
27
- var p = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n p:not(", " kbd) {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])), IGNORE_CLASSNAME);
28
- var pre = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n pre {\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n }\n "])));
29
- var strong = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n strong:not(", " strong) {\n font-weight: 600;\n }\n "])), IGNORE_CLASSNAME);
30
- var svg = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n svg:not(", " svg) {\n line-height: 1;\n }\n "])), IGNORE_CLASSNAME);
31
- var table = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n table:not(", " table) {\n unicode-bidi: isolate;\n overflow: auto hidden;\n display: block;\n border-spacing: 0;\n border-collapse: collapse;\n\n box-sizing: border-box;\n width: max-content;\n max-width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 var(--lobe-markdown-border-color);\n }\n\n th,\n td {\n min-width: 120px;\n padding-block: 0.75em;\n padding-inline: 1em;\n text-align: start;\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillQuaternary, token.colorFillQuaternary);
32
- var video = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n > video:not(", " video),\n > p:not(", " p) > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n\n video:not(", " video) {\n max-width: 100%;\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
33
- var gfm = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n .markdown-alert {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-start: 1em;\n border-inline-start: solid 4px ", ";\n\n > p {\n margin-block-start: 0 !important;\n }\n }\n\n .markdown-alert > :first-child {\n margin-block-start: 0;\n }\n\n .markdown-alert > :last-child {\n margin-block-end: 0;\n }\n\n .markdown-alert-note {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-tip {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-important {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-warning {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-caution {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-title {\n display: flex;\n align-items: center;\n margin-block-end: 0.5em !important;\n font-weight: 500;\n }\n\n .markdown-alert-note .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-tip .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-important .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-warning .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-caution .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .octicon {\n overflow: visible !important;\n display: inline-block;\n margin-inline-end: 0.5em;\n vertical-align: text-bottom;\n }\n\n .task-list-item {\n &::before {\n display: none !important;\n }\n\n input[type='checkbox'] {\n margin-block: 0 0.25em;\n margin-inline: -1.6em 0.2em;\n vertical-align: middle;\n }\n\n input[type='checkbox']:dir(rtl) {\n margin: 0 -1.6em 0.25em 0.2em;\n }\n }\n\n /* Style the footnotes section. */\n\n .footnotes {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n font-size: smaller;\n color: #8b949e;\n\n #footnote-label {\n display: none;\n }\n\n > ol {\n margin: 0 !important;\n }\n }\n\n .sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n\n word-wrap: normal;\n\n clip: rect(0, 0, 0, 0);\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 2px;\n vertical-align: super !important;\n\n [data-footnote-ref] {\n display: inline-block;\n\n width: 16px;\n height: 16px;\n border-radius: 4px;\n\n font-family: ", ";\n font-size: 10px;\n color: ", " !important;\n text-align: center;\n\n background: ", ";\n }\n }\n "])), token.colorBorder, token.colorInfo, token.colorSuccess, token.purple, token.colorWarning, token.colorError, token.colorInfo, token.colorInfo, token.colorSuccess, token.colorSuccess, token.purple, token.purple, token.colorWarning, token.colorWarning, token.colorError, token.colorError, token.fontFamilyCode, token.colorTextSecondary, token.colorFillSecondary);
21
+ var del = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n del:not(", " del) {\n color: ", ";\n text-decoration: line-through;\n }\n "])), IGNORE_CLASSNAME, token.colorTextDescription);
22
+ var details = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n details:not(", " details) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-block: 0.75em;\n padding-inline: 1em;\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n summary {\n cursor: pointer;\n display: flex;\n align-items: center;\n list-style: none;\n\n &::before {\n content: '';\n\n position: absolute;\n inset-inline-end: 1.25em;\n transform: rotateZ(-45deg);\n\n display: block;\n\n width: 0.4em;\n height: 0.4em;\n border-block-end: 1.5px solid ", ";\n border-inline-end: 1.5px solid ", ";\n\n font-family: ", ";\n\n transition: transform 200ms ", ";\n }\n }\n\n &[open] {\n summary {\n padding-block-end: 0.75em;\n border-block-end: 1px dashed ", ";\n\n &::before {\n transform: rotateZ(45deg);\n }\n }\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillTertiary, token.colorTextSecondary, token.colorTextSecondary, token.fontFamily, token.motionEaseOut, token.colorBorder);
23
+ var header = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n h1:not(", " h1),\n h2:not(", " h2),\n h3:not(", " h3),\n h4:not(", " h4),\n h5:not(", " h5),\n h6:not(", " h6) {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1:not(", " h1) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2:not(", " h2) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3:not(", " h3) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4:not(", " h4) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5:not(", " h5),\n h6:not(", " h6) {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
24
+ var hr = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n hr:not(", " hr) {\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n "])), IGNORE_CLASSNAME, token.colorBorder);
25
+ var img = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n img:not(", " img) {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])), IGNORE_CLASSNAME);
26
+ var kbd = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n kbd:not(", " kbd) {\n cursor: default;\n\n display: inline-block;\n\n min-width: 1em;\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n\n background: ", ";\n }\n "])), IGNORE_CLASSNAME, token.colorBorderSecondary, token.fontFamily, token.colorBgLayout);
27
+ var list = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n li:not(", " li) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p {\n display: inline;\n }\n }\n\n ul:not(", " ul),\n ol:not(", " ol) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > ul,\n > ol {\n margin-block: 0;\n }\n\n > li {\n margin-inline-start: 1em;\n }\n }\n\n ol:not(", " ol) {\n list-style: auto;\n }\n\n ul:not(", " ul) {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
28
+ var p = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n p:not(", " kbd) {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])), IGNORE_CLASSNAME);
29
+ var pre = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n pre {\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n }\n "])));
30
+ var strong = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n strong:not(", " strong) {\n font-weight: 600;\n }\n "])), IGNORE_CLASSNAME);
31
+ var svg = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n svg:not(", " svg) {\n line-height: 1;\n }\n "])), IGNORE_CLASSNAME);
32
+ var table = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n table:not(", " table) {\n unicode-bidi: isolate;\n overflow: auto hidden;\n display: block;\n border-spacing: 0;\n border-collapse: collapse;\n\n box-sizing: border-box;\n width: max-content;\n max-width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 var(--lobe-markdown-border-color);\n }\n\n th,\n td {\n min-width: 120px;\n padding-block: 0.75em;\n padding-inline: 1em;\n text-align: start;\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillQuaternary, token.colorFillQuaternary);
33
+ var video = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n > video:not(", " video),\n > p:not(", " p) > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n\n video:not(", " video) {\n max-width: 100%;\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
34
+ var gfm = css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n .markdown-alert {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-start: 1em;\n border-inline-start: solid 4px ", ";\n\n > p {\n margin-block-start: 0 !important;\n }\n }\n\n .markdown-alert > :first-child {\n margin-block-start: 0;\n }\n\n .markdown-alert > :last-child {\n margin-block-end: 0;\n }\n\n .markdown-alert-note {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-tip {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-important {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-warning {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-caution {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-title {\n display: flex;\n align-items: center;\n margin-block-end: 0.5em !important;\n font-weight: 500;\n }\n\n .markdown-alert-note .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-tip .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-important .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-warning .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-caution .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .octicon {\n overflow: visible !important;\n display: inline-block;\n margin-inline-end: 0.5em;\n vertical-align: text-bottom;\n }\n\n .task-list-item {\n &::before {\n display: none !important;\n }\n\n input[type='checkbox'] {\n margin-block: 0 0.25em;\n margin-inline: -1.6em 0.2em;\n vertical-align: middle;\n }\n\n input[type='checkbox']:dir(rtl) {\n margin: 0 -1.6em 0.25em 0.2em;\n }\n }\n\n /* Style the footnotes section. */\n\n .footnotes {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n font-size: smaller;\n color: #8b949e;\n\n #footnote-label {\n display: none;\n }\n\n > ol {\n margin: 0 !important;\n }\n }\n\n .sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n\n word-wrap: normal;\n\n clip: rect(0, 0, 0, 0);\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 2px;\n vertical-align: super !important;\n\n [data-footnote-ref] {\n display: inline-block;\n\n width: 16px;\n height: 16px;\n border-radius: 4px;\n\n font-family: ", ";\n font-size: 10px;\n color: ", " !important;\n text-align: center;\n\n background: ", ";\n }\n }\n "])), token.colorBorder, token.colorInfo, token.colorSuccess, token.purple, token.colorWarning, token.colorError, token.colorInfo, token.colorInfo, token.colorSuccess, token.colorSuccess, token.purple, token.purple, token.colorWarning, token.colorWarning, token.colorError, token.colorError, token.fontFamilyCode, token.colorTextSecondary, token.colorFillSecondary);
34
35
  return {
35
36
  root: __root,
36
- variant: cx(a, blockquote, code, details, header, hr, img, kbd, list, p, pre, strong, svg, table, video, gfm)
37
+ variant: cx(a, blockquote, code, del, details, header, hr, img, kbd, list, p, pre, strong, svg, table, video, gfm)
37
38
  };
38
39
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Remark plugin to handle <br> and <br/> tags in markdown text
3
+ * This plugin converts <br> and <br/> tags to proper HTML elements
4
+ * without requiring allowHtml to be enabled
5
+ */
6
+ export declare const remarkBr: () => (tree: any) => void;
@@ -0,0 +1,104 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ import { visit } from 'unist-util-visit';
9
+
10
+ /**
11
+ * Remark plugin to handle <br> and <br/> tags in markdown text
12
+ * This plugin converts <br> and <br/> tags to proper HTML elements
13
+ * without requiring allowHtml to be enabled
14
+ */
15
+ export var remarkBr = function remarkBr() {
16
+ return function (tree) {
17
+ // First try to process html nodes that might contain br tags
18
+ visit(tree, 'html', function (node, index, parent) {
19
+ if (!node.value || typeof node.value !== 'string') return;
20
+ var brRegex = /<\s*br\s*\/?>/gi;
21
+ if (brRegex.test(node.value)) {
22
+ console.log('Found br tag in HTML node:', node.value);
23
+ // Replace the html node with a break node
24
+ parent.children.splice(index, 1, {
25
+ type: 'break'
26
+ });
27
+ return index;
28
+ }
29
+ });
30
+
31
+ // Also process text nodes
32
+ visit(tree, 'text', function (node) {
33
+ var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
34
+ var parent = arguments.length > 2 ? arguments[2] : undefined;
35
+ if (!node.value || typeof node.value !== 'string') return;
36
+
37
+ // Check if the text contains <br> or <br/> tags
38
+ var brRegex = /<\s*br\s*\/?>/gi;
39
+ if (!brRegex.test(node.value)) return;
40
+ console.log('Found br tag in text:', node.value);
41
+
42
+ // Reset regex lastIndex for split operation
43
+ brRegex.lastIndex = 0;
44
+
45
+ // Split the text by br tags, but keep the matched tags
46
+ var parts = [];
47
+ var matches = [];
48
+ var lastIndex = 0;
49
+ var match;
50
+ while ((match = brRegex.exec(node.value)) !== null) {
51
+ // Add text before the match
52
+ if (match.index > lastIndex) {
53
+ parts.push(node.value.slice(lastIndex, match.index));
54
+ }
55
+
56
+ // Store the matched br tag
57
+ matches.push(match[0]);
58
+ lastIndex = match.index + match[0].length;
59
+ }
60
+
61
+ // Add remaining text after the last match
62
+ if (lastIndex < node.value.length) {
63
+ parts.push(node.value.slice(lastIndex));
64
+ }
65
+
66
+ // Create new nodes
67
+ var newNodes = [];
68
+ var _iterator = _createForOfIteratorHelper(parts.entries()),
69
+ _step;
70
+ try {
71
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
72
+ var _step$value = _slicedToArray(_step.value, 2),
73
+ i = _step$value[0],
74
+ part = _step$value[1];
75
+ // Add text node if not empty
76
+ if (part) {
77
+ newNodes.push({
78
+ type: 'text',
79
+ value: part
80
+ });
81
+ }
82
+
83
+ // Add br element if we have a corresponding match
84
+ if (i < matches.length) {
85
+ newNodes.push({
86
+ type: 'break'
87
+ });
88
+ }
89
+ }
90
+
91
+ // Replace the original text node with the new nodes
92
+ } catch (err) {
93
+ _iterator.e(err);
94
+ } finally {
95
+ _iterator.f();
96
+ }
97
+ if (newNodes.length > 0) {
98
+ var _parent$children;
99
+ (_parent$children = parent.children).splice.apply(_parent$children, [index, 1].concat(newNodes));
100
+ return index + newNodes.length - 1; // Skip the newly added nodes
101
+ }
102
+ });
103
+ };
104
+ };
@@ -22,6 +22,8 @@ import { Flexbox } from 'react-layout-kit';
22
22
  import ActionIcon from "../ActionIcon";
23
23
  import CopyButton from "../CopyButton";
24
24
  import { useStyles } from "../Highlighter/style";
25
+ import MaterialFileTypeIcon from "../MaterialFileTypeIcon";
26
+ import Text from "../Text";
25
27
  import { jsx as _jsx } from "react/jsx-runtime";
26
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
27
29
  export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
@@ -127,13 +129,22 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
127
129
  return setExpand(!expand);
128
130
  },
129
131
  size: 'small'
130
- }), showLanguage && /*#__PURE__*/_jsx(Flexbox, {
132
+ }), showLanguage && /*#__PURE__*/_jsxs(Flexbox, {
131
133
  align: 'center',
132
- className: styles.select,
133
- gap: 2,
134
+ className: 'languageTitle',
135
+ gap: 4,
134
136
  horizontal: true,
135
- justify: 'center',
136
- children: fileName || language.toLowerCase()
137
+ children: [/*#__PURE__*/_jsx(MaterialFileTypeIcon, {
138
+ fallbackUnknownType: false,
139
+ filename: fileName || language,
140
+ size: 18,
141
+ type: 'file',
142
+ variant: 'raw'
143
+ }), /*#__PURE__*/_jsx(Text, {
144
+ ellipsis: true,
145
+ fontSize: 13,
146
+ children: fileName || 'Mermaid'
147
+ })]
137
148
  }), /*#__PURE__*/_jsx(Flexbox, {
138
149
  align: 'center',
139
150
  flex: 'none',
@@ -1,6 +1,5 @@
1
1
  import type { BuiltinTheme, CodeToHastOptions } from 'shiki';
2
2
  import { SWRResponse } from 'swr';
3
- export declare const FALLBACK_LANG = "txt";
4
3
  declare const MD5_LENGTH_THRESHOLD = 10000;
5
4
  type ICodeToHtml = (code: string, options: CodeToHastOptions) => Promise<string>;
6
5
  declare const loadShiki: () => Promise<ICodeToHtml | null>;
@@ -9,8 +9,7 @@ import { useTheme, useThemeMode } from 'antd-style';
9
9
  import { useMemo } from 'react';
10
10
  import useSWR from 'swr';
11
11
  import { Md5 } from 'ts-md5';
12
- import { languages } from "../Highlighter/const";
13
- export var FALLBACK_LANG = 'txt';
12
+ import { getCodeLanguageByInput } from "../Highlighter/const";
14
13
 
15
14
  // Application-level cache to avoid repeated calculations
16
15
  var MD5_LENGTH_THRESHOLD = 10000; // Use async MD5 for text exceeding this length
@@ -43,7 +42,7 @@ export var useHighlight = function useHighlight(text, _ref) {
43
42
 
44
43
  // Match supported languages
45
44
  var matchedLanguage = useMemo(function () {
46
- return languages.includes(lang) ? lang : FALLBACK_LANG;
45
+ return getCodeLanguageByInput(lang);
47
46
  }, [lang]);
48
47
 
49
48
  // Optimize transformer creation
@@ -0,0 +1 @@
1
+ export declare function fixMarkdownEmphasisSpacing(text: string): string;
@@ -0,0 +1,244 @@
1
+ function splitInlineCode(text) {
2
+ var segments = [];
3
+ var currentPos = 0;
4
+
5
+ // 匹配行内代码,支持多个反引号
6
+ var inlineCodeRegex = /(`+)([^`]*?)\1/g;
7
+ var match;
8
+ while ((match = inlineCodeRegex.exec(text)) !== null) {
9
+ // 添加代码前的普通文本
10
+ if (match.index > currentPos) {
11
+ segments.push({
12
+ content: text.slice(currentPos, match.index),
13
+ isCode: false
14
+ });
15
+ }
16
+
17
+ // 添加行内代码
18
+ segments.push({
19
+ content: match[0],
20
+ isCode: true
21
+ });
22
+ currentPos = match.index + match[0].length;
23
+ }
24
+
25
+ // 添加最后剩余的普通文本
26
+ if (currentPos < text.length) {
27
+ segments.push({
28
+ content: text.slice(currentPos),
29
+ isCode: false
30
+ });
31
+ }
32
+ return segments;
33
+ }
34
+ function applyEmphasisFixes(text) {
35
+ var result = text;
36
+
37
+ // Step 1: Remove trailing spaces inside emphasis markers
38
+ var removeInternalSpaces = [
39
+ // 处理 **bold** 格式(两个星号)- 只处理一个空格
40
+ {
41
+ pattern: /(\*\*)([^\n*]+?)( )(\*\*)/g,
42
+ replacement: '$1$2$4'
43
+ },
44
+ // 处理 __bold__ 格式(两个下划线)- 只处理一个空格
45
+ {
46
+ pattern: /(__)([^\n_]+?)( )(__)/g,
47
+ replacement: '$1$2$4'
48
+ },
49
+ // 处理 ~~strikethrough~~ 格式(删除线)- 只处理一个空格
50
+ {
51
+ pattern: /(~~)([^\n~]+?)( )(~~)/g,
52
+ replacement: '$1$2$4'
53
+ },
54
+ // 处理单个 * 格式 - 只处理一个空格,使用更精确的边界匹配
55
+ {
56
+ pattern: /(^|[^\w*])(\*(?!\*))([^\n*]+?)( )(\*(?!\*))/g,
57
+ replacement: '$1$2$3$5'
58
+ },
59
+ // 处理单个 _ 格式 - 只处理一个空格,使用更精确的边界匹配
60
+ {
61
+ pattern: /(^|\W)(_(?!_))([^\n_]+?)( )(_(?!_))/g,
62
+ replacement: '$1$2$3$5'
63
+ }];
64
+ result = removeInternalSpaces.reduce(function (text, _ref) {
65
+ var pattern = _ref.pattern,
66
+ replacement = _ref.replacement;
67
+ return text.replace(pattern, replacement);
68
+ }, result);
69
+
70
+ // Step 2: Add space after closing emphasis markers when followed by symbols/punctuation/Chinese characters
71
+ // Define emphasis patterns
72
+ var emphasisPatterns = [
73
+ // ** (bold)
74
+ {
75
+ markerChar: '*',
76
+ pattern: /(\*\*)([^\n*]*?)(\*\*)(\S)/g
77
+ },
78
+ // __ (bold)
79
+ {
80
+ markerChar: '_',
81
+ pattern: /(__)([^\n_]*?)(__)(\S)/g
82
+ },
83
+ // * (italic) - need to avoid matching **
84
+ {
85
+ markerChar: '*',
86
+ pattern: /(\*(?!\*))([^\n*]*?)(\*(?!\*))(\S)/g
87
+ },
88
+ // _ (italic) - need to avoid matching __
89
+ {
90
+ markerChar: '_',
91
+ pattern: /(_(?!_))([^\n_]*?)(_(?!_))(\S)/g
92
+ },
93
+ // ~~ (strikethrough)
94
+ {
95
+ markerChar: '~',
96
+ pattern: /(~~)([^\n~]*?)(~~)(\S)/g
97
+ }];
98
+
99
+ // Apply space after closing markers for each emphasis type
100
+ for (var _i = 0, _emphasisPatterns = emphasisPatterns; _i < _emphasisPatterns.length; _i++) {
101
+ var pattern = _emphasisPatterns[_i].pattern;
102
+ result = result.replaceAll(pattern, function (match, start, content, end, nextChar) {
103
+ // Check if the content ends with a symbol/punctuation (like :, :, etc.)
104
+ var lastChar = content.slice(-1);
105
+ var isSymbolOrPunctuation = /[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~、。《》【】!(),:;?{|}-]/.test(lastChar);
106
+
107
+ // If content ends with symbol/punctuation and next character is not whitespace, add space
108
+ if (isSymbolOrPunctuation && nextChar && !/\s/.test(nextChar)) {
109
+ return start + content + end + ' ' + nextChar;
110
+ }
111
+ return match;
112
+ });
113
+ }
114
+
115
+ // Step 3: Add space before opening emphasis markers when preceded by non-whitespace and first char is symbol/punctuation
116
+ var beforeEmphasisPatterns = [
117
+ // ** (bold)
118
+ {
119
+ markerChar: '*',
120
+ pattern: /(\S)(\*\*)([^\n*]*?)(\*\*)/g
121
+ },
122
+ // __ (bold)
123
+ {
124
+ markerChar: '_',
125
+ pattern: /(\S)(__)([^\n_]*?)(__)/g
126
+ },
127
+ // * (italic) - need to avoid matching **
128
+ {
129
+ markerChar: '*',
130
+ pattern: /(\S)(\*(?!\*))([^\n*]*?)(\*(?!\*))/g
131
+ },
132
+ // _ (italic) - need to avoid matching __
133
+ {
134
+ markerChar: '_',
135
+ pattern: /(\S)(_(?!_))([^\n_]*?)(_(?!_))/g
136
+ },
137
+ // ~~ (strikethrough)
138
+ {
139
+ markerChar: '~',
140
+ pattern: /(\S)(~~)([^\n~]*?)(~~)/g
141
+ }];
142
+
143
+ // Apply space before opening markers for each emphasis type
144
+ for (var _i2 = 0, _beforeEmphasisPatter = beforeEmphasisPatterns; _i2 < _beforeEmphasisPatter.length; _i2++) {
145
+ var _pattern = _beforeEmphasisPatter[_i2].pattern;
146
+ result = result.replaceAll(_pattern, function (match, prevChar, start, content, end) {
147
+ // Check if the content starts with a symbol/punctuation (like :, :, ", (, etc.)
148
+ var firstChar = content.charAt(0);
149
+ var isSymbolOrPunctuation = /[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~、。《》【】!(),:;?{|}-]/.test(firstChar);
150
+
151
+ // If previous character is not whitespace and content starts with symbol/punctuation, add space before
152
+ if (prevChar && !/\s/.test(prevChar) && isSymbolOrPunctuation) {
153
+ return prevChar + ' ' + start + content + end;
154
+ }
155
+ return match;
156
+ });
157
+ }
158
+
159
+ // Step 4: Re-run step 2 after step 3 to handle cases where both before and after spaces are needed
160
+ for (var _i3 = 0, _emphasisPatterns2 = emphasisPatterns; _i3 < _emphasisPatterns2.length; _i3++) {
161
+ var _pattern2 = _emphasisPatterns2[_i3].pattern;
162
+ result = result.replaceAll(_pattern2, function (match, start, content, end, nextChar) {
163
+ // Check if the content ends with a symbol/punctuation (like :, :, etc.)
164
+ var lastChar = content.slice(-1);
165
+ var isSymbolOrPunctuation = /[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~、。《》【】!(),:;?{|}-]/.test(lastChar);
166
+
167
+ // If content ends with symbol/punctuation and next character is not whitespace, add space
168
+ if (isSymbolOrPunctuation && nextChar && !/\s/.test(nextChar)) {
169
+ return start + content + end + ' ' + nextChar;
170
+ }
171
+ return match;
172
+ });
173
+ }
174
+ return result;
175
+ }
176
+ function splitMarkdownWithAllCodeTypes(text) {
177
+ var segments = [];
178
+ var lines = text.split('\n');
179
+ var currentSegment = '';
180
+ var isInCodeBlock = false;
181
+ var codeBlockType = null; // 'fenced' | 'indented'
182
+
183
+ for (var i = 0; i < lines.length; i++) {
184
+ var line = lines[i];
185
+
186
+ // 检查围栏代码块的开始/结束
187
+ var fencedCodeMatch = line.match(/^(\s*)(```|~~~)/);
188
+ if (fencedCodeMatch && !isInCodeBlock) {
189
+ // 开始围栏代码块
190
+ if (currentSegment) {
191
+ segments.push({
192
+ content: currentSegment,
193
+ isCode: false
194
+ });
195
+ currentSegment = '';
196
+ }
197
+ isInCodeBlock = true;
198
+ codeBlockType = 'fenced';
199
+ currentSegment = line + (i < lines.length - 1 ? '\n' : '');
200
+ } else if (fencedCodeMatch && isInCodeBlock && codeBlockType === 'fenced') {
201
+ // 结束围栏代码块
202
+ currentSegment += line + (i < lines.length - 1 ? '\n' : '');
203
+ segments.push({
204
+ content: currentSegment,
205
+ isCode: true
206
+ });
207
+ currentSegment = '';
208
+ isInCodeBlock = false;
209
+ codeBlockType = null;
210
+ } else if (isInCodeBlock) {
211
+ // 在代码块内部
212
+ currentSegment += line + (i < lines.length - 1 ? '\n' : '');
213
+ } else {
214
+ // 普通行,但需要检查行内代码
215
+ currentSegment += line + (i < lines.length - 1 ? '\n' : '');
216
+ }
217
+ }
218
+
219
+ // 处理最后的片段
220
+ if (currentSegment) {
221
+ segments.push({
222
+ content: currentSegment,
223
+ isCode: isInCodeBlock
224
+ });
225
+ }
226
+
227
+ // 进一步处理行内代码
228
+ return segments.flatMap(function (segment) {
229
+ if (segment.isCode) {
230
+ return [segment];
231
+ }
232
+ return splitInlineCode(segment.content);
233
+ });
234
+ }
235
+ export function fixMarkdownEmphasisSpacing(text) {
236
+ // 更完善的代码块识别,包括缩进代码块
237
+ var segments = splitMarkdownWithAllCodeTypes(text);
238
+ return segments.map(function (segment) {
239
+ if (segment.isCode) {
240
+ return segment.content;
241
+ }
242
+ return applyEmphasisFixes(segment.content);
243
+ }).join('');
244
+ }
@@ -80,15 +80,21 @@ export var useMarkdownComponents = function useMarkdownComponents() {
80
80
  }, stableComponentProps), componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre), props));
81
81
  };
82
82
  }, [animated, enableMermaid, fullFeaturedCodeBlock, stableComponentProps, componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre]);
83
+ var memoBr = useMemo(function () {
84
+ return function () {
85
+ return /*#__PURE__*/_jsx("br", {});
86
+ };
87
+ }, []);
83
88
  var memoComponents = useMemo(function () {
84
89
  return {
85
90
  a: memoA,
91
+ br: memoBr,
86
92
  img: memoImg,
87
93
  pre: memoPre,
88
94
  section: memoSection,
89
95
  video: memoVideo
90
96
  };
91
- }, [memoA, memoImg, memoVideo, memoPre, memoSection]);
97
+ }, [memoA, memoBr, memoImg, memoVideo, memoPre, memoSection]);
92
98
  return useMemo(function () {
93
99
  return _objectSpread(_objectSpread({}, memoComponents), components);
94
100
  }, [memoComponents, components]);
@@ -12,6 +12,7 @@ import remarkGfm from 'remark-gfm';
12
12
  import remarkMath from 'remark-math';
13
13
  import { useMarkdownContext } from "../../Markdown/components/MarkdownProvider";
14
14
  import { remarkCustomFootnotes } from "../../Markdown/plugins/footnote";
15
+ import { remarkBr } from "../../Markdown/plugins/remarkBr";
15
16
  export var useMarkdownRemarkPlugins = function useMarkdownRemarkPlugins() {
16
17
  var _useMarkdownContext = useMarkdownContext(),
17
18
  enableLatex = _useMarkdownContext.enableLatex,
@@ -28,6 +29,6 @@ export var useMarkdownRemarkPlugins = function useMarkdownRemarkPlugins() {
28
29
  }], enableLatex && remarkMath, enableCustomFootnotes && remarkCustomFootnotes, isChatMode && remarkBreaks].filter(Boolean);
29
30
  }, [isChatMode, enableLatex, enableCustomFootnotes]);
30
31
  return useMemo(function () {
31
- return [].concat(_toConsumableArray(remarkPluginsAhead), _toConsumableArray(memoPlugins), _toConsumableArray(remarkPlugins));
32
+ return [remarkBr].concat(_toConsumableArray(remarkPluginsAhead), _toConsumableArray(memoPlugins), _toConsumableArray(remarkPlugins));
32
33
  }, [remarkPlugins, memoPlugins, remarkPluginsAhead]);
33
34
  };
@@ -10,14 +10,6 @@ export declare const contentCache: Map<string, string>;
10
10
  * @param value The processed content to store
11
11
  */
12
12
  export declare const addToCache: (key: string, value: string) => void;
13
- /**
14
- * Fixes markdown bold syntax by adding space after closing bold markers
15
- * when followed by non-space characters after symbols
16
- *
17
- * @param text The markdown text to process
18
- * @returns The text with fixed bold syntax
19
- */
20
- export declare function fixMarkdownBold(text: string): string;
21
13
  /**
22
14
  * Transforms citation references in the format [n] to markdown links
23
15
  *
@@ -1,3 +1,4 @@
1
+ import { fixMarkdownEmphasisSpacing } from "./fixMarkdownEmphasisSpacing";
1
2
  import { preprocessLaTeX } from "./latex";
2
3
 
3
4
  // Cache configuration
@@ -24,75 +25,6 @@ export var addToCache = function addToCache(key, value) {
24
25
  contentCache.set(key, value);
25
26
  };
26
27
 
27
- /**
28
- * Fixes markdown bold syntax by adding space after closing bold markers
29
- * when followed by non-space characters after symbols
30
- *
31
- * @param text The markdown text to process
32
- * @returns The text with fixed bold syntax
33
- */
34
- export function fixMarkdownBold(text) {
35
- var asteriskCount = 0;
36
- var boldMarkerCount = 0;
37
- var result = '';
38
- var inCodeBlock = false;
39
- var inInlineCode = false;
40
- for (var i = 0; i < text.length; i++) {
41
- var char = text[i];
42
-
43
- // Handle code blocks
44
- if (text.slice(i, i + 3) === '```') {
45
- inCodeBlock = !inCodeBlock;
46
- result += '```';
47
- i += 2;
48
- continue;
49
- }
50
-
51
- // Handle inline code
52
- if (char === '`') {
53
- inInlineCode = !inInlineCode;
54
- result += '`';
55
- continue;
56
- }
57
-
58
- // Process asterisks only if not in code
59
- if (char === '*' && !inInlineCode && !inCodeBlock) {
60
- asteriskCount++;
61
- if (asteriskCount === 2) {
62
- boldMarkerCount++;
63
- }
64
- if (asteriskCount > 2) {
65
- result += char;
66
- continue;
67
- }
68
-
69
- // Add space before opening bold marker if needed
70
- if (asteriskCount === 2 && boldMarkerCount % 2 === 1) {
71
- var nextChar = i + 1 < text.length ? text[i + 1] : '';
72
- var isNextCharSymbol = /(?:[!-\/:-@\[-`\{-~\xA1-\xA9\xAB\xAC\xAE-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u037E\u0384\u0385\u0387\u03F6\u0482\u055A-\u055F\u0589\u058A\u058D-\u058F\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0606-\u060F\u061B\u061D-\u061F\u066A-\u066D\u06D4\u06DE\u06E9\u06FD\u06FE\u0700-\u070D\u07F6-\u07F9\u07FE\u07FF\u0830-\u083E\u085E\u0888\u0964\u0965\u0970\u09F2\u09F3\u09FA\u09FB\u09FD\u0A76\u0AF0\u0AF1\u0B70\u0BF3-\u0BFA\u0C77\u0C7F\u0C84\u0D4F\u0D79\u0DF4\u0E3F\u0E4F\u0E5A\u0E5B\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F85\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u104A-\u104F\u109E\u109F\u10FB\u1360-\u1368\u1390-\u1399\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DB\u1800-\u180A\u1940\u1944\u1945\u19DE-\u19FF\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B6A\u1B74-\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2010-\u2027\u2030-\u205E\u207A-\u207E\u208A-\u208E\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2775\u2794-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u303F\u309B\u309C\u30A0\u30FB\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAA77-\uAA79\uAADE\uAADF\uAAF0\uAAF1\uAB5B\uAB6A\uAB6B\uABEB\uFB29\uFBB2-\uFBC2\uFD3E-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD00-\uDD02\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDC77\uDC78\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEC8\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3F]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFD5-\uDFF1\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3F\uDF44\uDF45]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F[\uDC9C\uDC9F]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE8B]|\uD838[\uDD4F\uDEFF]|\uD83A[\uDD5E\uDD5F]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA])/.test(nextChar);
73
- if (isNextCharSymbol) {
74
- // 已经向 result 写入了第一个 '*',先删掉它,然后输出 ' **'
75
- result = result.slice(0, -1) + ' **';
76
- continue;
77
- }
78
- }
79
-
80
- // Add space after closing bold marker if needed
81
- if (asteriskCount === 2 && boldMarkerCount % 2 === 0) {
82
- var prevChar = i > 0 ? text[i - 2] : '';
83
- var isPrevCharSymbol = /(?:[!-\/:-@\[-`\{-~\xA1-\xA9\xAB\xAC\xAE-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u037E\u0384\u0385\u0387\u03F6\u0482\u055A-\u055F\u0589\u058A\u058D-\u058F\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0606-\u060F\u061B\u061D-\u061F\u066A-\u066D\u06D4\u06DE\u06E9\u06FD\u06FE\u0700-\u070D\u07F6-\u07F9\u07FE\u07FF\u0830-\u083E\u085E\u0888\u0964\u0965\u0970\u09F2\u09F3\u09FA\u09FB\u09FD\u0A76\u0AF0\u0AF1\u0B70\u0BF3-\u0BFA\u0C77\u0C7F\u0C84\u0D4F\u0D79\u0DF4\u0E3F\u0E4F\u0E5A\u0E5B\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F85\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u104A-\u104F\u109E\u109F\u10FB\u1360-\u1368\u1390-\u1399\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DB\u1800-\u180A\u1940\u1944\u1945\u19DE-\u19FF\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B6A\u1B74-\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2010-\u2027\u2030-\u205E\u207A-\u207E\u208A-\u208E\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2775\u2794-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u303F\u309B\u309C\u30A0\u30FB\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAA77-\uAA79\uAADE\uAADF\uAAF0\uAAF1\uAB5B\uAB6A\uAB6B\uABEB\uFB29\uFBB2-\uFBC2\uFD3E-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD00-\uDD02\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDC77\uDC78\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEC8\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3F]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFD5-\uDFF1\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3F\uDF44\uDF45]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F[\uDC9C\uDC9F]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE8B]|\uD838[\uDD4F\uDEFF]|\uD83A[\uDD5E\uDD5F]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA])/.test(prevChar);
84
- result += i + 1 < text.length && text[i + 1] !== ' ' && isPrevCharSymbol ? '* ' : '*';
85
- } else {
86
- result += '*';
87
- }
88
- } else {
89
- result += char;
90
- asteriskCount = 0;
91
- }
92
- }
93
- return result;
94
- }
95
-
96
28
  /**
97
29
  * Transforms citation references in the format [n] to markdown links
98
30
  *
@@ -212,5 +144,5 @@ export var preprocessContent = function preprocessContent(str) {
212
144
  if (enableCustomFootnotes) {
213
145
  content = transformCitations(content, citationsLength);
214
146
  }
215
- return fixMarkdownBold(content);
147
+ return fixMarkdownEmphasisSpacing(content);
216
148
  };
@@ -15,9 +15,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
15
15
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
16
16
  import { createStyles } from 'antd-style';
17
17
  import Highlighter from "../../Highlighter";
18
+ import { FALLBACK_LANG } from "../../Highlighter/const";
18
19
  import Mermaid from "../../Mermaid";
19
20
  import Snippet from "../../Snippet";
20
- import { FALLBACK_LANG } from "../../hooks/useHighlight";
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
22
  var useStyles = createStyles(function (_ref) {
23
23
  var css = _ref.css;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.8.5",
3
+ "version": "2.9.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",