From aabb24c9cd9bbada55a1097dcee333aacdc18dc6 Mon Sep 17 00:00:00 2001 From: fujie Date: Sat, 10 Jan 2026 15:53:36 +0800 Subject: [PATCH] docs: update READMEs for markdown normalizer --- plugins/filters/markdown_normalizer/README.md | 44 +++++++++++++++++++ .../filters/markdown_normalizer/README_CN.md | 44 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 plugins/filters/markdown_normalizer/README.md create mode 100644 plugins/filters/markdown_normalizer/README_CN.md diff --git a/plugins/filters/markdown_normalizer/README.md b/plugins/filters/markdown_normalizer/README.md new file mode 100644 index 0000000..9759ffa --- /dev/null +++ b/plugins/filters/markdown_normalizer/README.md @@ -0,0 +1,44 @@ +# Markdown Normalizer Filter + +A production-grade content normalizer filter for Open WebUI that fixes common Markdown formatting issues in LLM outputs. It ensures that code blocks, LaTeX formulas, Mermaid diagrams, and other Markdown elements are rendered correctly. + +## Features + +* **Mermaid Syntax Fix**: Automatically fixes common Mermaid syntax errors, such as unquoted node labels and unclosed subgraphs, ensuring diagrams render correctly. +* **Frontend Console Debugging**: Supports printing structured debug logs directly to the browser console (F12) for easier troubleshooting. +* **Code Block Formatting**: Fixes broken code block prefixes, suffixes, and indentation. +* **LaTeX Normalization**: Standardizes LaTeX formula delimiters (`\[` -> `$$`, `\(` -> `$`). +* **Thought Tag Normalization**: Unifies thought tags (``, `` -> ``). +* **Escape Character Fix**: Cleans up excessive escape characters (`\\n`, `\\t`). +* **List Formatting**: Ensures proper newlines in list items. +* **Heading Fix**: Adds missing spaces in headings (`#Heading` -> `# Heading`). +* **Table Fix**: Adds missing closing pipes in tables. +* **XML Cleanup**: Removes leftover XML artifacts. + +## Usage + +1. Install the plugin in Open WebUI. +2. Enable the filter globally or for specific models. +3. Configure the enabled fixes in the **Valves** settings. +4. (Optional) Enable **Show Debug Log** in Valves to view detailed logs in the browser console. + +## Configuration (Valves) + +* `priority`: Filter priority (default: 50). +* `enable_escape_fix`: Fix excessive escape characters. +* `enable_thought_tag_fix`: Normalize thought tags. +* `enable_code_block_fix`: Fix code block formatting. +* `enable_latex_fix`: Normalize LaTeX formulas. +* `enable_list_fix`: Fix list item newlines (Experimental). +* `enable_unclosed_block_fix`: Auto-close unclosed code blocks. +* `enable_fullwidth_symbol_fix`: Fix full-width symbols in code blocks. +* `enable_mermaid_fix`: Fix Mermaid syntax errors. +* `enable_heading_fix`: Fix missing space in headings. +* `enable_table_fix`: Fix missing closing pipe in tables. +* `enable_xml_tag_cleanup`: Cleanup leftover XML tags. +* `show_status`: Show status notification when fixes are applied. +* `show_debug_log`: Print debug logs to browser console. + +## License + +MIT diff --git a/plugins/filters/markdown_normalizer/README_CN.md b/plugins/filters/markdown_normalizer/README_CN.md new file mode 100644 index 0000000..1475e77 --- /dev/null +++ b/plugins/filters/markdown_normalizer/README_CN.md @@ -0,0 +1,44 @@ +# Markdown 格式化过滤器 (Markdown Normalizer) + +这是一个用于 Open WebUI 的生产级内容格式化过滤器,旨在修复 LLM 输出中常见的 Markdown 格式问题。它能确保代码块、LaTeX 公式、Mermaid 图表和其他 Markdown 元素被正确渲染。 + +## 功能特性 + +* **Mermaid 语法修复**: 自动修复常见的 Mermaid 语法错误,如未加引号的节点标签和未闭合的子图 (Subgraph),确保图表能正确渲染。 +* **前端控制台调试**: 支持将结构化的调试日志直接打印到浏览器控制台 (F12),方便排查问题。 +* **代码块格式化**: 修复破损的代码块前缀、后缀和缩进问题。 +* **LaTeX 规范化**: 标准化 LaTeX 公式定界符 (`\[` -> `$$`, `\(` -> `$`)。 +* **思维标签规范化**: 统一思维链标签 (``, `` -> ``)。 +* **转义字符修复**: 清理过度的转义字符 (`\\n`, `\\t`)。 +* **列表格式化**: 确保列表项有正确的换行。 +* **标题修复**: 修复标题中缺失的空格 (`#标题` -> `# 标题`)。 +* **表格修复**: 修复表格中缺失的闭合管道符。 +* **XML 清理**: 移除残留的 XML 标签。 + +## 使用方法 + +1. 在 Open WebUI 中安装此插件。 +2. 全局启用或为特定模型启用此过滤器。 +3. 在 **Valves** 设置中配置需要启用的修复项。 +4. (可选) 在 Valves 中开启 **显示调试日志 (Show Debug Log)** 以在浏览器控制台中查看详细日志。 + +## 配置项 (Valves) + +* `priority`: 过滤器优先级 (默认: 50)。 +* `enable_escape_fix`: 修复过度的转义字符。 +* `enable_thought_tag_fix`: 规范化思维标签。 +* `enable_code_block_fix`: 修复代码块格式。 +* `enable_latex_fix`: 规范化 LaTeX 公式。 +* `enable_list_fix`: 修复列表项换行 (实验性)。 +* `enable_unclosed_block_fix`: 自动闭合未闭合的代码块。 +* `enable_fullwidth_symbol_fix`: 修复代码块中的全角符号。 +* `enable_mermaid_fix`: 修复 Mermaid 语法错误。 +* `enable_heading_fix`: 修复标题中缺失的空格。 +* `enable_table_fix`: 修复表格中缺失的闭合管道符。 +* `enable_xml_tag_cleanup`: 清理残留的 XML 标签。 +* `show_status`: 应用修复时显示状态通知。 +* `show_debug_log`: 在浏览器控制台打印调试日志。 + +## 许可证 + +MIT