[PR #17869] [CLOSED] feat: Add Footnote Reference Support to Markdown #47629

Closed
opened 2026-04-29 22:57:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/17869
Author: @danielaskdd
Created: 9/28/2025
Status: Closed

Base: mainHead: gzdaniel


📝 Commits (10+)

  • 15bd504 fix: fixed the hover effect for the MessageInput Integrations button
  • e7ccaf6 Fix: milvus error because the limit set to None by default
  • 123dbf1 feat: Add DISKANN index type support for Milvus
  • b550d78 Merge branch 'open-webui:main' into fix-milvus-limit-error
  • 9e3d540 Merge branch 'open-webui:main' into feat-milvus-diskann-support
  • 42faa63 fix: show error message when the uploading file is modified
  • 90a5b3b fix: 'Set as default'
  • 36da2b0 Update translation.json (pt-BR)
  • d126c23 Merge pull request #17783 from joaoback/patch-10
  • ac6292b Fix: truncate long model tags with a character limit

📊 Changes

85 files changed (+3567 additions, -1272 deletions)

View changed files

📝 .gitignore (+4 -0)
📝 backend/open_webui/config.py (+10 -0)
📝 backend/open_webui/functions.py (+6 -0)
📝 backend/open_webui/main.py (+1 -1)
backend/open_webui/migrations/versions/a5c220713937_add_reply_to_id_column_to_message.py (+34 -0)
📝 backend/open_webui/models/chats.py (+15 -1)
📝 backend/open_webui/models/folders.py (+14 -0)
📝 backend/open_webui/models/messages.py (+97 -12)
📝 backend/open_webui/retrieval/vector/dbs/milvus.py (+12 -4)
📝 backend/open_webui/routers/channels.py (+33 -56)
📝 backend/open_webui/routers/chats.py (+32 -0)
📝 backend/open_webui/routers/configs.py (+30 -29)
📝 backend/open_webui/routers/folders.py (+2 -9)
📝 backend/open_webui/routers/notes.py (+12 -0)
📝 backend/open_webui/routers/tools.py (+25 -9)
📝 backend/open_webui/routers/users.py (+1 -0)
📝 backend/open_webui/socket/main.py (+17 -0)
📝 backend/open_webui/utils/middleware.py (+238 -179)
📝 backend/open_webui/utils/misc.py (+0 -7)
📝 backend/open_webui/utils/models.py (+1 -0)

...and 65 more files

📄 Description

feat: Add Footnote Reference Support to Markdown

Overview

This PR adds support for footnote references in Markdown content using the syntax [^1], [^note], etc. Footnote references are rendered as superscript text that blends naturally with the surrounding content.

Footnote references are very common in RAG-generated content. Therefore, it is essential that Open-WebUI correctly renders these footnotes for improved readability and visual consistency.

Related Discussion : #17867

Feature Added

  • Adds support for footnote references in Markdown content using the syntax [^1], [^note]
  • Supported syntax :
This is text with a footnote[^1] and another[^note].
Multiple consecutive footnotes[^a][^b][^c] are properly spaced.

Rendering Behavior

  • Footnotes appear as superscript text
  • Inherit text color from surrounding content
  • Subtle hover effects for better UX
  • Proper spacing prevents visual crowding

Screenshots

image

Breaking Changes

n/a

Changes Made

New Extension (src/lib/utils/marked/footnote-extension.ts)

  • Created: New marked extension for parsing footnote reference syntax
  • Pattern: Supports [^identifier] where identifier can be alphanumeric, underscore, or hyphen
  • Security: Implements proper HTML escaping for all user content
  • Output: Generates clean superscript HTML with semantic CSS classes

Integration Updates

  • Markdown.svelte: Added footnote extension to the marked processing pipeline
  • MarkdownInlineTokens.svelte: Added rendering support for footnoteRef token type
  • Positioning: Footnote handling placed appropriately in the token processing flow

Styling (src/app.css)

  • Visual Design: Footnote references inherit parent text color and use normal font weight
  • Typography: Optimized superscript sizing (0.7em) and positioning (0.3em vertical-align)
  • User Experience: Subtle hover effect with opacity transition
  • Spacing: Proper margin (0.3em) between consecutive footnotes

Security

  • All user input is HTML-escaped
  • XSS protection through proper sanitization
  • Safe HTML generation using marked's renderer API

Testing Considerations

  • Footnote references render correctly as superscript
  • HTML escaping prevents XSS vulnerabilities
  • Multiple consecutive footnotes display with proper spacing
  • Hover effects work smoothly across different themes

🔄 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/open-webui/open-webui/pull/17869 **Author:** [@danielaskdd](https://github.com/danielaskdd) **Created:** 9/28/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `gzdaniel` --- ### 📝 Commits (10+) - [`15bd504`](https://github.com/open-webui/open-webui/commit/15bd5040f19d7bea246a91cb2bec8f78374b0de1) fix: fixed the hover effect for the MessageInput Integrations button - [`e7ccaf6`](https://github.com/open-webui/open-webui/commit/e7ccaf6e78ee8d5adf617b953578efdd01998bbd) Fix: milvus error because the limit set to None by default - [`123dbf1`](https://github.com/open-webui/open-webui/commit/123dbf152e4651b3789cdd560873986963f732ac) feat: Add DISKANN index type support for Milvus - [`b550d78`](https://github.com/open-webui/open-webui/commit/b550d78905ed7a3557ba3ce00f99758a13ce4405) Merge branch 'open-webui:main' into fix-milvus-limit-error - [`9e3d540`](https://github.com/open-webui/open-webui/commit/9e3d5407ae0726fa61dc579df5be790562601a4a) Merge branch 'open-webui:main' into feat-milvus-diskann-support - [`42faa63`](https://github.com/open-webui/open-webui/commit/42faa63227d803e20d83e49cf4ab7a81e9b540cd) fix: show error message when the uploading file is modified - [`90a5b3b`](https://github.com/open-webui/open-webui/commit/90a5b3befbdb63e299dac3d3b06cb6c2b8888361) fix: 'Set as default' - [`36da2b0`](https://github.com/open-webui/open-webui/commit/36da2b06a53db377d943390d21ee609bcb8dd50f) Update translation.json (pt-BR) - [`d126c23`](https://github.com/open-webui/open-webui/commit/d126c23ef84a42532cc861d1ac1d071a6b7bd959) Merge pull request #17783 from joaoback/patch-10 - [`ac6292b`](https://github.com/open-webui/open-webui/commit/ac6292b812f400b9180c5a26b5ccae7611a88703) Fix: truncate long model tags with a character limit ### 📊 Changes **85 files changed** (+3567 additions, -1272 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+4 -0) 📝 `backend/open_webui/config.py` (+10 -0) 📝 `backend/open_webui/functions.py` (+6 -0) 📝 `backend/open_webui/main.py` (+1 -1) ➕ `backend/open_webui/migrations/versions/a5c220713937_add_reply_to_id_column_to_message.py` (+34 -0) 📝 `backend/open_webui/models/chats.py` (+15 -1) 📝 `backend/open_webui/models/folders.py` (+14 -0) 📝 `backend/open_webui/models/messages.py` (+97 -12) 📝 `backend/open_webui/retrieval/vector/dbs/milvus.py` (+12 -4) 📝 `backend/open_webui/routers/channels.py` (+33 -56) 📝 `backend/open_webui/routers/chats.py` (+32 -0) 📝 `backend/open_webui/routers/configs.py` (+30 -29) 📝 `backend/open_webui/routers/folders.py` (+2 -9) 📝 `backend/open_webui/routers/notes.py` (+12 -0) 📝 `backend/open_webui/routers/tools.py` (+25 -9) 📝 `backend/open_webui/routers/users.py` (+1 -0) 📝 `backend/open_webui/socket/main.py` (+17 -0) 📝 `backend/open_webui/utils/middleware.py` (+238 -179) 📝 `backend/open_webui/utils/misc.py` (+0 -7) 📝 `backend/open_webui/utils/models.py` (+1 -0) _...and 65 more files_ </details> ### 📄 Description ## feat: Add Footnote Reference Support to Markdown ### Overview This PR adds support for footnote references in Markdown content using the syntax `[^1]`, `[^note]`, etc. Footnote references are rendered as superscript text that blends naturally with the surrounding content. Footnote references are very common in RAG-generated content. Therefore, it is essential that Open-WebUI correctly renders these footnotes for improved readability and visual consistency. **Related Discussion** : #17867 ### Feature Added * Adds support for footnote references in Markdown content using the syntax `[^1]`, `[^note]` * Supported syntax : ``` This is text with a footnote[^1] and another[^note]. Multiple consecutive footnotes[^a][^b][^c] are properly spaced. ``` ### Rendering Behavior - Footnotes appear as superscript text - Inherit text color from surrounding content - Subtle hover effects for better UX - Proper spacing prevents visual crowding ### Screenshots <img width="1083" height="777" alt="image" src="https://github.com/user-attachments/assets/1c9ba0af-9618-46d8-8fe0-dc5adcb886e9" /> ### Breaking Changes n/a ### Changes Made #### New Extension (`src/lib/utils/marked/footnote-extension.ts`) - **Created**: New marked extension for parsing footnote reference syntax - **Pattern**: Supports `[^identifier]` where identifier can be alphanumeric, underscore, or hyphen - **Security**: Implements proper HTML escaping for all user content - **Output**: Generates clean superscript HTML with semantic CSS classes #### Integration Updates - **Markdown.svelte**: Added footnote extension to the marked processing pipeline - **MarkdownInlineTokens.svelte**: Added rendering support for `footnoteRef` token type - **Positioning**: Footnote handling placed appropriately in the token processing flow #### Styling (`src/app.css`) - **Visual Design**: Footnote references inherit parent text color and use normal font weight - **Typography**: Optimized superscript sizing (0.7em) and positioning (0.3em vertical-align) - **User Experience**: Subtle hover effect with opacity transition - **Spacing**: Proper margin (0.3em) between consecutive footnotes ### Security - All user input is HTML-escaped - XSS protection through proper sanitization - Safe HTML generation using marked's renderer API ### Testing Considerations - Footnote references render correctly as superscript - HTML escaping prevents XSS vulnerabilities - Multiple consecutive footnotes display with proper spacing - Hover effects work smoothly across different themes --- <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-29 22:57:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#47629