Skip to content

dos/bat/cmd Disk switch "D:" destroys highlight #4134

Open
@krilbe

Description

@krilbe

Describe the issue
If the code snippet contains a disk switch line, e.g. "D:", the subsequent highlight becomes all red. It seems to be connected with the colon.
bild

Which language seems to have the issue?
"dos"

Seems to be the same with tags "bat" and "cmd".

Seems to work the same with and without space between ``` and the language tag.

Here in GitHub it seems to work correctly with tag "bat", see below under "Expected behavior".

Are you using highlight or highlightAuto?
Not sure. I was using this in an Azure DevOps Wiki page.

Sample Code to Reproduce

triplebacktick dos
rem This highlight works.
copy file.txt other.txt 
rem After next line it becomes all red.
D:
cd "D:\Folder"
md Tmp
del Tmp\*.* /q
triplebacktick

Expected behavior
The highlight should work normally even after a disk switch command, as here in GitHub:

rem This highlight works.
copy file.txt other.txt 
rem After next line it becomes all red.
D:
cd "D:\Folder"
md Tmp
del Tmp\*.* /q

Additional context
Found and tested in an Azure DevOps Wiki page, which seems to point to this repo in the docs: https://learn.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#code-highlighting

Activity

linked a pull request that will close this issue on Oct 11, 2024
the-dg04

the-dg04 commented on Oct 11, 2024

@the-dg04

Hey, ive found a potential solution to your problem and linked a PR for it.

After fix:
image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @krilbe@the-dg04

      Issue actions

        dos/bat/cmd Disk switch "D:" destroys highlight · Issue #4134 · highlightjs/highlight.js