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): Allow global line number config #10076

Merged

Conversation

timbroder
Copy link

@timbroder timbroder commented Nov 21, 2018

Hi!

First-time contributor, please let me know if I can improve anything!

Line number support for Prism was added in #5821! 🎆 But, it looks like showLineNumbers in the main config isn't used so you can conditionally turn on for specific code blocks when you want it.

This PR turns that high level config back on if you want it. I'm migrating a few hundred posts over from Jekyll and don't want to go through each post turning line numbers on 😸

CC: @phacks (original line number PR)

Copy link
Contributor

@jgierer12 jgierer12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I spotted a sneaky typo:

packages/gatsby-remark-prismjs/README.md Outdated Show resolved Hide resolved
Co-Authored-By: timbroder <tim@kidfund.us>
@timbroder
Copy link
Author

@jgierer12 thanks! (oh man the new suggestion features are great)

@jgierer12 jgierer12 changed the title Allow prism line numbers everywhere feat(gatsby-remark-prismjs): Allow global line number config Nov 21, 2018
@phacks
Copy link
Contributor

phacks commented Nov 22, 2018

Looks good to me!

@timbroder timbroder closed this Nov 22, 2018
@timbroder timbroder reopened this Nov 22, 2018
@timbroder
Copy link
Author

Sorry for the close / reopen. Was playing with Githawk and thought it meant close the notification.

@jgierer12 I'm not sure what the bootstrap failure is, could you advise? Thanks

@jgierer12
Copy link
Contributor

I don't think the failing CI has anything to do with this PR, no need to worry about it.

@phacks
Copy link
Contributor

phacks commented Nov 25, 2018

@timbroder Could you try to do the following to see if tests pass now?

  • do a git commit --amend without changing anything on your branch and push --force it again?
  • if it did not work, maybe git co master && git pull && git co - && git rebase master, fixing conflicts if any, and git push --force again?

Thanks!

…er/gatsby into topics/prism-line-numbers-global
@timbroder timbroder force-pushed the topics/prism-line-numbers-global branch from 43256bc to fda5f94 Compare November 26, 2018 12:41
@timbroder
Copy link
Author

timbroder commented Nov 26, 2018

@phacks that did it! Thanks!

(the first one)

@timbroder
Copy link
Author

@jgierer12 what is the next step to merge this? Thanks

@jgierer12 jgierer12 merged commit 2efec7a into gatsbyjs:master Dec 2, 2018
@gatsbot
Copy link

gatsbot bot commented Dec 2, 2018

Holy buckets, @timbroder — 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. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  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!

@jgierer12
Copy link
Contributor

Sorry, seems like this flew a bit under my radar 😅

Thanks a lot @timbroder 🙌

@pieh
Copy link
Contributor

pieh commented Dec 2, 2018

Before publishing this, I have just one potential correction - showLineNumbersGlobal makes perfect sense in context of the function, but it sounds a little weird when defining plugin options (where every option there is really "global") and also this changes "API" of plugin a bit (so would need potentially major version bump).

My preferred solution for this would be to keep previous name of the option and alias it in the function:

module.exports = (
  { markdownAST },
  {
    classPrefix = `language-`,
    inlineCodeMarker = null,
    aliases = {},
    noInlineHighlight = false,
-   showLineNumbersGlobal = false,
+   showLineNumbers: showLineNumbersGlobal = false,
  } = {}
) => {

and adjust readme to use showLineNumbers. What do you think?

And sorry @timbroder for slow PR handling, I've missed this one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants