Skip to content

Bug Report: HTML Tags Appearing in GitLab Duo Chat Code Responses

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When GitLab Duo Chat generates code responses, the output frequently contains unescaped HTML tags for syntax highlighting (e.g., ) instead of properly formatted code. This makes code examples difficult to read and impossible to copy-paste without manual cleanup.

Steps to Reproduce

Ask GitLab Duo Chat to generate code or explain code concepts Request code in any programming language Observe the response contains HTML syntax highlighting tags mixed with the code

Example

When asking for a simple Python function to calculate Fibonacci numbers, the response included:

<span class="hljs-keyword">def</span> <span class="hljs-title function_">fibonacci</span>(<span class="hljs-params">n</span>):
    <span class="hljs-keyword">if</span> n <= <span class="hljs-number">1</span>:
        <span class="hljs-keyword">return</span> n
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> fibonacci(n-<span class="hljs-number">1</span>) + fibonacci(n-<span class="hljs-number">2</span>)

Instead of clean code:

def fibonacci(n):
    if n <= 1:
        return n
    else:
        return fibonacci(n-1) + fibonacci(n-2)

Similarly, when requesting JavaScript code for an API call:

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">fetchData</span>(<span class="hljs-params">url</span>) {
  <span class="hljs-keyword">try</span> {
    <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(url);
    <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> response.<span class="hljs-title function_">json</span>();
    <span class="hljs-keyword">return</span> data;
  } <span class="hljs-keyword">catch</span> (error) {
    <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">&#x27;Error:&#x27;</span>, error);
  }
}

Expected Behavior

Code blocks should contain clean, properly formatted code without HTML tags. Syntax highlighting should be applied by the client-side renderer, not embedded in the response text.

Actual Behavior

Code blocks contain HTML syntax highlighting tags that make the code unreadable and unusable without manual cleanup. HTML entities like ' (single quote) and < (less than) also appear in the code.

Environment VScode:

Version: 1.100.2 (Universal)
Commit: 848b80aeb52026648a8ff9f7c45a9b0a80641e2e
Date: 2025-05-14T21:47:40.416Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.4.0

GitLab Duo Chat: Latest version as of May 28, 2025

##Impact This issue significantly reduces the usability of GitLab Duo Chat for code-related tasks:

  • Code cannot be copied and used without manual cleanup
  • Examples are difficult to read with HTML tags interspersed
  • Users need to manually decode HTML entities

Possible Causes

The issue appears to be in how syntax highlighting is applied to code blocks. Instead of applying highlighting as CSS styling on the client side, the highlighting HTML is being embedded directly in the response text.

Edited by 🤖 GitLab Bot 🤖