Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby-remark-prismjs): Add support for Prism command-line plugin #16170

Merged
merged 12 commits into from Aug 1, 2019

Conversation

@elken
Copy link
Contributor

commented Jul 28, 2019

Description

Adds prompts (customised with css) to shell output using command-line plug-in. Output can be changed via outputLines directive. Disabled by default, enabled by specifying user & host in settings.

Added support for Prism command-line plugin
- Adds prompts (customised with css) to shell output
- Output can be changed via outputLines

@elken elken requested review from gatsbyjs/core as code owners Jul 28, 2019

@lannonbr lannonbr changed the title Added support for Prism command-line plugin feat(gatsby-remark-prismjs): Added support for Prism command-line plugin Jul 28, 2019

elken added some commits Jul 28, 2019

@wardpeet

This comment has been minimized.

Copy link
Member

commented Jul 29, 2019

Any chance you can show us a screenshot of what this does? 😄 I'm not super familiar with prismjs.

@elken

This comment has been minimized.

Copy link
Contributor Author

commented Jul 29, 2019

Of course! I can also attach to the README if you think it'd be relevant.

Output

It adds the prompt at the start(because I've marked the other lines as output, as outlined in the docs), the line and pads everything to the right. Makes it more obvious what's a command and what's expected output imo.

@wardpeet
Copy link
Member

left a comment

This is rad! I think we should move it to the snippet level rather than globally but I might be wrong on that.

packages/gatsby-remark-prismjs/README.md Show resolved Hide resolved

elken added some commits Jul 29, 2019

Options play nice
- Started on global setting
- Made options play nice together
- Made bash snippets more modular
Make tests play nice
- TIdy up options
- Fix bug where hl lines were randomly being picked up
Update README
- Bug with `shell` so only works with `bash` currently
@elken

This comment has been minimized.

Copy link
Contributor Author

commented Jul 29, 2019

As reflected in the README, default behaviour is off, can be changed with prompt.global in settings or by specifying outputLines. I've also made outputLines and numberLines work together in options (should still be backwards compatible but I guess the tests will show that).

EDIT: Apparently it's intentional to have one param in language specification so removed.

EDIT 2: Below snippet

```bash{outputLines: 2-20}{numberLines: true}
ssh-keygen -f /home/$USER/.ssh/gitlab-deploy
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/elken/.ssh/gitlab-deploy.
Your public key has been saved in /home/elken/.ssh/gitlab-deploy.pub.
The key fingerprint is:
SHA256:xyeTjhvNQLLAmuRFZFW91ay5/Fz0hFMbipcqvB1klNc elken@zenith
The key's randomart image is:
+---[RSA 2048]----+
|   .+.....  .o.  |
|   +      .o..oE.|
|  . + . . .oooooo|
| o + . + ..=o+o.o|
|  +   . S O.+. +.|
|         X *o   o|
|        o B .o . |
|         + .  o  |
|        .        |
+----[SHA256]-----+
```

gives

This

elken added some commits Jul 29, 2019

Fix parse-options
- Not backwards compatible
@sidharthachatterjee
Copy link
Member

left a comment

This is super cool! Thank you for adding this 👍

Left a couple of small comments!

packages/gatsby-remark-prismjs/package.json Outdated Show resolved Hide resolved
packages/gatsby-remark-prismjs/package.json Outdated Show resolved Hide resolved

elken and others added some commits Jul 31, 2019

Update packages/gatsby-remark-prismjs/package.json
Co-Authored-By: Sidhartha Chatterjee <me@sidharthachatterjee.com>
Update packages/gatsby-remark-prismjs/package.json
Co-Authored-By: Sidhartha Chatterjee <me@sidharthachatterjee.com>
@elken

This comment has been minimized.

Copy link
Contributor Author

commented Jul 31, 2019

Few testing tweaks slipped in, apologies. Both resolved.

@sidharthachatterjee sidharthachatterjee changed the title feat(gatsby-remark-prismjs): Added support for Prism command-line plugin feat(gatsby-remark-prismjs): Add support for Prism command-line plugin Aug 1, 2019

@sidharthachatterjee sidharthachatterjee merged commit a1c8fdd into gatsbyjs:master Aug 1, 2019

18 checks passed

Danger All good
Details
Peril All green. Congrats.
Details
ci/circleci: bootstrap Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_development_runtime Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_gatsby-image Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_path-prefix Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_production_runtime Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_gatsby_pipeline Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_long_term_caching Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: starters_validate Your tests passed on CircleCI!
Details
ci/circleci: themes_e2e_tests_development_runtime Your tests passed on CircleCI!
Details
ci/circleci: themes_e2e_tests_production_runtime Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node10 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node12 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node8 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_www Your tests passed on CircleCI!
Details
unit_tests_windows Build #20190731.33 succeeded
Details
@gatsbot

This comment has been minimized.

Copy link

commented Aug 1, 2019

Holy buckets, @elken — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. We’ve got Gatsby t-shirts, stickers, hats, scrunchies, and much more. (You can also unlock even more free swag with 5 contributions — wink wink nudge nudge.) See gatsby.dev/swag for details.
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.