sapling
sapling copied to clipboard
[docs] add sl-shell-example syntax-highlighting language
Stack created with [Sapling]
- #270
- #267
- #266
- -> #264
[docs] add sl-shell-example syntax-highlighting language
Summary: Right now the example sl sessions have no hightlighting, or sometimes they pretend to be bash, which kind-of-half-works but also half doesn't work and is ugly (See the "Before" example - there is random highlighting for some numbers in the middle of command output, the ".." in "..." is randomly highlighted as a directory, etc)
This diff adds a new custom Prism language called "sl-shell-example" which does syntax highlighting specifically tailored for our example sessions with these main parts:
# comment
$ shell command
~/my/subdir $ shell command in a specific subdirectory
output
(For the record, Prism already has a language called "shell-session", but that language doesn't support comments (which is something we make heavy use of), and also it tries to be clever by highlighting random words in the middle of shell commands (which is just distracting in the context of sapling docs))
Test Plan:
Before:

After:

If somebody is some kind of regex-genius it might even be possible to automatically highlight smartlog examples, but I'll leave that as an exercise for the reader (or my future self :) )
@mzr has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
Thanks for the PR! LGTM, but one nit from me. Can we change sl-session to something like sl-shell-example? IMO it better reflects what it really is, and it is also similar to the original shell-session in Prism.
@shish has updated the pull request. You must reimport the pull request before landing.
@shish has updated the pull request. You must reimport the pull request before landing.
@shish has updated the pull request. You must reimport the pull request before landing.
Can we change
sl-sessionto something likesl-shell-example?
Done :)
@mzr has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@shish has updated the pull request. You must reimport the pull request before landing.
@shish has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.