Syntax highlighting inside heredoc
Hi, I was wondering if it were possible to have sh.lang
syntax highlight inside of HEREDOCs by looking for an extension in the heredoc boundary word, such as the below applying sh
, with the heredoc content using json
:
#!/bin/bash
hello_json=$(cat <<EOF.json
{
say: 'Hello world'
}
EOF.json
)
echo $var_json | jq '.say'
I tried to figure out how to do it myself but I'm not really sure what I'm doing in the lang xml. I figured it'd be similar to the way html
can subformat embedded js
and php
, but this would grab the specified ext and apply the an appropriate formatter.
Such a thing could also be used for commonmark's fenced code blocks with its language indicator, for example.
Edited by Addie GS