[docs] add sl-shell-example syntax-highlighting language#264
Conversation
438bdc7 to
f37c4f0
Compare
|
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 |
|
@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. |
Done :) |
|
@mzr has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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 ``` <img width="495" alt="Screenshot 2022-11-24 at 16 15 08" src="https://user-images.githubusercontent.com/40659/203828858-592f3bbd-27bb-42c5-a762-881baed3ac21.png"> (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: <img width="667" alt="Screenshot 2022-11-24 at 15 54 27" src="https://user-images.githubusercontent.com/40659/203827808-2dd856ef-4a94-4afe-ac79-f053925f3e59.png"> After: <img width="668" alt="Screenshot 2022-11-24 at 15 54 39" src="https://user-images.githubusercontent.com/40659/203827793-3d1cee6b-0c68-4a99-9db9-821162db530e.png">
|
@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. |
Summary: Stack created with [Sapling] * #270 * __->__ #267 * #266 * #264 [docs] syntax-highlighting for smartlogs This doesn't work in all cases (trying to come with with a regex that correctly handles practically arbitrary input never will) - but it seems to cover the majority of examples that are in the docs in practice. Notable omissions: - non-active local bookmarks aren't spotted - no differentiation between draft and public commits Example: {F806537223} Pull Request resolved: #267 Test Plan: Looked through all of the pages manually Reviewed By: quark-zju Differential Revision: D41544319 Pulled By: shish fbshipit-source-id: 1a3bf691a5f53de90c4bb36a4c2613cf1a5edb0c
Summary: Stack created with [Sapling] * #270 * #267 * __->__ #266 * #264 [docs] Regenerate command auto-docs I want to add syntax highlighting to the auto-generated docs, but they are out of date, so first let's update them Pull Request resolved: #266 Reviewed By: bolinfest Differential Revision: D41544316 Pulled By: shish fbshipit-source-id: f6523275073add5a90982963089012e46f516d29
Summary: Stack created with [Sapling] * __->__ #269 * #267 * #266 * #264 [docs] make examples consistent both human understanding and syntax highlighting work better when the examples are consistent :) Pull Request resolved: #269 Test Plan: manually looked through every page Reviewed By: bolinfest Differential Revision: D41544321 Pulled By: shish fbshipit-source-id: aca88968b1c6cfc5340a004dd115e9eabbd4313c
Stack created with [Sapling]
[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:
(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:
