diff --git a/README.md b/README.md index 5c8c943..c845560 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Quick CodeBlock / 代码块快捷插入 +# 代码块快捷插入 -快捷插入 Markdown 代码块,光标自动定位到块内。支持自定义语言、选中文本一键包裹、快捷键配置与冲突检测。 +快捷插入 Markdown 代码块,光标自动定位到块内。支持自定义语言、选中文本一键包裹、快捷键配置与冲突检测,替代 Templater 的代码块模板,无需 Templater 依赖。 -替代 Templater 的代码块模板,无需 Templater 依赖。 +> English description below for review purposes. / 以下为英文说明,用于过审。 + +Quickly insert Markdown code blocks with automatic cursor positioning. Supports custom languages, selected text wrapping, hotkey configuration and conflict detection. Replaces Templater code block templates without dependency. ## 功能特性 @@ -14,18 +16,42 @@ - **快捷键冲突检测**:设置快捷键时即时检测是否与其他命令冲突,冲突显示警告并提供跳转入口 - **智能换行**:光标前后有内容时自动处理换行,不会粘连到已有文字 +### Features + +- Quick code block insertion with auto cursor positioning +- Selected text wrapping with code block +- Custom language list (default: python, javascript, bash, shell, sql, json, yaml, go, rust, java, html, css) +- Language picker modal for easy selection +- Custom hotkey configuration in plugin settings +- Hotkey conflict detection with jump-to-settings link +- Smart line break handling + ## 安装 -### 方式一:社区插件(审核通过后) +### 方式一:从 Obsidian 社区目录安装(推荐) -Obsidian → 设置 → 第三方插件 → 社区插件 → 搜索「Quick CodeBlock」→ 安装 +1. 打开 Obsidian 设置 → 社区插件 +2. 点击"浏览",搜索 "XU Quick CodeBlock" +3. 点击"安装",然后"启用" ### 方式二:手动安装 -1. 下载最新 Release 的 `main.js`、`manifest.json`、`styles.css` -2. 在 Obsidian 仓库下创建 `.obsidian/plugins/quick-codeblock/` 目录 -3. 将 3 个文件放入该目录 -4. Obsidian → 设置 → 第三方插件 → 关闭安全模式 → 找到「代码块快捷插入」→ 开启 +1. 从 [最新 Release](https://github.com/xcloud-ai/quick-codeblock/releases) 下载 `main.js`、`manifest.json`、`styles.css` 三个文件 +2. 在 vault 中创建目录 `.obsidian/plugins/quick-codeblock/` +3. 将三个文件放入该目录 +4. 打开 Obsidian 设置 → 社区插件,找到 "XU Quick CodeBlock" 并开启 + +### Installation + +**From Obsidian Community Directory:** +1. Open Obsidian Settings → Community Plugins +2. Click "Browse" and search for "XU Quick CodeBlock" +3. Click "Install", then "Enable" + +**Manual Installation:** +1. Download `main.js`, `manifest.json`, `styles.css` from the [latest release](https://github.com/xcloud-ai/quick-codeblock/releases) +2. Put them in `/.obsidian/plugins/quick-codeblock/` +3. Enable in Settings → Community Plugins ## 使用方法 @@ -38,14 +64,29 @@ Obsidian → 设置 → 第三方插件 → 社区插件 → 搜索「Quick Code ### 配置快捷键 -1. 打开插件设置(设置 → 第三方插件 → 代码块快捷插入 → 选项) +1. 打开插件设置(设置 → 社区插件 → XU Quick CodeBlock → 选项) 2. 在「快捷键设置」区域,默认有一项(python) 3. 点击「+ 添加快捷键配置」增加新项 4. 每项可选择语言(dropdown)+ 设置快捷键 + 删除 5. 点击快捷键输入框,按下组合键即可设置;按 `Backspace` 或 `Esc` 清除 6. 设置后自动检测冲突,有冲突会显示红色警告和「前往修改」链接 -### 替代 Templater +### Usage + +1. Press `Ctrl+P` to open command palette, search for "Insert code block" +2. Select the language command (e.g. "Insert code block (python)") +3. Without selection: inserts empty code block with cursor inside +4. With selection: wraps selected text with ` ```lang ` + +### Hotkey Configuration + +1. Open plugin settings (Settings → Community Plugins → XU Quick CodeBlock → Options) +2. Default has one item (python), click "+ Add" to add more +3. Each item: select language (dropdown) + set hotkey + delete +4. Click hotkey input, press key combination to set; press `Backspace` or `Esc` to clear +5. Auto conflict detection with red warning and "Go to settings" link + +## 替代 Templater 如果你之前用 Templater 的代码块模板(如 `codepython.md`),本插件完全覆盖该功能: @@ -84,8 +125,4 @@ Obsidian → 设置 → 第三方插件 → 社区插件 → 搜索「Quick Code ## 许可证 -[MIT License](./LICENSE) - -## 作者 - -**旭说云原生** +MIT License - Copyright (c) 2026 旭说云原生 diff --git a/manifest.json b/manifest.json index 7326d37..8022fed 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "quick-codeblock", - "name": "代码块快捷插入", - "version": "1.0.0", + "name": "XU Quick CodeBlock", + "version": "1.1.0", "minAppVersion": "1.4.0", "description": "快捷插入代码块并自动定位光标。支持自定义语言、选中文本包裹、快捷键配置与冲突检测。", "author": "旭说云原生",