Skip to content

Fenced code blocks should support any number of backticks > 3 in textmate grammar #6189

Closed

Description

@FMorschel

Context
Split from dart-lang/dartdoc#4284. {@example} can currently emit a fence that is too short when the example itself contains a fence. Once dartdoc uses longer fences, and because users can already hand-write them, doc comments with nested fences will be more common.

Reproduction

/// Install it:
///
/// ````md
/// ```console
/// dart pub add foo
/// ```
/// ````
class Foo {}

Dart-Code tracking for dart-lang/dart-syntax-highlight#97

Actual

On the left, we have pkg:markdown + DAS, and on the right, only TextMate.

Image

See that after the ```console line, we open the initial code block, but we should already have one.

Environment

Workspace Environment
Dart Code extension: 3.143.20260901

App: Visual Studio Code
App Host: desktop
Version: linux 1.138.0

Workspace type: Dart (LSP)
Workspace name: bug

Dart (3.14.0-edge.9a097b7923e08d0ebc26b3f5339aa80ad53e88bf): /home/fmorschel/dart
Flutter (3.47.4): /home/fmorschel/.puro/envs/stable/flutter (No device)

Output from 'dart info'

/home/fmorschel/dart/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.14.0-edge.9a097b7923e08d0ebc26b3f5339aa80ad53e88bf (main) (Tue Sep 15 19:19:22 2026 -0700) on "linux_x64"
  • on linux / Linux 7.1.5-76070105-generic #202607241434178795502324.04~38a419f SMP PREEMPT_DYNAMIC Fri A
  • locale is en_GB.UTF-8

Project info

  • sdk constraint: '^3.13.0-edge'
  • dependencies: analyzer, bloc, collection, equatable, json_annotation, meta
  • dev_dependencies: build_runner, json_serializable, lints, test, test_reflective_loader, very_good_analysis
  • elided dependencies: 1

Process info

Memory CPU Elapsed time Command line
19 MB 0.0% 15:40:06 dart development-service --vm-service-uri=http:/ --bind-address=127.0.0.1 --bind-port=0 --serve-devtools --devtools-server-address=http:/ --app-name=Kind: Flutter - Device: Linux - Package: minecraft_skin
15 MB 0.0% 09:34:25 dart devtools --machine --allow-embedding --dtd-uri ws:/HSE_Zse9RW0=
501 MB 0.6% 09:34:26 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.143.20260901
242 MB 0.0% 06:29:17 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.143.20260901 --instrumentation-log-file=/InstrumentationLog.txt
20 MB 0.0% 09:34:26 dart tooling-daemon --machine
26 MB 0.0% 06:29:17 dart tooling-daemon --machine
62 MB 0.0% 09:34:26 flutter_tools.snapshot daemon

Activity

  1. changed the title [-]Verify hover/completion docs render fenced code blocks with 4+ backticks (nested fences)[/-] [+]Verify render fenced code blocks with 4+ backticks (nested fences)[/+] on Sep 20, 2026
  2. added this to the v3.144.0 milestone on Sep 23, 2026
  3. added
    in editorRelates to code editing or language features
    on Sep 23, 2026
  4. changed the title [-]Verify render fenced code blocks with 4+ backticks (nested fences)[/-] [+]Fenced code blocks should support any number of backticks > 3[/+] on Sep 23, 2026
  5. DanTup commented on Sep 23, 2026

    @DanTup
    Member

    We might also need to verify if the analyzer is handling these correctly for the semantic tokens.

  6. self-assigned this
    on Sep 23, 2026
  7. FMorschel commented on Sep 23, 2026

    @FMorschel
    ContributorAuthor

    From the screenshot above on the left, it seems like it, doesn't it? What specifically do you mean to check?

  8. changed the title [-]Fenced code blocks should support any number of backticks > 3[/-] [+]Fenced code blocks should support any number of backticks > 3 in textmate grammar[/+] on Sep 24, 2026
  9. DanTup commented on Sep 24, 2026

    @DanTup
    Member

    Yeah, I think you're right - I just did some testing and the semantic tokens seem to come through fine.

    I've a PR at #6197 to fix the grammar:

    Before (the orange areas should all be a single code block):

    Screenshot 2026-09-24 110319

    After:

    Screenshot 2026-09-24 110404

    And related PRs for upstream changes are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in editorRelates to code editing or language featuresis bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions