[GH-ISSUE #20801] issue: HTML Preview renders code blocks inside thinking blocks #34820

Closed
opened 2026-04-25 09:00:13 -05:00 by GiteaMirror · 9 comments
Owner

Originally created by @IDEDARY on GitHub (Jan 19, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20801

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.7.1

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

The preview should render only code that is outside of thinking block

Actual Behavior

Merges all codeblocks into one and renders them, does not matter if they are inside thinking block

Steps to Reproduce

  1. Have OpenWebUI
  2. Have thinking model that can code
  3. Click preview on the code and you will see that it also used code blocks inside thinking block

Logs & Screenshots

Image

Additional Information

No response

Originally created by @IDEDARY on GitHub (Jan 19, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20801 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.7.1 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior The preview should render only code that is outside of thinking block ### Actual Behavior Merges all codeblocks into one and renders them, does not matter if they are inside thinking block ### Steps to Reproduce 1. Have OpenWebUI 2. Have thinking model that can code 3. Click preview on the code and you will see that it also used code blocks inside thinking block ### Logs & Screenshots <img width="1860" height="935" alt="Image" src="https://github.com/user-attachments/assets/a6486441-8e19-467b-b6e3-3545070f7345" /> ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-25 09:00:13 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Jan 19, 2026):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #20719 issue: The MATLAB code block is not properly highlighted.
    by 17Reset • Jan 16, 2026 • bug

  2. #20632 issue: Inconsistent behavior when editing section breaks.
    by jdwx • Jan 13, 2026 • bug

  3. #14541 issue: Rendering an artifact with an error breaks code blocks.
    by MicahZoltu • May 31, 2025 • bug

  4. #18922 issue: When code is present in the return output, the dialog box does not use code blocks.
    by pureGavin • Nov 04, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3769934543 --> @owui-terminator[bot] commented on GitHub (Jan 19, 2026): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#20719](https://github.com/open-webui/open-webui/issues/20719) **issue: The MATLAB code block is not properly highlighted.** *by 17Reset • Jan 16, 2026 • `bug`* 2. [#20632](https://github.com/open-webui/open-webui/issues/20632) **issue: Inconsistent behavior when editing section breaks.** *by jdwx • Jan 13, 2026 • `bug`* 3. [#14541](https://github.com/open-webui/open-webui/issues/14541) **issue: Rendering an artifact with an error breaks code blocks.** *by MicahZoltu • May 31, 2025 • `bug`* 4. [#18922](https://github.com/open-webui/open-webui/issues/18922) **issue: When code is present in the return output, the dialog box does not use code blocks.** *by pureGavin • Nov 04, 2025 • `bug`* --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@tjbck commented on GitHub (Jan 22, 2026):

Testing wanted with dev branch here!

<!-- gh-comment-id:3786686459 --> @tjbck commented on GitHub (Jan 22, 2026): Testing wanted with dev branch here!
Author
Owner

@adhusch commented on GitHub (Feb 10, 2026):

Testing wanted with dev branch here!

Tested using [git-3567054-slim] (dev-slim). I see a model dependent behaviour. Works for GPT-OSS, for Mistral Magistral see screeshot:

Image
<!-- gh-comment-id:3877977501 --> @adhusch commented on GitHub (Feb 10, 2026): > Testing wanted with dev branch here! Tested using [git-3567054-slim] (dev-slim). I see a model dependent behaviour. Works for GPT-OSS, for Mistral Magistral see screeshot: <img width="1506" height="656" alt="Image" src="https://github.com/user-attachments/assets/343d34a6-1040-4ca3-ad4c-9218483cbce5" />
Author
Owner

@adhusch commented on GitHub (Feb 17, 2026):

Issue still exists for Magistral models in 0.8.2. @tjbck could we re-open please? Let me know when i could help with testing something more specific.

<!-- gh-comment-id:3914976030 --> @adhusch commented on GitHub (Feb 17, 2026): Issue still exists for Magistral models in 0.8.2. @tjbck could we re-open please? Let me know when i could help with testing something more specific.
Author
Owner

@motosir commented on GitHub (Mar 3, 2026):

Using latest version of Open WebUI (fresh install today), I have seen the same issue with glm 4.7 Flash
Image

<!-- gh-comment-id:3993209908 --> @motosir commented on GitHub (Mar 3, 2026): Using latest version of Open WebUI (fresh install today), I have seen the same issue with glm 4.7 Flash <img width="363" height="846" alt="Image" src="https://github.com/user-attachments/assets/330a4449-befd-4b67-92b6-2037675d0bb5" />
Author
Owner

@adhusch commented on GitHub (Mar 4, 2026):

@EntropyYue as you did original PR wich lead to fix for GPT OSS: any hint on this model specific behaviour? Maybe because of different reasoning formats? Thank you.

<!-- gh-comment-id:3996056692 --> @adhusch commented on GitHub (Mar 4, 2026): @EntropyYue as you did original PR wich lead to fix for GPT OSS: any hint on this model specific behaviour? Maybe because of different reasoning formats? Thank you.
Author
Owner

@adhusch commented on GitHub (Mar 5, 2026):

@Classic298 Hello, could we reopen this please?

<!-- gh-comment-id:4004179675 --> @adhusch commented on GitHub (Mar 5, 2026): @Classic298 Hello, could we reopen this please?
Author
Owner

@Classic298 commented on GitHub (Mar 5, 2026):

@adhusch no, but feel free to open a new issue with reproduction steps. If there is any way to fully reproduce it, then we will be able to actually fix it :)

<!-- gh-comment-id:4004248574 --> @Classic298 commented on GitHub (Mar 5, 2026): @adhusch no, but feel free to open a new issue with reproduction steps. If there is any way to fully reproduce it, then we will be able to actually fix it :)
Author
Owner

@adhusch commented on GitHub (Mar 5, 2026):

@Classic298 thx, #22267

<!-- gh-comment-id:4005863966 --> @adhusch commented on GitHub (Mar 5, 2026): @Classic298 thx, #22267
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#34820