Skip to content

fix(ui): limit Markdown rendering on RichInput#6061

Merged
jocelynlin-wd merged 2 commits intomainfrom
fix/limit-rich-input-markdown-use
Mar 26, 2026
Merged

fix(ui): limit Markdown rendering on RichInput#6061
jocelynlin-wd merged 2 commits intomainfrom
fix/limit-rich-input-markdown-use

Conversation

@jocelynlin-wd
Copy link
Copy Markdown
Contributor

@jocelynlin-wd jocelynlin-wd commented Mar 26, 2026

  • Added a new useMarkdown prop to RichInput for toggling between Markdown and HTML content.
  • Updated the extensions function to conditionally configure link support based on the useMarkdown prop.
  • Modified the content update logic to handle Markdown conversion when useMarkdown is enabled.
  • Adjusted initial content loading to respect the useMarkdown setting for proper content type detection.

Fix in http node

markdown-fix-http-with-variable.mov

Markdown support for input allowing multiple rows

markdown-support-when-enabled.mov

- Added a new `useMarkdown` prop to RichInput for toggling between Markdown and HTML content.
- Updated the `extensions` function to conditionally configure link support based on the `useMarkdown` prop.
- Modified the content update logic to handle Markdown conversion when `useMarkdown` is enabled.
- Adjusted initial content loading to respect the `useMarkdown` setting for proper content type detection.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the RichInput UI component by providing explicit control over Markdown rendering. The changes allow developers to toggle between Markdown and HTML content handling, ensuring that the input field behaves as expected based on the desired content type. This prevents unwanted Markdown interpretations when plain HTML is intended and vice-versa, improving the flexibility and reliability of the RichInput component.

Highlights

  • useMarkdown Prop: A new useMarkdown prop was added to the RichInput component, allowing explicit control over whether Markdown rendering is enabled or disabled.
  • Conditional Link Support: The extensions function was updated to conditionally disable link support within the StarterKit extension when useMarkdown is false, preventing unintended link rendering.
  • Content Update Logic: The onUpdate handler now conditionally converts content to Markdown using editor.getMarkdown() when useMarkdown is enabled, otherwise it defaults to editor.getHTML().
  • Initial Content Loading: The initial content loading logic in useEffect was modified to respect the useMarkdown setting, ensuring correct content type detection and rendering upon component initialization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

StarterKit.configure({
codeBlock: false
codeBlock: false,
...(!useMarkdown && { link: false })
Copy link
Copy Markdown
Contributor Author

@jocelynlin-wd jocelynlin-wd Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to disable link for non-markdown usage

  1. StarterKit v3.20.4 added Link extension (wasn't in v2):
    • starter-kit/dist/index.js: if (this.options.link !== false) { extensions.push(Link.configure(...)) }
  2. Link extension defaults to autolink: true with HTML attributes that wrap URLs:
    • extension-link/src/link.ts:234: autolink: true
    • extension-link/src/link.ts:238-239: target: '_blank', rel: 'noopener noreferrer nofollow'
  3. This transforms https://example.com into:
    • <a target="_blank" rel="noopener noreferrer nofollow" href="https://example.com">https://example.com</a>
  4. Server-side TurndownService then converts to markdown link https://example.com, which is an invalid URL.

The v2 → v3 StarterKit upgrade in PR #6021 silently introduced the Link extension with auto-linking enabled.

Without the change, url will include an a tag which will also lead to invalid url error
"url": "<p><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://github.com/FlowiseAI/Flowise/pull\">https://github.com/FlowiseAI/Flowise/pull</a>/<span class=\"variable\" data-type=\"mention\" data-id=\"$form.pr\" data-label=\"$form.pr\" data-mention-suggestion-char=\"{{\">{{ $form.pr }}</span> </p>",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note on html tag in the url field:

  • url field with variable:
    "url": "<p>https://github.com/FlowiseAI/Flowise/pull/<span class=\"variable\" data-type=\"mention\" data-id=\"question\" data-label=\"question\" data-mention-suggestion-char=\"{{\">{{ question }}</span> </p>",

  • url field without variable:
    "url": "<p>https://github.com/FlowiseAI/Flowise/pull/6053</p>",

only the <a> tag would cause problem. The server's resolveVariables handles span tag correctly:

  1. Detects HTML (<p> matches) → runs TurndownService
  2. TurndownService converts <p>https://.../<span>{{ question }}</span></p>https://.../{{ question }}
  3. Variable resolution replaces {{ question }}https://.../123
  4. new URL("https://.../123") → works

The <a> tag was the issue because TurndownService converts <a href="url">text</a> to [text](url) markdown link syntax, which is not a valid URL.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the RichInput component by introducing a useMarkdown flag, determined by inputParam?.rows. This flag conditionally enables or disables Markdown functionality within the rich text editor. When useMarkdown is true, the editor processes content as Markdown, including disabling the link extension when not in markdown mode, and attempts to retrieve Markdown content on update. Conversely, when useMarkdown is false, the editor operates in HTML mode, disabling the link extension and handling content as HTML. The initial content loading logic has also been updated to align with this new useMarkdown flag. There is no feedback to provide.

@jocelynlin-wd jocelynlin-wd requested a review from j-sanaa March 26, 2026 00:47
Copy link
Copy Markdown
Contributor

@yau-wd yau-wd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Result

agentflow-http-node agentflow-requests-get-tool chatflow-conversation-chain chatflow-conversational-retrieval-qa-chain-upsert chatflow-conversational-retrieval-qa-chain-prediction
Image Image Image Image Image

@jocelynlin-wd jocelynlin-wd merged commit 106f211 into main Mar 26, 2026
8 of 9 checks passed
@jocelynlin-wd jocelynlin-wd deleted the fix/limit-rich-input-markdown-use branch March 26, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants