Originally created by @frettig-radiox on GitHub (Aug 29, 2024).
Bug Report
When including a nested code block in Markdown, the rendered output did not display correctly in the UI. If the nested code block is not indented by the llm, the rendering of the code block fails.
Environment
Open WebUI Version: v0.3.16
Confirmation:
Expected Behavior:
The nested code block should be rendered correctly even if not indented.
Actual Behavior:
The nested code block gets displayed without proper formatting, which causes confusion in how the nested code appears on-screen.
Reproduction Details
Steps to Reproduce:
Create a Markdown response with a code block containing another code block inside of it. (e.g. prompt "create markdown code with a nested python code block")
Do not indent the nested code block initially.
Check the Markdown code block in the chat
Observe that the nested code block does not render correctly.
Logs and Screenshots
Screenshots:
Before indenting the nested code block:
After indenting the nested code block:
Reference Markdown Example:
Here's an example of the Markdown that caused the issue if it appears in the llm response:
```markdown
# Example of a nested Python code block
Here's a simple example of a Python function:
```python
def greet(name):
return f"Hello, {name}!"
# Usage example
print(greet("World"))
```
The above code defines a function that greets the user by name.
```
if the python block is indented, the code
block is rendered correctly:
```markdown
# Example of a nested Python code block
Here's a simple example of a Python function:
```python
def greet(name):
return f"Hello, {name}!"
# Usage example
print(greet("World"))
```
The above code defines a function that greets the user by name.
```
Originally created by @frettig-radiox on GitHub (Aug 29, 2024).
# Bug Report
When including a nested code block in Markdown, the rendered output did not display correctly in the UI. If the nested code block is not indented by the llm, the rendering of the code block fails.
## Environment
- **Open WebUI Version:** v0.3.16
**Confirmation:**
## Expected Behavior:
The nested code block should be rendered correctly even if not indented.
## Actual Behavior:
The nested code block gets displayed without proper formatting, which causes confusion in how the nested code appears on-screen.
## Reproduction Details
**Steps to Reproduce:**
1. Create a Markdown response with a code block containing another code block inside of it. (e.g. prompt "create markdown code with a nested python code block")
3. Do **not** indent the nested code block initially.
4. Check the Markdown code block in the chat
5. Observe that the nested code block does not render correctly.
## Logs and Screenshots
**Screenshots:**
*Before indenting the nested code block:*
<img width="526" alt="screenshot_before" src="https://github.com/user-attachments/assets/3a89eca4-3213-4e9e-8fb2-c5ea53ee9c71">
*After indenting the nested code block:*
<img width="531" alt="screenshot_after" src="https://github.com/user-attachments/assets/1f8cb968-d1cb-474a-a2d7-d7213d745562">
**Reference Markdown Example:**
Here's an example of the Markdown that caused the issue if it appears in the llm response:
~~~
```markdown
# Example of a nested Python code block
Here's a simple example of a Python function:
```python
def greet(name):
return f"Hello, {name}!"
# Usage example
print(greet("World"))
```
The above code defines a function that greets the user by name.
```
~~~
if the python block is indented, the code
block is rendered correctly:
~~~
```markdown
# Example of a nested Python code block
Here's a simple example of a Python function:
```python
def greet(name):
return f"Hello, {name}!"
# Usage example
print(greet("World"))
```
The above code defines a function that greets the user by name.
```
~~~
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @frettig-radiox on GitHub (Aug 29, 2024).
Bug Report
When including a nested code block in Markdown, the rendered output did not display correctly in the UI. If the nested code block is not indented by the llm, the rendering of the code block fails.
Environment
Confirmation:
Expected Behavior:
The nested code block should be rendered correctly even if not indented.
Actual Behavior:
The nested code block gets displayed without proper formatting, which causes confusion in how the nested code appears on-screen.
Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Screenshots:
Before indenting the nested code block:
After indenting the nested code block:

Reference Markdown Example:
Here's an example of the Markdown that caused the issue if it appears in the llm response:
if the python block is indented, the code
block is rendered correctly: