issue: Markdown Mode Breaks When Returning Code Blocks with Language Specifiers #4485

Closed
opened 2025-11-11 15:55:13 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @CH-chuan on GitHub (Mar 19, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.5.20

Ollama Version (if applicable)

No response

Operating System

Windows 10

Browser (if applicable)

Chrome

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 listed steps to reproduce the bug in detail.

Expected Behavior

When returning source code in markdown mode, it should return complete, rather than break in the middle when facing language specifiers.

Actual Behavior

When requesting modifications to a markdown file and asking for the source code to be returned, the returned markdown file can break when it contains code blocks with language specifiers like:
```bash
your content
```
This issue causes the markdown mode to fail in rendering correctly, by breaking the markdown mode.

Steps to Reproduce

Simply ask the model to return a markdown source containing code blocks with language specifiers would reproduce it.

Logs & Screenshots

Image

Additional Information

No response

Originally created by @CH-chuan on GitHub (Mar 19, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.5.20 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 10 ### Browser (if applicable) Chrome ### 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 listed steps to reproduce the bug in detail. ### Expected Behavior When returning source code in markdown mode, it should return complete, rather than break in the middle when facing language specifiers. ### Actual Behavior When requesting modifications to a markdown file and asking for the source code to be returned, the returned markdown file can break when it contains code blocks with language specifiers like: \`\`\`bash your content \`\`\` This issue causes the markdown mode to fail in rendering correctly, by breaking the markdown mode. ### Steps to Reproduce Simply ask the model to return a markdown source containing code blocks with language specifiers would reproduce it. ### Logs & Screenshots ![Image](https://github.com/user-attachments/assets/40434058-a494-43d9-b54a-7b7e071e80f9) ### Additional Information _No response_
GiteaMirror added the bug label 2025-11-11 15:55:13 -06:00
Author
Owner

@bannert1337 commented on GitHub (Mar 19, 2025):

Could you please post the full raw output? It looks like the Markdown code block was started further up.

So the next Markdown code block with "```python" is not rendered in another code block, as it is interpreted as raw text.

@bannert1337 commented on GitHub (Mar 19, 2025): Could you please post the full raw output? It looks like the Markdown code block was started further up. So the next Markdown code block with "```python" is not rendered in another code block, as it is interpreted as raw text.
Author
Owner

@tjbck commented on GitHub (Mar 19, 2025):

You'll observe the same behaviour from ChatGPT. This should be considered as a model issue, however would be happy to accept PRs.

@tjbck commented on GitHub (Mar 19, 2025): You'll observe the same behaviour from ChatGPT. This should be considered as a model issue, however would be happy to accept PRs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#4485