From a6fc8fa2dc1f2ed164355f180a03e303596b1d13 Mon Sep 17 00:00:00 2001 From: Kevin Stenerson Date: Sun, 1 Feb 2026 00:32:05 -0500 Subject: [PATCH 1/2] Add markdown injection grammar for HCL fenced code blocks Enable syntax highlighting for HCL code blocks in Markdown files (```hcl) via TextMate grammar injection. The injection grammar delegates to source.hcl for actual highlighting. Consumers (e.g. vscode-hcl) can register this grammar with: { "scopeName": "markdown.hcl.codeblock", "path": "./syntaxes/hcl.markdown.tmLanguage.json", "injectTo": ["text.html.markdown"], "embeddedLanguages": { "meta.embedded.block.hcl": "hcl" } } Closes hashicorp/vscode-hcl#163 Co-Authored-By: Claude Opus 4.5 --- syntaxes/hcl.markdown.tmLanguage.json | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 syntaxes/hcl.markdown.tmLanguage.json diff --git a/syntaxes/hcl.markdown.tmLanguage.json b/syntaxes/hcl.markdown.tmLanguage.json new file mode 100644 index 0000000..c911b8f --- /dev/null +++ b/syntaxes/hcl.markdown.tmLanguage.json @@ -0,0 +1,45 @@ +{ + "fileTypes": [], + "injectionSelector": "L:text.html.markdown", + "patterns": [ + { + "include": "#hcl-code-block" + } + ], + "repository": { + "hcl-code-block": { + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(hcl)((\\s+|:|,|\\{|\\?)[^`]*)?$)", + "beginCaptures": { + "3": { + "name": "punctuation.definition.markdown" + }, + "4": { + "name": "fenced_code.block.language.markdown" + }, + "5": { + "name": "fenced_code.block.language.attributes.markdown" + } + }, + "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", + "endCaptures": { + "3": { + "name": "punctuation.definition.markdown" + } + }, + "name": "markup.fenced_code.block.markdown", + "patterns": [ + { + "begin": "(^|\\G)(\\s*)(.*)", + "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", + "contentName": "meta.embedded.block.hcl", + "patterns": [ + { + "include": "source.hcl" + } + ] + } + ] + } + }, + "scopeName": "markdown.hcl.codeblock" +} From 9fd9d0d55f492b47fafa94cae0ab9e78666da96e Mon Sep 17 00:00:00 2001 From: "hashicorp-copywrite[bot]" <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 05:35:47 +0000 Subject: [PATCH 2/2] [COMPLIANCE] Add required copyright headers Signed-off-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> --- LICENSE | 2 +- META.d/_summary.yml | 2 +- META.d/data.yml | 2 +- cmd/builder/build.go | 2 +- cmd/builder/main.go | 2 +- cmd/builder/textmate.go | 2 +- src/_main.yml | 2 +- src/hcl.yml | 2 +- src/terraform.yml | 2 +- tools/graph.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index e8e3bcb..4a8b886 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright IBM Corp. 2020, 2025 +Copyright IBM Corp. 2026 Mozilla Public License Version 2.0 ================================== diff --git a/META.d/_summary.yml b/META.d/_summary.yml index e395593..d66b695 100644 --- a/META.d/_summary.yml +++ b/META.d/_summary.yml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2020, 2025 +# Copyright IBM Corp. 2026 # SPDX-License-Identifier: MPL-2.0 schema: 1.1 diff --git a/META.d/data.yml b/META.d/data.yml index 2cad174..d8afd9f 100644 --- a/META.d/data.yml +++ b/META.d/data.yml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2020, 2025 +# Copyright IBM Corp. 2026 # SPDX-License-Identifier: MPL-2.0 data_summary: diff --git a/cmd/builder/build.go b/cmd/builder/build.go index 41446bc..0131059 100644 --- a/cmd/builder/build.go +++ b/cmd/builder/build.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2020, 2025 +// Copyright IBM Corp. 2026 // SPDX-License-Identifier: MPL-2.0 package main diff --git a/cmd/builder/main.go b/cmd/builder/main.go index f247fd1..e4be3ab 100644 --- a/cmd/builder/main.go +++ b/cmd/builder/main.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2020, 2025 +// Copyright IBM Corp. 2026 // SPDX-License-Identifier: MPL-2.0 package main diff --git a/cmd/builder/textmate.go b/cmd/builder/textmate.go index 70b43c5..da276f7 100644 --- a/cmd/builder/textmate.go +++ b/cmd/builder/textmate.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2020, 2025 +// Copyright IBM Corp. 2026 // SPDX-License-Identifier: MPL-2.0 package main diff --git a/src/_main.yml b/src/_main.yml index 3b06358..403eec8 100644 --- a/src/_main.yml +++ b/src/_main.yml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2020, 2025 +# Copyright IBM Corp. 2026 # SPDX-License-Identifier: MPL-2.0 patterns: diff --git a/src/hcl.yml b/src/hcl.yml index 6eca206..10aeb1e 100644 --- a/src/hcl.yml +++ b/src/hcl.yml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2020, 2025 +# Copyright IBM Corp. 2026 # SPDX-License-Identifier: MPL-2.0 scopeName: source.hcl diff --git a/src/terraform.yml b/src/terraform.yml index 052b10e..0a4502f 100644 --- a/src/terraform.yml +++ b/src/terraform.yml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2020, 2025 +# Copyright IBM Corp. 2026 # SPDX-License-Identifier: MPL-2.0 scopeName: source.hcl.terraform diff --git a/tools/graph.ts b/tools/graph.ts index 842c0a4..533d9eb 100644 --- a/tools/graph.ts +++ b/tools/graph.ts @@ -1,5 +1,5 @@ /** - * Copyright IBM Corp. 2020, 2025 + * Copyright IBM Corp. 2026 * SPDX-License-Identifier: MPL-2.0 */