Skip to content

Add kotlin to kLangCommentChars — numbered code annotations don't render for Kotlin blocks #14472

@barendgehrels

Description

@barendgehrels

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI (note below why I reverted)
  • formatted my issue following the Bug Reports guide

Bug description

Quarto's numbered code annotations (the circled-number badges linked to // <1>, // <2>, etc. with a numbered
list below) work for java blocks but not for kotlin blocks, even though both languages share // line comments.

The cause appears to be that Kotlin is missing in the kLangCommentChars map:

https://github.com/quarto-dev/quarto-cli/blob/main/src/core/lib/partition-cell-options.ts#L310-L358

JVM-family languages java, scala, and groovy are listed with "//", but kotlin is missing.

Adding kotlin: "//" to that object might be enough to fix it.

Steps to reproduce

Minimal reproduction scenario:

---
title: Annotation test
---

## Works (java)

```java
public class Hello {
    public static void main(String[] args) {
        System.out.println("hello"); // <1>
    }
}
```
1. Prints a greeting.

## Broken (kotlin)

```kotlin
fun main() {
    println("hello") // <1>
}
```
1. Prints a greeting.

Actual behavior

It does not add a circle, but instead keeps the numbered list.

Image

Expected behavior

It should add a circle in the code (like in Java) and below the code sample, with the explanation.

Workaround

I now annotate it with java - but it gives me the wrong syntax highlighting.

Your environment

Quarto 1.8.27
I had to downgrade because of quarto-dev/quarto#958

However, since the source code misses kotlin entirely in that mapping list, the issue will still be there.

Quarto check output

Quarto 1.8.27
[✓] Checking environment information...
      Quarto cache location: /Users/.../Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.27
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2026.03.02
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/.../Library/TinyTeX/bin/universal-darwin
      Version: 2026

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.14.4
      Path: /opt/homebrew/opt/python@3.14/bin/python3.14
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions