From 23468acf874c0413ba7e7993a0b194d87ee2b979 Mon Sep 17 00:00:00 2001 From: Steven Stallion Date: Fri, 28 Mar 2025 08:01:00 -0500 Subject: [PATCH] Add command-line as an alternative to highlighted languages (#15) --- CHANGELOG.md | 4 ++++ README.md | 1 + src/main.ts | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81579f7..eade03c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Added `command-line` as an alternative to highlighted languages + ## [1.1.1] - 2025-03-20 ### Fixed diff --git a/README.md b/README.md index 948b5db..1801f7f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Command line code blocks are identified using one of the following languages: | Name | Highlight | Prompt Pattern | Default Prompt | Continuation | | -------------------- | ------------ | -------------- | -------------- | ------------ | +| `command-line` | N/A | Any below | `C:\>` | Any below | | `batch-command` | `batch` | `/\S*?>/` | `C:\>` | `^` | | `powershell-command` | `powershell` | `/\S*?>/` | `PS>` | `` ` `` | | `shell-command` | `shell` | `/\S*?[#$%]/` | `$` | `\` | diff --git a/src/main.ts b/src/main.ts index 5a349b4..48194bf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,6 +34,11 @@ const DEFAULT_SETTINGS: Partial = { highlight: false, normalize: false, languages: { + "command-line": { + defaultPrompt: "C:\\>", + promptPattern: "^\\S*?[#$%>]\\s*", + continuationPattern: "[\\\\`^]$", + }, "batch-command": { defaultPrompt: "C:\\>", promptPattern: "^\\S*?>\\s*",