[docs] syntax-highlighting for smartlogs#267
Closed
shish wants to merge 3 commits into
Closed
Conversation
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">
Summary: I want to add syntax highlighting to the auto-generated docs, but they are out of date, so first let's update them Test Plan:
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: <img width="597" alt="Screenshot 2022-11-25 at 15 22 48" src="https://user-images.githubusercontent.com/40659/204015254-0fa62795-d39e-4c0a-bd49-81102872d837.png">
This was referenced Nov 25, 2022
Contributor
|
@sggutier has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
pushed a commit
that referenced
this pull request
Dec 5, 2022
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
facebook-github-bot
pushed a commit
that referenced
this pull request
Dec 6, 2022
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
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with [Sapling]
[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:
Example:
