Skip to content

Incorrect comments for YAML multiline strings #1095

Description

@arcruz0

Bug description

Hello, and apologies if this should be reported elsewhere.

When commenting out a .qmd line that's part of a YAML multiline string, I get # in Positron (which leads to an error when rendering). In RStudio, I get <!-- (which renders fine).

Many thanks in advance!

Steps to reproduce

Open the following .qmd in Positron, and then do "Add line comment" on either \setlength... or \usepackage....

---
title: "Hello"
format: 
  pdf:
    include-in-header: 
      text: |
        \setlength\parindent{.2in}
        \usepackage{indentfirst}
---

## Hello

Hello

Hello

The line gets prefixed by #. Finally, render and get and error:

ERROR: compilation failed- error You can't use `macro parameter character #' in vertical mode.

Expected behavior

In RStudio, the lines get commented out in HTML style, e.g.: <!-- \usepackage{indentfirst} -->. This renders without errors.

Your environment

Positron Version: 2026.08.1 build 2
Code - OSS Version: 1.124.0
Commit: 48dc4cee686939f35fe4a714d34375f67fd62082
Date: 2026-08-09T13:35:16-06:00
Electron: 42.2.0
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Linux x64 7.1.8-200.fc44.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions