huggingface / chat-ui

Open source codebase powering the HuggingChat app

Home Page:https://huggingface.co/chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown files being converted to HTML during spellcheck in chat UI

sujaudd1n opened this issue · comments

When spellchecking Markdown files within the chat UI for the purpose of fixing grammar, the content is automatically converted to HTML (rendered as HTML). This behavior is not intended and interferes with the ability to view files as intended.

Steps to reproduce

  1. Open the chat UI.
  2. Paste or enter a Markdown file into the chat input.
  3. Attempt to spellcheck the Markdown content.
  4. Observe that the Markdown content is immediately converted to HTML during the spellcheck process. If there is an image link, it is displayed.

Expected behavior

Markdown content should be preserved within the chat UI during spellchecking and not be converted to HTML.

Still, the output can be copied as markdown from the copy to clipboard button below but it includes additional
texts as well.

Hi! We render markdown by default because it makes longer texts quite nicer with bold, italics, bullet points etc. And it lets you even do image generation, so I don't think we'll be changing this soon.

But the copy to clipboard button should be working. When you say it adds "additional texts" could you share an example of what you mean ?

Hi, I understand that rendering markdown can enhance the readability of longer texts with formatting options like bold, italics, and bullet points. However, when the desired output is markdown itself, it would be more convenient if it were presented as code. Additionally, I've noticed that the output sometimes renders raw markdown as code, but other times it renders the output as HTML. This inconsistency might potentially be addressed with prompt engineering by user.

By "additional texts," I mean any text that appears before or after the actual answer. For example, when requesting grammar checking, there might be text like "Hello, here is the text with the grammar fixed:" preceding the actual edited text.

I think you could get around this by prompting the model to wrap the resulting markdown in triple backticks so it creates a code block and puts the output in there. Or prompt the model so that it doesn't generate text before/after the spellchecked block.

Overall this feels like a prompting question, I don't think we plan to support a raw markdown mode for now, especially since you can copy the raw markdown already using the copy button. 👀

Wrapping the resulting markdown in triple backticks works. Thanks.