Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/plugins/filters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Filters act as middleware in the message pipeline:

Fixes common Markdown formatting issues in LLM outputs, including Mermaid syntax, code blocks, and LaTeX formulas.

**Version:** 1.2.8
**Version:** 1.2.9

[:octicons-arrow-right-24: Documentation](markdown_normalizer.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/filters/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Filter 充当消息管线中的中间件:

修复 LLM 输出中常见的 Markdown 格式问题,包括 Mermaid 语法、代码块和 LaTeX 公式。

**版本:** 1.2.8
**版本:** 1.2.9

[:octicons-arrow-right-24: 查看文档](markdown_normalizer.zh.md)

Expand Down
8 changes: 7 additions & 1 deletion docs/plugins/filters/markdown_normalizer.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Markdown Normalizer Filter

| By [Fu-Jie](https://github.com/Fu-Jie) · v1.2.8 | [⭐ Star this repo](https://github.com/Fu-Jie/openwebui-extensions) |
| By [Fu-Jie](https://github.com/Fu-Jie) · v1.2.9 | [⭐ Star this repo](https://github.com/Fu-Jie/openwebui-extensions) |
| :--- | ---: |

| ![followers](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_followers.json&label=%F0%9F%91%A5&style=flat) | ![points](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_points.json&label=%E2%AD%90&style=flat) | ![top](https://img.shields.io/badge/%F0%9F%8F%86-Top%20%3C1%25-10b981?style=flat) | ![contributions](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_contributions.json&label=%F0%9F%93%A6&style=flat) | ![downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_downloads.json&label=%E2%AC%87%EF%B8%8F&style=flat) | ![saves](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_saves.json&label=%F0%9F%92%BE&style=flat) | ![views](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_views.json&label=%F0%9F%91%81%EF%B8%8F&style=flat) |
Expand All @@ -27,6 +27,10 @@ When the selection dialog opens, search for this plugin, check it, and continue.
> [!IMPORTANT]
> If the official OpenWebUI Community version is already installed, remove it first. After that, Batch Install Plugins can keep this plugin updated in future runs.

## 🔥 What's New in v1.2.9

* **Intra-word Emphasis Repair (issue [#97](https://github.com/Fu-Jie/openwebui-extensions/issues/97))**: New `enable_intra_word_emphasis_fix` Valve. When LLMs mark up punctuation-only additions inside a word boundary — e.g. `series**,**` (added comma in bold) or `word~~,~~` (added strikethrough) — most Markdown parsers refuse to render the inline emphasis because the opening delimiter is intra-word. The plugin now moves the opening marker to the start of the word (`series**,**` → `**series,**`) so the added punctuation renders together with the word. Perfect for grammar/spelling diff outputs. Only transforms cases where the wrapped content is pure punctuation, so legitimate `**bold**` / `word**bold**` markup is left untouched. Off by default.

## 🔥 What's New in v1.2.8

* **Safe-by-Default Strategy**: The `enable_escape_fix` feature is now **disabled by default**. This prevents unwanted modifications to valid technical text like Windows file paths (`C:\new\test`) or complex LaTeX formulas.
Expand Down Expand Up @@ -62,6 +66,7 @@ Before making any changes, the plugin builds a semantic map of the text to prote
- **Details Tag Normalization**: `<details>` blocks (often used for Chain of Thought) require strict spacing to render correctly. The plugin automatically injects blank lines after `</details>` and self-closing `<details />` tags.
* **Mermaid Syntax Fixer**: One of the most common LLM errors is omitting quotes in Mermaid diagrams (e.g., `A --> B(Some text)`). This plugin parses the Mermaid syntax and auto-quotes labels and citations to guarantee the graph renders.
* **Emphasis Spacing Fix**: Fixes formatting-breaking extra spaces inside bold/italic markers (e.g., `** text **` becomes `**text**`) while cleverly ignoring math expressions like `2 * 3 * 4`.
* **Intra-word Emphasis Repair**: When LLMs mark up punctuation-only additions inside a word (e.g., `series**,**` for an added comma), most parsers refuse to render the inline emphasis. The plugin moves the opening marker to the start of the word (`series**,**` → `**series,**`) so the added punctuation renders together with the word. Useful for grammar/spelling diff outputs.
* **Intelligent Escape Character Cleanup**: Removes excessive literal `\n` and `\t` generated by some models and converts them to actual structural newlines (only in safe text areas).
* **LaTeX Standardization**: Automatically upgrades old-school LaTeX delimiters (`\[...\]` and `\(...\)`) to modern Markdown standards (`$$...$$` and `$ ... $`).
* **Thought Tag Unification**: Standardizes various model thought outputs (`<think>`, `<thinking>`) into a unified `<thought>` tag.
Expand Down Expand Up @@ -102,6 +107,7 @@ The plugin UI and status notifications automatically switch based on your langua
| `enable_table_fix` | `True` | Add missing closing pipe in tables. |
| `enable_xml_tag_cleanup` | `True` | Remove leftover XML artifacts. |
| `enable_emphasis_spacing_fix` | `False` | Fix extra spaces in emphasis formatting. |
| `enable_intra_word_emphasis_fix` | `False` | Move opening emphasis marker to the start of a word (e.g., `series**,**` → `**series,**`) so punctuation-only additions render. Useful for grammar/spelling diff outputs. |
| `show_status` | `True` | Show UI status notification when a fix is actively applied. |
| `show_debug_log` | `False` | Print detailed before/after diffs to browser console (F12). |

Expand Down
8 changes: 7 additions & 1 deletion docs/plugins/filters/markdown_normalizer.zh.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Markdown 格式化过滤器 (Markdown Normalizer)

| 作者:[Fu-Jie](https://github.com/Fu-Jie) · v1.2.8 | [⭐ 点个 Star 支持项目](https://github.com/Fu-Jie/openwebui-extensions) |
| 作者:[Fu-Jie](https://github.com/Fu-Jie) · v1.2.9 | [⭐ 点个 Star 支持项目](https://github.com/Fu-Jie/openwebui-extensions) |
| :--- | ---: |

| ![followers](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_followers.json&label=%F0%9F%91%A5&style=flat) | ![points](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_points.json&label=%E2%AD%90&style=flat) | ![top](https://img.shields.io/badge/%F0%9F%8F%86-Top%20%3C1%25-10b981?style=flat) | ![contributions](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_contributions.json&label=%F0%9F%93%A6&style=flat) | ![downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_downloads.json&label=%E2%AC%87%EF%B8%8F&style=flat) | ![saves](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_saves.json&label=%F0%9F%92%BE&style=flat) | ![views](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_views.json&label=%F0%9F%91%81%EF%B8%8F&style=flat) |
Expand All @@ -27,6 +27,10 @@
> [!IMPORTANT]
> 如果你已经安装了 OpenWebUI 官方社区里的同名版本,请先删除旧版本,否则重新安装时可能报错。删除后,Batch Install Plugins 后续就可以继续负责更新这个插件。

## 🔥 最新更新 v1.2.9

* **词内强调修复 (issue [#97](https://github.com/Fu-Jie/openwebui-extensions/issues/97))**:新增 `enable_intra_word_emphasis_fix` 配置项。当 LLM 在词边界内标记仅含标点的添加时——例如 `series**,**`(添加的逗号用粗体)或 `word~~,~~`(添加的删除线)——大多数 Markdown 解析器会因为开头定界符位于词内而拒绝渲染该强调。插件现在会将开头标记移动到词的开头(`series**,**` → `**series,**`),让添加的标点能与单词一起渲染。非常适合语法/拼写差异输出。仅对包含纯标点内容的情况进行转换,因此合法的 `**bold**` / `word**bold**` 标记不会被改动。默认关闭。

## 🔥 最新更新 v1.2.8

* **“默认安全”策略 (Safe-by-Default)**:`enable_escape_fix` 功能现在**默认禁用**。这能有效防止插件在未经授权的情况下误改 Windows 路径 (`C:\new\test`) 或复杂的 LaTeX 公式。
Expand Down Expand Up @@ -60,6 +64,7 @@
- **Details 标签排版修复**:`<details>` 块要求极为严格的空行才能正确渲染内部内容。插件会自动在 `</details>` 以及自闭合 `<details />` 标签后注入安全的换行符。
* **Mermaid 语法急救**:自动修复最常见的 Mermaid 错误——为未加引号的节点标签(如 `A --> B(Some text)`)自动补充双引号,甚至支持多行标签和引用,确保拓扑图 100% 渲染。
* **强调语法间距修复**:修复加粗/斜体语法内部多余的空格(如 `** 文本 **` 变为 `**文本**`,否则 OpenWebUI 无法加粗),同时智能忽略数学算式(如 `2 * 3 * 4`)。
* **词内强调修复**:当 LLM 在词边界内标记仅含标点的添加时(如 `series**,**` 表示添加了逗号),大多数解析器会拒绝渲染该强调。插件会将开头标记移动到词的开头(`series**,**` → `**series,**`),让添加的标点能与单词一起渲染。适合语法/拼写差异输出。
* **智能转义字符清理**:将模型过度转义生成的字面量 `\n` 和 `\t` 转化为真正的换行和缩进(仅在安全的纯文本区域执行)。
* **LaTeX 现代化转换**:自动将旧式的 LaTeX 定界符(`\[...\]` 和 `\(...\)`)升级为现代 Markdown 标准(`$$...$$` 和 `$ ... $`)。
* **思维标签大一统**:无论模型输出的是 `<think>` 还是 `<thinking>`,统一标准化为 `<thought>` 标签。
Expand Down Expand Up @@ -100,6 +105,7 @@
| `enable_table_fix` | `True` | 修复表格中缺失的闭合管道符。 |
| `enable_xml_tag_cleanup` | `True` | 清理残留的 XML 分析标签。 |
| `enable_emphasis_spacing_fix` | `False` | 修复强调语法(加粗/斜体)内部的多余空格。 |
| `enable_intra_word_emphasis_fix` | `False` | 将开头的强调标记移动到词的开头(如 `series**,**` → `**series,**`),让仅含标点的添加能正常渲染。适合语法/拼写差异输出。 |
| `show_status` | `True` | 当触发任何修复规则时,在页面底部显示提示气泡。 |
| `show_debug_log` | `False` | 在浏览器控制台 (F12) 打印修改前后的详细对比日志。 |

Expand Down
9 changes: 9 additions & 0 deletions plugins/filters/markdown_normalizer/FEATURES_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@ Here is the result <antArtifact>hidden metadata</antArtifact>.
**示例**:
* **Before**: `| Col 1 | Col 2`
* **After**: `| Col 1 | Col 2 |`

## 11. 词内强调修复 (Intra-word Emphasis Fix)
**功能**: 当 LLM 在词边界内标记仅含标点的添加时(如语法/拼写差异输出中的 `series**,**` 表示添加了逗号),大多数 Markdown 解析器会拒绝渲染该强调,因为开头的定界符位于词内。本插件会将开头标记移动到词的开头,让添加的标点能与单词一起渲染。仅对包含纯标点内容的情况生效,合法的 `**bold**` / `word**bold**` 等标记不会被改动;代码块与行内代码也受到保护。
**默认**: 关闭 (`enable_intra_word_emphasis_fix = False`)
**示例**:
* **Before**: `series**,**` (加粗的逗号无法渲染)
* **After**: `**series,**` (整个 "series," 加粗渲染)

支持 `**` (加粗)、`~~` (删除线)、`__` (加粗)、`***` / `___` (加粗+斜体) 等所有多字符强调标记。
8 changes: 7 additions & 1 deletion plugins/filters/markdown_normalizer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Markdown Normalizer Filter

| By [Fu-Jie](https://github.com/Fu-Jie) · v1.2.8 | [⭐ Star this repo](https://github.com/Fu-Jie/openwebui-extensions) |
| By [Fu-Jie](https://github.com/Fu-Jie) · v1.2.9 | [⭐ Star this repo](https://github.com/Fu-Jie/openwebui-extensions) |
| :--- | ---: |

| ![followers](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_followers.json&label=%F0%9F%91%A5&style=flat) | ![points](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_points.json&label=%E2%AD%90&style=flat) | ![top](https://img.shields.io/badge/%F0%9F%8F%86-Top%20%3C1%25-10b981?style=flat) | ![contributions](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_contributions.json&label=%F0%9F%93%A6&style=flat) | ![downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_downloads.json&label=%E2%AC%87%EF%B8%8F&style=flat) | ![saves](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_saves.json&label=%F0%9F%92%BE&style=flat) | ![views](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FFu-Jie%2Fdb3d95687075a880af6f1fba76d679c6%2Fraw%2Fbadge_views.json&label=%F0%9F%91%81%EF%B8%8F&style=flat) |
Expand All @@ -27,6 +27,10 @@ When the selection dialog opens, search for this plugin, check it, and continue.
> [!IMPORTANT]
> If the official OpenWebUI Community version is already installed, remove it first. After that, Batch Install Plugins can keep this plugin updated in future runs.

## 🔥 What's New in v1.2.9

* **Intra-word Emphasis Repair (issue [#97](https://github.com/Fu-Jie/openwebui-extensions/issues/97))**: New `enable_intra_word_emphasis_fix` Valve. When LLMs mark up punctuation-only additions inside a word boundary — e.g. `series**,**` (added comma in bold) or `word~~,~~` (added strikethrough) — most Markdown parsers refuse to render the inline emphasis because the opening delimiter is intra-word. The plugin now moves the opening marker to the start of the word (`series**,**` → `**series,**`) so the added punctuation renders together with the word. Perfect for grammar/spelling diff outputs. Only transforms cases where the wrapped content is pure punctuation, so legitimate `**bold**` / `word**bold**` markup is left untouched. Off by default.

## 🔥 What's New in v1.2.8

* **Safe-by-Default Strategy**: The `enable_escape_fix` feature is now **disabled by default**. This prevents unwanted modifications to valid technical text like Windows file paths (`C:\new\test`) or complex LaTeX formulas.
Expand Down Expand Up @@ -62,6 +66,7 @@ Before making any changes, the plugin builds a semantic map of the text to prote
- **Details Tag Normalization**: `<details>` blocks (often used for Chain of Thought) require strict spacing to render correctly. The plugin automatically injects blank lines after `</details>` and self-closing `<details />` tags.
* **Mermaid Syntax Fixer**: One of the most common LLM errors is omitting quotes in Mermaid diagrams (e.g., `A --> B(Some text)`). This plugin parses the Mermaid syntax and auto-quotes labels and citations to guarantee the graph renders.
* **Emphasis Spacing Fix**: Fixes formatting-breaking extra spaces inside bold/italic markers (e.g., `** text **` becomes `**text**`) while cleverly ignoring math expressions like `2 * 3 * 4`.
* **Intra-word Emphasis Repair**: When LLMs mark up punctuation-only additions inside a word (e.g., `series**,**` for an added comma), most parsers refuse to render the inline emphasis. The plugin moves the opening marker to the start of the word (`series**,**` → `**series,**`) so the added punctuation renders together with the word. Useful for grammar/spelling diff outputs.
* **Intelligent Escape Character Cleanup**: Removes excessive literal `\n` and `\t` generated by some models and converts them to actual structural newlines (only in safe text areas).
* **LaTeX Standardization**: Automatically upgrades old-school LaTeX delimiters (`\[...\]` and `\(...\)`) to modern Markdown standards (`$$...$$` and `$ ... $`).
* **Thought Tag Unification**: Standardizes various model thought outputs (`<think>`, `<thinking>`) into a unified `<thought>` tag.
Expand Down Expand Up @@ -102,6 +107,7 @@ The plugin UI and status notifications automatically switch based on your langua
| `enable_table_fix` | `True` | Add missing closing pipe in tables. |
| `enable_xml_tag_cleanup` | `True` | Remove leftover XML artifacts. |
| `enable_emphasis_spacing_fix` | `False` | Fix extra spaces in emphasis formatting. |
| `enable_intra_word_emphasis_fix` | `False` | Move opening emphasis marker to the start of a word (e.g., `series**,**` → `**series,**`) so punctuation-only additions render. Useful for grammar/spelling diff outputs. |
| `show_status` | `True` | Show UI status notification when a fix is actively applied. |
| `show_debug_log` | `False` | Print detailed before/after diffs to browser console (F12). |

Expand Down
Loading
Loading