[PR #14394] ui: santize HTML in chat markdown #14654

Open
opened 2026-04-13 01:00:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14394
Author: @hoyyeva
Created: 2/24/2026
Status: 🔄 Open

Base: mainHead: hoyyeva/app-html


📝 Commits (1)

  • d0c96be ui: santize HTML in chat markdown

📊 Changes

2 files changed (+242 additions, -1 deletions)

View changed files

app/ui/app/src/components/StreamingMarkdownContent.test.ts (+202 -0)
📝 app/ui/app/src/components/StreamingMarkdownContent.tsx (+40 -1)

📄 Description

Summary

  • Add rehype-sanitize to the markdown rendering pipeline to prevent model-generated HTML (e.g. <style>,
    <script>, <iframe> tags) from leaking into the Ollama UI
  • Extend the default GitHub sanitization schema to preserve math rendering (KaTeX), custom citations, and code
    language classes
  • Add tests verifying dangerous tags are stripped while safe markdown elements are preserved

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14394 **Author:** [@hoyyeva](https://github.com/hoyyeva) **Created:** 2/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `hoyyeva/app-html` --- ### 📝 Commits (1) - [`d0c96be`](https://github.com/ollama/ollama/commit/d0c96be74ee1acc6c678e0e67cebf706c2698a2e) ui: santize HTML in chat markdown ### 📊 Changes **2 files changed** (+242 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `app/ui/app/src/components/StreamingMarkdownContent.test.ts` (+202 -0) 📝 `app/ui/app/src/components/StreamingMarkdownContent.tsx` (+40 -1) </details> ### 📄 Description **Summary** - Add rehype-sanitize to the markdown rendering pipeline to prevent model-generated HTML (e.g. `<style>`, `<script>`, `<iframe>` tags) from leaking into the Ollama UI - Extend the default GitHub sanitization schema to preserve math rendering (KaTeX), custom citations, and code language classes - Add tests verifying dangerous tags are stripped while safe markdown elements are preserved --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 01:00:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14654