Feature Request: Configurable HTML Tag Rendering in Markdown Output #8010

Closed
opened 2026-02-21 18:23:28 -05:00 by yindo · 1 comment
Owner

Originally created by @xuzijie1995 on GitHub (Feb 6, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

In my use case, I need to ensure that the output from the prompt includes specific HTML tags to format the data correctly. However, with the current behavior in Dify 0.15.2, these tags are being rendered as HTML elements, which disrupts the intended display. This makes it difficult to present the data in a structured manner, especially when the output needs to be consumed by other systems or displayed in a specific format. Having the option to toggle HTML rendering would greatly enhance the flexibility and usability of the platform for my needs.

In the Dify platform, I have a specific use case where I need to include certain HTML tags within the prompt text to ensure that the output contains structured data. For example, the response includes HTML tags to format the data clearly:

1. **Product A**
   - value: 204.8700

2. **Product B**
   - value: 204.8700

3. **Product C**
   - value: 204.8700

<Noah type="Products" ids="id1,id2,id3" />

In version 0.7.0 of Dify, these HTML tags were rendered as plain text in the debug mode web page, which was the desired behavior. However, in version 0.15.2, the HTML tags are now being rendered as actual HTML elements, resulting in an empty display on the page. I noticed that in /web/app/components/base/markdown.tsx, the ReactMarkdown component has a RehypeRaw as any property, which causes the HTML tags to be parsed and rendered.

Feature Request:
I would like to request a configurable option that allows users to choose whether HTML tags should be rendered as HTML elements or displayed as plain text. This would provide flexibility for different use cases, especially when structured data needs to be displayed in a specific format.

Proposed Solution:
Add a configuration option in the Dify settings that allows users to choose between:

Rendering HTML tags as HTML elements (current behavior).

Image

Displaying HTML tags as plain text (previous behavior in 0.7.0).

Image

This could be implemented as a toggle in the settings or as a parameter in the ReactMarkdown component.

Thank you for considering this feature request!

2. Additional context or comments

web/app/components/base/markdown.tsx

Image

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @xuzijie1995 on GitHub (Feb 6, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. In my use case, I need to ensure that the output from the prompt includes specific HTML tags to format the data correctly. However, with the current behavior in Dify 0.15.2, these tags are being rendered as HTML elements, which disrupts the intended display. This makes it difficult to present the data in a structured manner, especially when the output needs to be consumed by other systems or displayed in a specific format. Having the option to toggle HTML rendering would greatly enhance the flexibility and usability of the platform for my needs. In the Dify platform, I have a specific use case where I need to include certain HTML tags within the prompt text to ensure that the output contains structured data. For example, the response includes HTML tags to format the data clearly: ``` 1. **Product A** - value: 204.8700 2. **Product B** - value: 204.8700 3. **Product C** - value: 204.8700 <Noah type="Products" ids="id1,id2,id3" /> ``` In version 0.7.0 of Dify, these HTML tags were rendered as plain text in the debug mode web page, which was the desired behavior. However, in version 0.15.2, the HTML tags are now being rendered as actual HTML elements, resulting in an empty display on the page. I noticed that in /web/app/components/base/markdown.tsx, the ReactMarkdown component has a RehypeRaw as any property, which causes the HTML tags to be parsed and rendered. Feature Request: I would like to request a configurable option that allows users to choose whether HTML tags should be rendered as HTML elements or displayed as plain text. This would provide flexibility for different use cases, especially when structured data needs to be displayed in a specific format. Proposed Solution: Add a configuration option in the Dify settings that allows users to choose between: Rendering HTML tags as HTML elements (current behavior). ![Image](https://github.com/user-attachments/assets/70361470-ca57-4ad7-93b8-edcb2006f974) Displaying HTML tags as plain text (previous behavior in 0.7.0). ![Image](https://github.com/user-attachments/assets/45ec6623-3780-44f2-b168-09d6a1ba7ee0) This could be implemented as a toggle in the settings or as a parameter in the ReactMarkdown component. Thank you for considering this feature request! ### 2. Additional context or comments web/app/components/base/markdown.tsx <img width="581" alt="Image" src="https://github.com/user-attachments/assets/8fd65d71-d78e-4e59-92fb-33e4774f2a22" /> ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:23:28 -05:00
yindo closed this issue 2026-02-21 18:23:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 10, 2025):

Hi, @xuzijie1995. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You requested a feature enhancement for configurable HTML tag rendering in Markdown output.
  • The current behavior in version 0.15.2 disrupts your data presentation.
  • No comments or developments have been made on this issue yet.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Mar 10, 2025): Hi, @xuzijie1995. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You requested a feature enhancement for configurable HTML tag rendering in Markdown output. - The current behavior in version 0.15.2 disrupts your data presentation. - No comments or developments have been made on this issue yet. **Next Steps:** - Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here. - If there is no further activity, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8010