Skip to content

Commit a9cdc3a

Browse files
committed
fix: Configure Docusaurus to use MDX and add a preprocessor to escape special characters in markdown
1 parent 7d5b133 commit a9cdc3a

9 files changed

Lines changed: 58 additions & 23 deletions

File tree

docs/sdks/api/conversation/setConversationListener.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ values={[
4545
### 返回结果
4646

4747
| 参数名称 | 参数类型 | 描述 |
48-
| -------- | ------------------------------------------------------------------- | ---- | --- |
49-
| listener | [ConversationListener](/listener/conversationListener.md) || |
48+
| -------- | ------------------------------------------------------------------- | ---- |
49+
| listener | [ConversationListener](/listener/conversationListener.md) ||
5050

5151
### 代码示例
5252

@@ -69,8 +69,8 @@ values={[
6969
### 返回结果
7070

7171
| 参数名称 | 参数类型 | 描述 |
72-
| -------- | -------------------------------------------------------------------------- | ---- | --- |
73-
| listener | id < [ConversationListener](/listener/conversationListener.md) > || |
72+
| -------- | -------------------------------------------------------------------------- | ---- |
73+
| listener | id < [ConversationListener](/listener/conversationListener.md) > ||
7474

7575
### 代码示例
7676

@@ -93,8 +93,8 @@ values={[
9393
### 返回结果
9494

9595
| 参数名称 | 参数类型 | 描述 |
96-
| -------- | ------------------------------------------------------------------- | ---- | --- |
97-
| listener | [ConversationListener](/listener/conversationListener.md) || |
96+
| -------- | ------------------------------------------------------------------- | ---- |
97+
| listener | [ConversationListener](/listener/conversationListener.md) ||
9898

9999
### 代码示例
100100

@@ -175,8 +175,8 @@ public static void SetConversationListener(IConversationListener l)
175175
### 返回结果
176176

177177
| 参数名称 | 参数类型 | 描述 |
178-
| -------- | ------------------------------------------------------------------- | ---- | --- |
179-
| l | [IConversationListener](/listener/conversationListener.md) || |
178+
| -------- | ------------------------------------------------------------------- | ---- |
179+
| l | [IConversationListener](/listener/conversationListener.md) ||
180180

181181
### 代码示例
182182

docs/sdks/api/group/setGroupListener.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ values={[
4545
### 返回结果
4646

4747
| 参数名称 | 参数类型 | 描述 |
48-
| -------- | ------------------------------------------------------- | ---- | --- |
49-
| listener | [OnGroupListener](/listener/groupListener.md) || |
48+
| -------- | ------------------------------------------------------- | ---- |
49+
| listener | [OnGroupListener](/listener/groupListener.md) ||
5050

5151
### 代码示例
5252

@@ -80,8 +80,8 @@ values={[
8080
### 返回结果
8181

8282
| 参数名称 | 参数类型 | 描述 |
83-
| -------- | ------------------------------------------------------------ | ---- | --- |
84-
| listener | id < [GroupListener](/listener/groupListener.md) > || |
83+
| -------- | ------------------------------------------------------------ | ---- |
84+
| listener | id < [GroupListener](/listener/groupListener.md) > ||
8585

8686
### 代码示例
8787

docs/sdks/api/message/setMessageListener.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ values={[
4545
### 返回结果
4646

4747
| 参数名称 | 参数类型 | 描述 |
48-
| -------- | ------------------------------------------------------------------- | ---- | --- |
49-
| listener | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) || |
48+
| -------- | ------------------------------------------------------------------- | ---- |
49+
| listener | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) ||
5050

5151
### 代码示例
5252

@@ -79,8 +79,8 @@ OpenIM.iMManager.messageManager.setAdvancedMsgListener(OnAdvancedMsgListener(
7979
### 返回结果
8080

8181
| 参数名称 | 参数类型 | 描述 |
82-
| -------- | --------------------------------------------------------------------------- | ---- | --- |
83-
| listener | id < [OIMAdvancedMsgListener](/listener/advancedMsgListener.md) > || |
82+
| -------- | --------------------------------------------------------------------------- | ---- |
83+
| listener | id < [OIMAdvancedMsgListener](/listener/advancedMsgListener.md) > ||
8484

8585
### 代码示例
8686

@@ -103,8 +103,8 @@ OpenIM.iMManager.messageManager.setAdvancedMsgListener(OnAdvancedMsgListener(
103103
### 输入参数
104104

105105
| 参数名称 | 参数类型 | 描述 |
106-
| -------- | ------------------------------------------------------------------- | ---- | --- |
107-
| listener | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) || |
106+
| -------- | ------------------------------------------------------------------- | ---- |
107+
| listener | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) ||
108108

109109
### 代码示例
110110

@@ -204,8 +204,8 @@ public static void SetAdvancedMsgListener(IAdvancedMsgListener l)
204204
### 输入参数
205205

206206
| 参数名称 | 参数类型 | 描述 |
207-
| -------- | ------------------------------------------------------------------- | ---- | --- |
208-
| l | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) || |
207+
| -------- | ------------------------------------------------------------------- | ---- |
208+
| l | [OnAdvancedMsgListener](/listener/advancedMsgListener.md) ||
209209

210210
### 代码示例
211211

docusaurus.config.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,42 @@ const config = {
9191

9292

9393
markdown: {
94-
format: 'detect',
94+
format: 'mdx',
95+
mdx1Compat: {
96+
comments: true,
97+
admonitions: true,
98+
headingIds: true,
99+
},
100+
preprocessor: ({filePath, fileContent}) => {
101+
// Escape {WEBHOOK_ADDRESS} globally - MDX treats it as a JSX expression
102+
let content = fileContent.replace(/\{WEBHOOK_ADDRESS\}/g, '&#123;WEBHOOK_ADDRESS&#125;');
103+
// Escape autolink URLs <http://...> and <https://...> - MDX treats as JSX
104+
content = content.replace(/<(https?:\/\/[^>]+)>/g, '[$1]($1)');
105+
// Escape bare < > in table rows and type annotation lines
106+
const lines = content.split('\n');
107+
let inCode = false;
108+
const typePattern = /(?:Promise|OnBase|List|NSArray|OIMSimpleResultInfo|Map|HashMap)<(?!\/?(?:Tabs|TabItem)[\s/>])/;
109+
const result = lines.map(line => {
110+
const trimmed = line.trim();
111+
if (trimmed.startsWith('```')) {
112+
inCode = !inCode;
113+
return line;
114+
}
115+
if (inCode) return line;
116+
const isTable = trimmed.startsWith('|');
117+
const hasTypeAngle = typePattern.test(line);
118+
if (!isTable && !hasTypeAngle) return line;
119+
if (isTable && /^\|[\s\-:|]+\|$/.test(trimmed)) return line;
120+
let result = line;
121+
result = result.replace(/\\>/g, '&gt;');
122+
result = result.replace(/<(?!\/?(?:Tabs|TabItem)[\s/>])/g, '&lt;');
123+
if (isTable) {
124+
result = result.replace(/\{/g, '&#123;').replace(/\}/g, '&#125;');
125+
}
126+
return result;
127+
});
128+
return result.join('\n');
129+
},
95130
hooks: {
96131
onBrokenMarkdownLinks: 'throw',
97132
},
229 KB
Loading
161 KB
Loading
313 KB
Loading
410 KB
Loading

i18n/en/docusaurus-plugin-content-docs-blog/current/client/build/Flutter/flutter-demo-build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ This article will guide you from zero to quickly building and running an instant
1212

1313
OpenIMSDK is an open-source IM SDK that delivers highly controlled server deployment and data handling, catering to contexts that require optimal security and autonomy. Using OpenIMSDK, developers can launch applications similar to WeChat, Slack, or Zoom, supporting features ranging from text chats to audio/video calls.
1414

15-
import demo_preview1 from './assets/preveiw1.zh-CN.jpeg';
16-
import demo_preview2 from './assets/preveiw2.zh-CN.jpeg';
15+
import demo_preview1 from './assets/preview1.jpeg';
16+
import demo_preview2 from './assets/preview2.jpeg';
1717

1818
<div style={{ display: 'flex', justifyContent: 'center', gap: '8px' }}>
1919
<img src={demo_preview1} alt="Preview" width="32%" />

0 commit comments

Comments
 (0)