Skip to content
Commit 07fea1ce authored by Lukas Eipert's avatar Lukas Eipert
Browse files

feat(DuoChat): Add default markdown renderer for streaming messages

While we consume streaming messages, we render markdown on the fly in
the frontend. Once the message is finally rendered by the backend, we
will consume some rendered HTML.

One of the problems we are facing now, that if a streamed message
contains code blocks for example, the code blocks might note be closed
yet and comments might be rendered as headings:

~~~~md
```yaml
# this is not a headline
~~~~

will be rendered as:

~~~~html
<p>```yaml</p>
<h1>this is not a headline</h1>
~~~~

Luckily the CommonMark spec, which `marked` follows, considers the end
of a markdown document as closing the open code block. So we do not need
to worry about: gitlab#433338

In order to achieve consistent behavior between our current usages of
Duo Chat, we add a default markdown renderer to Duo Chat. This will help
us solve
gitlab-vscode-extension#1227 more
easily while also ensuring that we can quickly fix rendering issues like
the aforementioned codeblock issue in a single place.

In order to ensure that the markdown render doesn't "pollute" other
components, we lint against imports and add a message that it is only
supposed to be used in Duo Chat.
parent 68caa17e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment