@alicloud/appflow-chat 0.0.3 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/appflow-chat",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Appflow-Chat AI聊天机器人组件库,提供聊天服务和UI组件",
5
5
  "type": "module",
6
6
  "main": "./dist/appflow-chat.cjs.js",
@@ -53,9 +53,28 @@ export const MarkdownView: React.FC<MarkdownViewProps> = ({
53
53
  />
54
54
  );
55
55
  },
56
- code: ({ node, className, ...props }: any) => {
56
+ code: ({ node, inline, className, ...props }: any) => {
57
+ // 判断是否为行内代码
58
+ // 行内代码没有 className,且 inline 为 true
59
+ const isInline = inline || (!className && !node?.properties?.className);
60
+
61
+ if (isInline) {
62
+ // 行内代码 - 使用简单的 <code> 标签样式
63
+ return (
64
+ <code style={{
65
+ backgroundColor: 'rgba(175, 184, 193, 0.2)',
66
+ padding: '0.2em 0.4em',
67
+ borderRadius: '3px',
68
+ fontSize: '85%',
69
+ fontFamily: 'Consolas, Monaco, "Andale Mono", monospace',
70
+ }}>
71
+ {props.children}
72
+ </code>
73
+ );
74
+ }
75
+
57
76
  // 元信息中解析语言类型
58
- const languageType = /language-(\w+)/.exec(node?.properties?.className || '')?.[0];
77
+ const languageType = /language-(\w+)/.exec(node?.properties?.className || className || '')?.[0];
59
78
  const langFromMeta = node?.position?.start?.line === 2 ? 'language-file' : null;
60
79
  const finalLang = languageType || langFromMeta;
61
80