diff --git a/README-zh.md b/README-zh.md new file mode 100644 index 0000000..714c1e6 --- /dev/null +++ b/README-zh.md @@ -0,0 +1,63 @@ +# Obsidian 源碼筆記插件 + +[English Document](./README.md) + +技術支持 [AntV X6](https://x6.antv.antgroup.com/) + +## 一、插件功能 + +- 解析 Obsidian 筆記中的代碼區塊,繪製成方法調用鏈路的圖形,並在畫布中保留代碼區塊,方便查看 +![Demo](img/demo.gif) + +## 二、如何使用 + +### 1. 在 Markdown 的 代碼區塊 的 代碼註釋 部分,通過 關鍵字 編寫相關信息 + +| 支持的關鍵字 | 效果 | +| ------------ |-----------------------------| +| @class | 方法對應的類名稱 | +| @function | 方法名稱 | +| @call | 調用相關的方法,支持多個。格式: 類名稱 @ 方法名稱 | + +**範例** + +```Java +/** + * Register metadata string. + * + * @class ShenyuClientHttpRegistryController + * @function registerMetadata(@RequestBody final MetaDataRegisterDTO metaDataRegisterDTO) + * @call RegisterClientServerDisruptorPublisher @ publish(final DataTypeParent data) + * + * @param metaDataRegisterDTO the meta data register dto + * @return the string + */ +@PostMapping("/register-metadata") +@ResponseBody +public String registerMetadata(@RequestBody final MetaDataRegisterDTO metaDataRegisterDTO) { + // 通过 Publisher 注册 元数据对象 + publisher.publish(metaDataRegisterDTO); + return ShenyuResultMessage.SUCCESS; +} +``` + +```Java +/** + * Register metadata string. + * + * @class RegisterClientServerDisruptorPublisher + * @function publish(final DataTypeParent data) + * + * @param metaDataRegisterDTO the meta data register dto + * @return the string + */ +@Override +public void publish(final DataTypeParent data) { + // 获取 DisruptorProvider + DisruptorProvider> provider = providerManage.getProvider(); + // 调用 DisruptorProvider 的 onData 方法,发送数据 + provider.onData(Collections.singleton(data)); +} +``` + +### 2. 點擊 Obsidian 左側按鈕,打開畫布 diff --git a/README.md b/README.md index 8a5b5fa..908ea05 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# Obsidian 源碼筆記插件 +# Obsidian Source Code Plugin -[技術支持 AntV X6](https://x6.antv.antgroup.com/) +[中文文檔](./README-zh.md) -## 一、插件功能 +Technical Support [AntV X6](https://x6.antv.antgroup.com/) -- 解析 Obsidian 筆記中的代碼區塊,繪製成方法調用鏈路的圖形,並在畫布中保留代碼區塊,方便查看 +## Functionality + +- Parse the code blocks in Obsidian notes, draw the graphs of the method call links, and keep the code blocks in the canvas for easy viewing ![Demo](img/demo.gif) -## 二、如何使用 +## How to use -### 1. 在 Markdown 的 代碼區塊 的 代碼註釋 部分,通過 關鍵字 編寫相關信息 +### 1. In the code comments section of Markdown's code block, write the relevant information with the keyword -目前暫時只支持 Java - -| 支持的關鍵字 | 效果 | +| Supported keywords | Effect | | ------------ |-----------------------------| -| @class | 方法對應的類名稱 | -| @function | 方法名稱 | -| @call | 調用相關的方法,支持多個。格式: 類名稱 @ 方法名稱 | +| @class | Name of the class corresponding to the method | +| @function | Method Name | +| @call | Call the related method, multiple methods are supported. Format: class name @ method name | -**範例** +**Example** ```Java /** @@ -59,3 +59,4 @@ public void publish(final DataTypeParent data) { provider.onData(Collections.singleton(data)); } ``` +### 2. Click the button to the left of Obsidian to open the canvas diff --git a/manifest.json b/manifest.json index ff4187f..5f2b42c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "id": "obsidian-code-note", - "name": "Source Code Note Plugin", + "name": "Source Code Note", "version": "1.0.0", "minAppVersion": "1.0.0", - "description": "This is a source code plugin for Obsidian. This plugin can help you organize source code note easily.", + "description": "This plugin can help you organize source code note easily.", "author": "Waiting", "authorUrl": "https://github.com/waiting0324", "isDesktopOnly": false