-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Syntax: Add interactive unix shell support in fenced code blocks
It seems common practice to treat `shell` code blocks as interactive shell. Means each line starting with `$` is treated as shell command, while other lines denote output only, which may not be highlighted.
- Loading branch information
Showing
4 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
%YAML 1.2 | ||
--- | ||
name: Interactive Unix Shell | ||
scope: source.shell.interactive.markdown | ||
hidden: true | ||
|
||
contexts: | ||
main: | ||
- match: ^(?=\$\s) | ||
push: shell-interactive | ||
- include: shell-statements | ||
|
||
shell-interactive: | ||
- match: ^\$(?=\s) | ||
scope: comment.other.shell | ||
push: shell-statements | ||
with_prototype: | ||
# continuation lines begin with `> ` | ||
- match: ^>(?=\s) | ||
scope: comment.other.shell | ||
- match: ^ | ||
pop: true | ||
|
||
shell-statements: | ||
- include: scope:source.shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters