Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

Code highlighting in messages

Open rk1a opened this issue 2 years ago • 4 comments

For better readability it would be helpful to have highlighting for code snippets appearing in messages like these: image

rk1a avatar Feb 05 '23 12:02 rk1a

I can take this, but it would be great if someone could point me to the component where the replies are displayed.

EpicLiem avatar Feb 06 '23 20:02 EpicLiem

The messages get rendered in website/src/components/Messages/MessageTableEntry.tsx If you're able to add this without having to change the data or other parts that would be super helpful

fozziethebeat avatar Feb 06 '23 23:02 fozziethebeat

After considering it and making some mock implementations, I am uncertain if it's feasible to extract code from a message without proper syntax marking, such as the triple backticks (```) in Markdown. Syntax highlighting will not be effective if the message does not have the proper formatting. As a result, I believe it is necessary to either modify the data or perform post-processing to achieve this goal.

I'm happy to continue working on it, but it would involve modifying the model or running the output through another one. I don't think it's worth attempting for slightly better readability, but I could be completely wrong with my analysis or about how important syntax highlighting is.

EpicLiem avatar Feb 07 '23 20:02 EpicLiem

Implementing markdown (see #837) will include code syntax highlighting for properly formatted messages and solve this issue.

It will encourage everyone to use proper formatting for their responses, so improperly formatted responses will get downvoted since they will be easy to spot.

mashdragon avatar Feb 08 '23 01:02 mashdragon