Compare commits

..

2 Commits

9 changed files with 4024 additions and 2009 deletions

View File

@@ -158,7 +158,7 @@ if (response.ok) {
## 完整示例
参考 [js_render_poc.py](../plugins/actions/js-render-poc/js_render_poc.py) 获取完整的 PoC 实现。
参考 [js_render_poc.py](https://github.com/Fu-Jie/awesome-openwebui/blob/main/plugins/actions/js-render-poc/js_render_poc.py) 获取完整的 PoC 实现。
## 事件类型

View File

@@ -1,7 +1,7 @@
# Export to Word
<span class="category-badge action">Action</span>
<span class="version-badge">v0.2.0</span>
<span class="version-badge">v0.4.0</span>
Export conversation to Word (.docx) with **syntax highlighting**, **native math equations**, **Mermaid diagrams**, **citations**, and **enhanced table formatting**.
@@ -34,11 +34,34 @@ You can configure the following settings via the **Valves** button in the plugin
| Valve | Description | Default |
| :--- | :--- | :--- |
| `TITLE_SOURCE` | Source for document title/filename. Options: `chat_title`, `ai_generated`, `markdown_title` | `chat_title` |
| `MERMAID_JS_URL` | URL for the Mermaid.js library (for diagram rendering). | `https://cdn.jsdelivr.net/npm/mermaid@10.9.1/dist/mermaid.min.js` |
| `MERMAID_PNG_SCALE` | Scale factor for Mermaid PNG generation (Resolution). Higher = clearer but larger file size. | `3.0` |
| `MERMAID_DISPLAY_SCALE` | Scale factor for Mermaid visual size in Word. >1.0 to enlarge, <1.0 to shrink. | `1.5` |
| `MERMAID_OPTIMIZE_LAYOUT` | Automatically convert LR (Left-Right) flowcharts to TD (Top-Down) for better fit. | `True` |
| `MAX_EMBED_IMAGE_MB` | Maximum image size to embed into DOCX (MB). | `20` |
| `UI_LANGUAGE` | User interface language. Options: `en` (English), `zh` (Chinese). | `en` |
| `FONT_LATIN` | Font name for Latin characters. | `Times New Roman` |
| `FONT_ASIAN` | Font name for Asian characters. | `SimSun` |
| `FONT_CODE` | Font name for code blocks. | `Consolas` |
| `TABLE_HEADER_COLOR` | Table header background color (Hex without #). | `F2F2F2` |
| `TABLE_ZEBRA_COLOR` | Table alternating row background color (Hex without #). | `FBFBFB` |
| `MERMAID_JS_URL` | URL for the Mermaid.js library. | `https://cdn.jsdelivr.net/npm/mermaid@11.12.2/dist/mermaid.min.js` |
| `MERMAID_JSZIP_URL` | URL for the JSZip library (required for DOCX manipulation). | `https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js` |
| `MERMAID_PNG_SCALE` | Scale factor for Mermaid PNG generation (Resolution). | `3.0` |
| `MERMAID_DISPLAY_SCALE` | Scale factor for Mermaid visual size in Word. | `1.0` |
| `MERMAID_OPTIMIZE_LAYOUT` | Automatically convert LR (Left-Right) flowcharts to TD (Top-Down). | `False` |
| `MERMAID_BACKGROUND` | Background color for Mermaid diagrams (e.g., `white`, `transparent`). | `transparent` |
| `MERMAID_CAPTIONS_ENABLE` | Enable/disable figure captions for Mermaid diagrams. | `True` |
| `MERMAID_CAPTION_STYLE` | Paragraph style name for Mermaid captions. | `Caption` |
| `MERMAID_CAPTION_PREFIX` | Caption prefix label (e.g., 'Figure'). Empty = auto-detect based on language. | `""` |
| `MATH_ENABLE` | Enable LaTeX math block conversion. | `True` |
| `MATH_INLINE_DOLLAR_ENABLE` | Enable inline `$ ... $` math conversion. | `True` |
### User-Level Configuration (UserValves)
Users can override the following settings in their personal settings:
- `TITLE_SOURCE`
- `UI_LANGUAGE`
- `FONT_LATIN`, `FONT_ASIAN`, `FONT_CODE`
- `TABLE_HEADER_COLOR`, `TABLE_ZEBRA_COLOR`
- `MERMAID_...` (Selected Mermaid settings)
- `MATH_...` (Math settings)
---

View File

@@ -1,7 +1,7 @@
# Export to Word导出为 Word
<span class="category-badge action">Action</span>
<span class="version-badge">v0.2.0</span>
<span class="version-badge">v0.4.0</span>
将当前对话导出为完美格式的 Word 文档,支持**代码语法高亮**、**原生数学公式**、**Mermaid 图表**、**引用资料**以及**增强表格**渲染。
@@ -34,11 +34,34 @@ Export to Word 插件会把聊天消息从 Markdown 转成精致的 Word 文档
| Valve | 说明 | 默认值 |
| :--- | :--- | :--- |
| `TITLE_SOURCE` | 文档标题/文件名的来源。选项:`chat_title` (对话标题), `ai_generated` (AI 生成), `markdown_title` (Markdown 标题) | `chat_title` |
| `MERMAID_JS_URL` | Mermaid.js 库的 URL用于图表渲染。 | `https://cdn.jsdelivr.net/npm/mermaid@10.9.1/dist/mermaid.min.js` |
| `MERMAID_PNG_SCALE` | Mermaid PNG 生成缩放比例(分辨率)。越高越清晰但文件越大。 | `3.0` |
| `MERMAID_DISPLAY_SCALE` | Mermaid 在 Word 中的显示比例(视觉大小)。>1.0 放大, <1.0 缩小。 | `1.5` |
| `MERMAID_OPTIMIZE_LAYOUT` | 优化 Mermaid 布局: 自动将 LR (左右) 转换为 TD (上下) 以适应页面。 | `True` |
| `MAX_EMBED_IMAGE_MB` | 嵌入图片的最大大小 (MB)。 | `20` |
| `UI_LANGUAGE` | 界面语言。选项:`en` (英语), `zh` (中文)。 | `zh` |
| `FONT_LATIN` | 英文字体名称。 | `Calibri` |
| `FONT_ASIAN` | 中文字体名称。 | `SimSun` |
| `FONT_CODE` | 代码字体名称。 | `Consolas` |
| `TABLE_HEADER_COLOR` | 表头背景色(十六进制,不带#)。 | `F2F2F2` |
| `TABLE_ZEBRA_COLOR` | 表格隔行背景色(十六进制,不带#)。 | `FBFBFB` |
| `MERMAID_JS_URL` | Mermaid.js 库的 URL。 | `https://cdn.jsdelivr.net/npm/mermaid@11.12.2/dist/mermaid.min.js` |
| `MERMAID_JSZIP_URL` | JSZip 库的 URL用于 DOCX 操作)。 | `https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js` |
| `MERMAID_PNG_SCALE` | Mermaid PNG 生成缩放比例(分辨率)。 | `3.0` |
| `MERMAID_DISPLAY_SCALE` | Mermaid 在 Word 中的显示比例(视觉大小)。 | `1.0` |
| `MERMAID_OPTIMIZE_LAYOUT` | 优化 Mermaid 布局: 自动将 LR (左右) 转换为 TD (上下)。 | `False` |
| `MERMAID_BACKGROUND` | Mermaid 图表背景色(如 `white`, `transparent`)。 | `transparent` |
| `MERMAID_CAPTIONS_ENABLE` | 启用/禁用 Mermaid 图表的图注。 | `True` |
| `MERMAID_CAPTION_STYLE` | Mermaid 图注的段落样式名称。 | `Caption` |
| `MERMAID_CAPTION_PREFIX` | 图注前缀(如 '图')。留空则根据语言自动检测。 | `""` |
| `MATH_ENABLE` | 启用 LaTeX 数学公式块转换。 | `True` |
| `MATH_INLINE_DOLLAR_ENABLE` | 启用行内 `$ ... $` 数学公式转换。 | `True` |
### 用户级配置 (UserValves)
用户可以在个人设置中覆盖以下配置:
- `TITLE_SOURCE`
- `UI_LANGUAGE`
- `FONT_LATIN`, `FONT_ASIAN`, `FONT_CODE`
- `TABLE_HEADER_COLOR`, `TABLE_ZEBRA_COLOR`
- `MERMAID_...` (部分 Mermaid 设置)
- `MATH_...` (数学公式设置)
---

View File

@@ -63,7 +63,7 @@ Actions are interactive plugins that:
Export the current conversation to a formatted Word doc with **syntax highlighting**, **native math equations**, **Mermaid diagrams**, **citations**, and **enhanced table formatting**.
**Version:** 0.2.0
**Version:** 0.4.0
[:octicons-arrow-right-24: Documentation](export-to-word.md)

View File

@@ -63,7 +63,7 @@ Actions 是交互式插件,能够:
将当前对话导出为完美格式的 Word 文档,支持**代码语法高亮**、**原生数学公式**、**Mermaid 图表**、**引用资料**以及**增强表格**渲染。
**版本:** 0.2.0
**版本:** 0.4.0
[:octicons-arrow-right-24: 查看文档](export-to-word.md)

View File

@@ -24,11 +24,24 @@ You can configure the following settings via the **Valves** button in the plugin
- `chat_title`: Use the conversation title (default).
- `ai_generated`: Use AI to generate a short title based on the content.
- `markdown_title`: Extract the first h1/h2 heading from the Markdown content.
- **MERMAID_JS_URL**: URL for the Mermaid.js library (for diagram rendering).
- **MAX_EMBED_IMAGE_MB**: Maximum image size to embed into DOCX (MB). Default: `20`.
- **UI_LANGUAGE**: User interface language, supports `en` (English) and `zh` (Chinese). Default: `en`.
- **FONT_LATIN**: Font name for Latin characters. Default: `Times New Roman`.
- **FONT_ASIAN**: Font name for Asian characters. Default: `SimSun`.
- **FONT_CODE**: Font name for code blocks. Default: `Consolas`.
- **TABLE_HEADER_COLOR**: Table header background color (Hex without #). Default: `F2F2F2`.
- **TABLE_ZEBRA_COLOR**: Table alternating row background color (Hex without #). Default: `FBFBFB`.
- **MERMAID_JS_URL**: URL for the Mermaid.js library.
- **MERMAID_JSZIP_URL**: URL for the JSZip library (required for DOCX manipulation).
- **MERMAID_PNG_SCALE**: Scale factor for Mermaid PNG generation (Resolution). Default: `3.0`.
- **MERMAID_DISPLAY_SCALE**: Scale factor for Mermaid visual size in Word. Default: `1.5`.
- **MERMAID_OPTIMIZE_LAYOUT**: Automatically convert LR (Left-Right) flowcharts to TD (Top-Down). Default: `True`.
- **MERMAID_CAPTIONS_ENABLE**: Enable/disable figure captions for Mermaid diagrams.
- **MERMAID_DISPLAY_SCALE**: Scale factor for Mermaid visual size in Word. Default: `1.0`.
- **MERMAID_OPTIMIZE_LAYOUT**: Automatically convert LR (Left-Right) flowcharts to TD (Top-Down). Default: `False`.
- **MERMAID_BACKGROUND**: Background color for Mermaid diagrams (e.g., `white`, `transparent`). Default: `transparent`.
- **MERMAID_CAPTIONS_ENABLE**: Enable/disable figure captions for Mermaid diagrams. Default: `True`.
- **MERMAID_CAPTION_STYLE**: Paragraph style name for Mermaid captions. Default: `Caption`.
- **MERMAID_CAPTION_PREFIX**: Caption prefix label (e.g., 'Figure'). Empty = auto-detect based on language.
- **MATH_ENABLE**: Enable LaTeX math block conversion (`\[...\]` and `$$...$$`). Default: `True`.
- **MATH_INLINE_DOLLAR_ENABLE**: Enable inline `$ ... $` math conversion. Default: `True`.
## Supported Markdown Syntax
@@ -75,6 +88,20 @@ All dependencies are declared in the plugin docstring.
## Changelog
### v0.4.0
- **Multi-language Support**: Added UI language switching (English/Chinese) with localized messages.
- **Font & Style Configuration**: Customizable fonts for Latin/Asian text and code, plus table colors.
- **Mermaid Enhancements**:
- Hybrid client-side rendering (SVG+PNG) for better clarity and compatibility.
- Configurable background color, fixing issues in dark mode.
- Added error boundaries to prevent export failures on render errors.
- **Performance**: Real-time progress updates for large document exports.
- **Bug Fixes**:
- Fixed parsing errors in Markdown tables containing code blocks or links.
- Fixed parsing issues with underscores (`_`), asterisks (`*`), and tildes (`~`) used as long separators.
- Enhanced error handling for image embedding.
### v0.3.0
- **Mermaid Diagrams**: Native support for rendering Mermaid diagrams as images in Word.

View File

@@ -24,11 +24,24 @@
- `chat_title`:使用对话标题(默认)。
- `ai_generated`:使用 AI 根据内容生成简短标题。
- `markdown_title`:从 Markdown 内容中提取第一个一级或二级标题。
- **MERMAID_JS_URL**Mermaid.js 库的 URL用于图表渲染
- **MAX_EMBED_IMAGE_MB**:嵌入图片的最大大小 (MB)。默认:`20`
- **UI_LANGUAGE**:界面语言,支持 `en` (英语) 和 `zh` (中文)。默认:`zh`
- **FONT_LATIN**:英文字体名称。默认:`Calibri`
- **FONT_ASIAN**:中文字体名称。默认:`SimSun`
- **FONT_CODE**:代码字体名称。默认:`Consolas`
- **TABLE_HEADER_COLOR**:表头背景色(十六进制,不带#)。默认:`F2F2F2`
- **TABLE_ZEBRA_COLOR**:表格隔行背景色(十六进制,不带#)。默认:`FBFBFB`
- **MERMAID_JS_URL**Mermaid.js 库的 URL。
- **MERMAID_JSZIP_URL**JSZip 库的 URL用于 DOCX 操作)。
- **MERMAID_PNG_SCALE**Mermaid PNG 生成缩放比例(分辨率)。默认:`3.0`
- **MERMAID_DISPLAY_SCALE**Mermaid 在 Word 中的显示比例(视觉大小)。默认:`1.5`
- **MERMAID_OPTIMIZE_LAYOUT**:自动将 LR左右流程图转换为 TD上下。默认`True`
- **MERMAID_CAPTIONS_ENABLE**:启用/禁用 Mermaid 图表的图注
- **MERMAID_DISPLAY_SCALE**Mermaid 在 Word 中的显示比例(视觉大小)。默认:`1.0`
- **MERMAID_OPTIMIZE_LAYOUT**:自动将 LR左右流程图转换为 TD上下。默认`False`
- **MERMAID_BACKGROUND**Mermaid 图表背景色(如 `white`, `transparent`)。默认:`transparent`
- **MERMAID_CAPTIONS_ENABLE**:启用/禁用 Mermaid 图表的图注。默认:`True`
- **MERMAID_CAPTION_STYLE**Mermaid 图注的段落样式名称。默认:`Caption`
- **MERMAID_CAPTION_PREFIX**:图注前缀(如 '图')。留空则根据语言自动检测。
- **MATH_ENABLE**:启用 LaTeX 数学公式块转换(`\[...\]``$$...$$`)。默认:`True`
- **MATH_INLINE_DOLLAR_ENABLE**:启用行内 `$ ... $` 数学公式转换。默认:`True`
## 支持的 Markdown 语法
@@ -75,6 +88,20 @@
## 更新日志
### v0.4.0
- **多语言支持**: 新增界面语言切换(中文/英文),提示信息更友好。
- **字体与样式配置**: 支持自定义中英文字体、代码字体以及表格颜色。
- **Mermaid 增强**:
- 客户端混合渲染SVG+PNG提高清晰度与兼容性。
- 支持背景色配置,修复深色模式下的显示问题。
- 增加错误边界,渲染失败时显示提示而非中断导出。
- **性能优化**: 导出大型文档时提供实时进度反馈。
- **Bug 修复**:
- 修复 Markdown 表格中包含代码块或链接时的解析错误。
- 修复下划线(`_`)、星号(`*`)、波浪号(`~`)作为长分隔符时的解析问题。
- 增强图片嵌入的错误处理。
### v0.3.0
- **Mermaid 图表**: 原生支持将 Mermaid 图表渲染为 Word 中的图片。

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff