mn-docs-mcp 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.trae/documents/libmn_cleanup_plan.md +51 -0
- package/.trae/documents/libmn_doc_restructure_plan.md +140 -0
- package/.trae/documents/libmn_indentation_plan.md +116 -0
- package/.trae/documents/libmn_title_hierarchy_plan.md +91 -0
- package/README.md +9 -7
- package/next-env.d.ts +6 -0
- package/next.config.mjs +14 -0
- package/package.json +25 -10
- package/postcss.config.mjs +7 -0
- package/scripts/sync-definitions.mjs +33 -0
- package/source.config.ts +5 -0
- package/src/app/[[...slug]]/page.tsx +259 -0
- package/src/app/api/search/route.ts +6 -0
- package/src/app/global.css +81 -0
- package/src/app/layout.tsx +33 -0
- package/src/components/JsbApiFooter.tsx +251 -0
- package/src/content/docs/{guides/contributing.md → contributing.md} +27 -2
- package/src/content/docs/{guides/cookbook → cookbook}/addon-settings.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/embed-webview-panel.md +2 -2
- package/src/content/docs/cookbook/meta.json +13 -0
- package/src/content/docs/{guides/cookbook → cookbook}/network-api-call.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/webview-bidirectional-js.md +1 -1
- package/src/content/docs/guides/meta.json +14 -0
- package/src/content/docs/guides/mindmap-and-selection.md +1 -1
- package/src/content/docs/guides/native-ui.md +2 -2
- package/src/content/docs/guides/network-requests.md +1 -1
- package/src/content/docs/guides/notes-and-database.md +1 -1
- package/src/content/docs/guides/storage-and-files.md +1 -1
- package/src/content/docs/index.mdx +13 -38
- package/src/content/docs/libmn/data-converter.md +1572 -0
- package/src/content/docs/libmn/frame.md +279 -0
- package/src/content/docs/libmn/headers.md +234 -0
- package/src/content/docs/libmn/index.md +60 -0
- package/src/content/docs/libmn/internal-exposed.md +46 -0
- package/src/content/docs/libmn/locale.md +307 -0
- package/src/content/docs/libmn/menu.md +77 -0
- package/src/content/docs/libmn/meta.json +27 -0
- package/src/content/docs/libmn/mnbutton.md +966 -0
- package/src/content/docs/libmn/mncomment.md +533 -0
- package/src/content/docs/libmn/mnconnection.md +717 -0
- package/src/content/docs/libmn/mndocument.md +309 -0
- package/src/content/docs/libmn/mnextension-panel.md +340 -0
- package/src/content/docs/libmn/mnnote.md +533 -0
- package/src/content/docs/libmn/mnnotebook.md +725 -0
- package/src/content/docs/libmn/mnutil.md +2936 -0
- package/src/content/docs/libmn/mnwebview.md +693 -0
- package/src/content/docs/libmn/mustache.md +65 -0
- package/src/content/docs/libmn/response.md +352 -0
- package/src/content/docs/libmn/runtime-assets.md +64 -0
- package/src/content/docs/libmn/runtime-web-view-host.md +77 -0
- package/src/content/docs/libmn/runtime.md +178 -0
- package/src/content/docs/libmn/vendor-globals.md +34 -0
- package/src/content/docs/meta.json +11 -0
- package/src/content/docs/reference/foundation/meta.json +4 -0
- package/src/content/docs/reference/foundation/ns-user-defaults.md +1 -1
- package/src/content/docs/reference/global/meta.json +18 -0
- package/src/content/docs/reference/marginnote/mb-book-note.md +50 -53
- package/src/content/docs/reference/marginnote/meta.json +18 -0
- package/src/content/docs/reference/marginnote/study-controller.md +17 -17
- package/src/content/docs/reference/meta.json +14 -0
- package/src/content/docs/reference/quartzcore/meta.json +4 -0
- package/src/content/docs/reference/uikit/meta.json +4 -0
- package/src/content/docs/reference/uikit/uiwebview.md +2 -2
- package/src/content/docs/reference/utility/meta.json +4 -0
- package/src/lib/layout.tsx +31 -0
- package/src/lib/source.ts +7 -0
- package/tsconfig.json +42 -3
- package/astro.config.mjs +0 -130
- package/src/client/jsb-api-footer.ts +0 -242
- package/src/components/Footer.astro +0 -57
- package/src/components/Search.astro +0 -330
- package/src/content.config.ts +0 -7
- package/src/styles/starlight-overrides.css +0 -23
- /package/src/content/docs/{guides/cookbook → cookbook}/append-selection-as-comment.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/batch-rename-notes.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/export-notebook.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/focus-note-in-mindmap.md +0 -0
|
@@ -40,7 +40,7 @@ NSUserDefaults.standardUserDefaults().setObjectForKey(newKey, "my_addon_api_key"
|
|
|
40
40
|
Application.sharedInstance().showHUD("已保存", self.window, 2);
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
若需用该 Key 发起网络请求,可参考 [调用远程 API](/
|
|
43
|
+
若需用该 Key 发起网络请求,可参考 [调用远程 API](/cookbook/network-api-call/) 和 [网络请求](/guides/network-requests/)。保存后可选择调用简单 API 验证 Key 是否有效。
|
|
44
44
|
|
|
45
45
|
**完整流程简述**:
|
|
46
46
|
|
|
@@ -50,4 +50,4 @@ Application.sharedInstance().showHUD("已保存", self.window, 2);
|
|
|
50
50
|
4. 插件主逻辑(如是否显示面板)在需要时从 NSUserDefaults 读取。
|
|
51
51
|
5. (可选)保存 API Key 后调用简单接口验证是否有效。
|
|
52
52
|
|
|
53
|
-
**相关**:[存储与文件](/guides/storage-and-files/)、[NSUserDefaults](/reference/foundation/ns-user-defaults/)、[原生 UI](/guides/native-ui/)、[调用远程 API](/
|
|
53
|
+
**相关**:[存储与文件](/guides/storage-and-files/)、[NSUserDefaults](/reference/foundation/ns-user-defaults/)、[原生 UI](/guides/native-ui/)、[调用远程 API](/cookbook/network-api-call/)
|
|
@@ -5,7 +5,7 @@ description: 从工具栏打开浮窗,浮窗内为 UIWebView,加载本地或
|
|
|
5
5
|
|
|
6
6
|
**场景**:用户点击插件工具栏按钮后,在主界面上显示一个浮窗面板,面板内为 [UIWebView](/reference/uikit/uiwebview/),加载本地或内联 HTML;面板内可通过自定义 URL 触发插件逻辑(如 showHUD),插件也可通过 `evaluateJavaScript` 更新页面内容。
|
|
7
7
|
|
|
8
|
-
**要点**:浮窗为自定义 ViewController 的 view,在入口中 `JSB.require` 该 ViewController **一次**,在 `sceneWillConnect` 中创建实例;在 ViewController 的 **viewWillAppear** 中设置 `webView.delegate = self`,在 **viewWillDisappear** 中 `webView.stopLoading()` 并 `webView.delegate = null`。加载 HTML 用 `loadHTMLStringBaseURL(html, null)`,加载失败时在 `webViewDidFailLoadWithError` 中用 `error.localizedDescription` 拼 HTML 后用 `loadHTMLStringBaseURL` 显示错误页。双向通信写法见 [WebView 内 JS 与插件 JS 双向通信](/
|
|
8
|
+
**要点**:浮窗为自定义 ViewController 的 view,在入口中 `JSB.require` 该 ViewController **一次**,在 `sceneWillConnect` 中创建实例;在 ViewController 的 **viewWillAppear** 中设置 `webView.delegate = self`,在 **viewWillDisappear** 中 `webView.stopLoading()` 并 `webView.delegate = null`。加载 HTML 用 `loadHTMLStringBaseURL(html, null)`,加载失败时在 `webViewDidFailLoadWithError` 中用 `error.localizedDescription` 拼 HTML 后用 `loadHTMLStringBaseURL` 显示错误页。双向通信写法见 [WebView 内 JS 与插件 JS 双向通信](/cookbook/webview-bidirectional-js/)。
|
|
9
9
|
|
|
10
10
|
下文给出与 Samples/UIKit/WebView 同构的完整代码:main.js 中挂面板与切换显示,MyWebViewController.js 中创建 WebView、生命周期与 delegate。
|
|
11
11
|
|
|
@@ -154,5 +154,5 @@ var MyWebViewController = JSB.defineClass('MyWebViewController : UIViewControlle
|
|
|
154
154
|
## 相关
|
|
155
155
|
|
|
156
156
|
- [工具栏与命令](/guides/toolbar-and-commands/)、[原生 UI:使用 WebView](/guides/native-ui/#使用-webview)
|
|
157
|
-
- [WebView 内 JS 与插件 JS 双向通信](/
|
|
157
|
+
- [WebView 内 JS 与插件 JS 双向通信](/cookbook/webview-bidirectional-js/)、[UIWebView](/reference/uikit/uiwebview/)
|
|
158
158
|
- [网络请求](/guides/network-requests/) —— 获取远程数据后注入 HTML 或通过 evaluateJavaScript 注入
|
|
@@ -106,7 +106,7 @@ async function fetchWithAPIKey() {
|
|
|
106
106
|
}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
API Key 的保存与读取见 [插件设置页](/
|
|
109
|
+
API Key 的保存与读取见 [插件设置页](/cookbook/addon-settings/)。保存后可选择调用简单 API 验证 Key 是否有效。
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
@@ -131,5 +131,5 @@ async function fetchPlainText() {
|
|
|
131
131
|
## 相关
|
|
132
132
|
|
|
133
133
|
- [网络请求](/guides/network-requests/) —— Base64 与 MNNetwork 完整代码、data 转 JSON/文本说明
|
|
134
|
-
- [插件设置页](/
|
|
134
|
+
- [插件设置页](/cookbook/addon-settings/) —— 存储 API Key
|
|
135
135
|
- [笔记与数据库](/guides/notes-and-database/) —— 修改笔记与 Undo
|
|
@@ -109,4 +109,4 @@ self.webView.evaluateJavaScript("document.getElementById('text').innerText = '
|
|
|
109
109
|
## 相关
|
|
110
110
|
|
|
111
111
|
- [UIWebView](/reference/uikit/uiwebview/)、[原生 UI:使用 WebView](/guides/native-ui/#使用-webview)
|
|
112
|
-
- [Cookbook:在插件中嵌入 WebView 面板](/
|
|
112
|
+
- [Cookbook:在插件中嵌入 WebView 面板](/cookbook/embed-webview-panel/)
|
|
@@ -73,4 +73,4 @@ if (focusNote && text && text.length > 0) {
|
|
|
73
73
|
## 相关
|
|
74
74
|
|
|
75
75
|
- [StudyController](/reference/marginnote/study-controller/)、[NotebookController](/reference/marginnote/notebook-controller/)、[DocumentController](/reference/marginnote/document-controller/)
|
|
76
|
-
- [Cookbook:将选区追加为评论](/
|
|
76
|
+
- [Cookbook:将选区追加为评论](/cookbook/append-selection-as-comment/)、[在脑图中高亮指定笔记](/cookbook/focus-note-in-mindmap/)
|
|
@@ -122,7 +122,7 @@ self.webView.evaluateJavaScript("document.title", function (result) {
|
|
|
122
122
|
});
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
WebView 内 JS 与插件 JS 的双向通信(自定义 URL Scheme 拦截 + evaluateJavaScript)见 [Cookbook:WebView 内 JS 与插件 JS 双向通信](/
|
|
125
|
+
WebView 内 JS 与插件 JS 的双向通信(自定义 URL Scheme 拦截 + evaluateJavaScript)见 [Cookbook:WebView 内 JS 与插件 JS 双向通信](/cookbook/webview-bidirectional-js/)。
|
|
126
126
|
|
|
127
127
|
## 布局与圆角
|
|
128
128
|
|
|
@@ -133,4 +133,4 @@ WebView 内 JS 与插件 JS 的双向通信(自定义 URL Scheme 拦截 + eval
|
|
|
133
133
|
|
|
134
134
|
- [UIView](/reference/uikit/uiview/)、[UIButton](/reference/uikit/uibutton/)、[UIAlertView](/reference/uikit/uialertview/)、[UIWebView](/reference/uikit/uiwebview/)、[UIColor](/reference/uikit/uicolor/)
|
|
135
135
|
- [工具栏与命令](/guides/toolbar-and-commands/) — 将面板与工具栏按钮联动
|
|
136
|
-
- [Cookbook:WebView 内 JS 与插件 JS 双向通信](/
|
|
136
|
+
- [Cookbook:WebView 内 JS 与插件 JS 双向通信](/cookbook/webview-bidirectional-js/)
|
|
@@ -303,6 +303,6 @@ NSURLConnection.sendAsynchronousRequestQueueCompletionHandler(
|
|
|
303
303
|
|
|
304
304
|
## 相关
|
|
305
305
|
|
|
306
|
-
- [Cookbook:调用远程 API](/
|
|
306
|
+
- [Cookbook:调用远程 API](/cookbook/network-api-call/) —— 将 API 结果展示或写入笔记
|
|
307
307
|
- [JavaScript 原生环境](/reference/js-runtime/) —— 为何没有 fetch
|
|
308
308
|
- [NSURLConnection](/reference/foundation/ns-url-connection/)、[NSMutableURLRequest](/reference/foundation/ns-mutable-url-request/)
|
|
@@ -96,4 +96,4 @@ if (note) {
|
|
|
96
96
|
## 相关
|
|
97
97
|
|
|
98
98
|
- [Database](/reference/global/database/)、[MbBookNote](/reference/marginnote/mb-book-note/)、[UndoManager](/reference/utility/undo-manager/)
|
|
99
|
-
- [Cookbook:批量修改笔记标题](/
|
|
99
|
+
- [Cookbook:批量修改笔记标题](/cookbook/batch-rename-notes/)
|
|
@@ -87,5 +87,5 @@ NSUserDefaults.standardUserDefaults().setBoolForKey(newValue, "my_addon_show_pan
|
|
|
87
87
|
## 相关
|
|
88
88
|
|
|
89
89
|
- [NSUserDefaults](/reference/foundation/ns-user-defaults/)、[NSFileManager](/reference/foundation/ns-file-manager/)、[NSData](/reference/foundation/ns-data/)
|
|
90
|
-
- [Cookbook:插件设置页](/
|
|
90
|
+
- [Cookbook:插件设置页](/cookbook/addon-settings/)
|
|
91
91
|
- [网络请求](/guides/network-requests/) —— 网络响应 NSData 的 JSON 解析同理
|
|
@@ -1,44 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MarginNote 插件开发文档
|
|
3
|
-
description: MarginNote 插件开发的完整 API
|
|
4
|
-
template: splash
|
|
5
|
-
hero:
|
|
6
|
-
tagline: 为 MarginNote 编写插件的官方/社区参考文档
|
|
7
|
-
image:
|
|
8
|
-
file: ../../assets/houston.webp
|
|
9
|
-
actions:
|
|
10
|
-
- text: 快速开始
|
|
11
|
-
link: /guides/getting-started/
|
|
12
|
-
icon: right-arrow
|
|
13
|
-
- text: API 参考
|
|
14
|
-
link: /reference/global/jsb/
|
|
15
|
-
icon: document
|
|
16
|
-
variant: minimal
|
|
3
|
+
description: MarginNote 插件开发的完整 API 参考与渐进式教程。
|
|
17
4
|
---
|
|
18
5
|
|
|
19
|
-
import { Card,
|
|
6
|
+
import { Card, Cards } from 'fumadocs-ui/components/card';
|
|
20
7
|
|
|
21
|
-
|
|
8
|
+
# MarginNote 插件开发文档
|
|
22
9
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<Card title="
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
按任务查找完整可运行代码:批量改标题、导出笔记本、高亮笔记、设置页等。
|
|
34
|
-
[查看配方](/guides/cookbook/batch-rename-notes/)
|
|
35
|
-
</Card>
|
|
36
|
-
<Card title="API 参考" icon="open-book">
|
|
37
|
-
全局对象、MarginNote 核心、Foundation、UIKit、Utility 的完整 API 说明。
|
|
38
|
-
[进入 API](/reference/global/jsb/)
|
|
39
|
-
</Card>
|
|
40
|
-
<Card title="贡献指南" icon="heart">
|
|
41
|
-
参与文档改进:贡献流程、API 参考与教程的格式规范、Markdown 约定等。
|
|
42
|
-
[查看贡献指南](/guides/contributing/)
|
|
43
|
-
</Card>
|
|
44
|
-
</CardGrid>
|
|
10
|
+
为 MarginNote 编写插件的 API 参考、渐进式教程与 Cookbook 配方。
|
|
11
|
+
|
|
12
|
+
<Cards>
|
|
13
|
+
<Card title="快速开始" href="/guides/getting-started/" description="从零运行你的第一个插件,了解开发流程。" />
|
|
14
|
+
<Card title="教程" href="/guides/lifecycle-and-window/" description="按学习路径掌握生命周期、笔记与数据库等核心概念。" />
|
|
15
|
+
<Card title="Cookbook" href="/cookbook/batch-rename-notes/" description="按任务查找完整可运行代码。" />
|
|
16
|
+
<Card title="API 参考" href="/reference/global/jsb/" description="全局对象与核心 API 的完整说明。" />
|
|
17
|
+
<Card title="LibMN" href="/libmn/" description="LibMN 运行时与插件开发核心模块。" />
|
|
18
|
+
<Card title="贡献指南" href="/contributing/" description="参与文档改进,了解格式规范。" />
|
|
19
|
+
</Cards>
|