Skip to content

Instantly share code, notes, and snippets.

@catwell
Created July 24, 2026 12:38
Show Gist options
  • Select an option

  • Save catwell/192d22990234a9df52ebe7792210fc9f to your computer and use it in GitHub Desktop.

Select an option

Save catwell/192d22990234a9df52ebe7792210fc9f to your computer and use it in GitHub Desktop.
%YAML 1.2
---
# Markdown, plus ```nu / ```nushell fenced-code highlighting.
#
# The stock Markdown syntax embeds a hardcoded list of languages and has no
# entry for Nushell. This extends it and prepends a `nu` rule to the
# `fenced-syntaxes` dispatch, so nu fences embed the Nushell grammar and
# everything else behaves exactly like stock Markdown.
#
# Requires the "Nushell" package (provides scope source.shell.nu).
#
# One-time activation: open any .md file, then
# View -> Syntax -> Open all with current extension as... -> Markdown (Nushell)
name: Markdown (Nushell)
scope: text.html.markdown
version: 2
extends: Packages/Markdown/Markdown.sublime-syntax
file_extensions:
- md
- mdown
- mdwn
- markdown
contexts:
fenced-syntaxes:
- meta_prepend: true
- include: fenced-nushell
fenced-nushell:
- match: |-
(?x)
{{fenced_code_block_start}}
(?i:\s*(nu|nushell))
{{fenced_code_block_trailing_infostring_characters}}
captures:
0: meta.code-fence.definition.begin.markdown-gfm
2: punctuation.definition.raw.code-fence.begin.markdown
5: constant.other.language-name.markdown
6: comment.line.infostring.markdown
7: meta.fold.code-fence.begin.markdown
embed: scope:source.shell.nu
embed_scope: meta.code-fence.body.markdown-gfm markup.raw.code-fence.nu.markdown-gfm source.shell.nu
escape: '{{fenced_code_block_escape}}'
escape_captures:
0: meta.code-fence.definition.end.markdown-gfm
1: punctuation.definition.raw.code-fence.end.markdown
2: meta.fold.code-fence.end.markdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment