Skip to content

Add batch script support and fix minor issues#4380

Open
megyerikenez wants to merge 5 commits into
highlightjs:mainfrom
megyerikenez:main
Open

Add batch script support and fix minor issues#4380
megyerikenez wants to merge 5 commits into
highlightjs:mainfrom
megyerikenez:main

Conversation

@megyerikenez

@megyerikenez megyerikenez commented Mar 16, 2026

Copy link
Copy Markdown

Changes

This pull request introduces syntax highlighting support for Windows batch files to the project. The main addition is a new language definition for batch scripts, along with relevant tests to ensure proper detection and markup of batch syntax elements.

Batch language support:

  • Added a new language definition file src/languages/batch.js for Windows batch files, supporting .bat, .batch, and .cmd extensions, with highlighting for built-in commands, operators, comments, strings, variables, and numbers.

Testing and validation:

  • Added detection test file test/detect/batch/default.txt to verify that batch files are correctly identified by the language detector.
  • Added markup test input test/markup/batch/default.txt and expected output test/markup/batch/default.expect.txt to validate syntax highlighting for various batch commands, comments, variables, and control structures. [1] [2]

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@joshgoebel

Copy link
Copy Markdown
Member

Don't we already support batch files? I just added an alias for batch to one of our grammars...

@joshgoebel

Copy link
Copy Markdown
Member

I believe it may be time to rename our dos grammer to dos_batch... is this a replacement/better grammar for DOS than dos already is?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants