-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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-embed-snippet): Add the ability to embed named snippets #24512
feat(gatsby-remark-embed-snippet): Add the ability to embed named snippets #24512
Conversation
Makes it possible for someone to add inline comments to a source file delineating one or more named snippets, and to embed snippets by name.
This looks awesome! I do however would want to discuss a bit way in which we specify snippet names to be used. Doing |
Another thing is about marking snippets - using them with comments is fine, i just think we should use conventions we already have for line highlighting - so (potentially) Let me know what do you think |
Thanks for the suggestions - I think it is good to make this fit in better. I didn't look far enough outside this plugin to see how some of the others worked. I will update to match the prismjs syntax better, using the syntax you suggested. |
Those were just examples - we might end up with them, but I'd like to encourage you to take a peek into what syntax conventions are used currently and maybe see if you can come up with better ones. You could take a look in both in |
Those suggestions do seem to be in line with the syntax used in the I think it is pretty unfortunate that prismjs used |
Based on review feedback, changed from `#SN<snippetName>` to `{snippet: "snippetName"}`. Also, marking the named snippet in the referenced file uses `start-snippet{snippetName}` and `end-snippet{snippetName}` instead of `BEGIN SNIPPET snippetName` and `END SNIPPET snippetName`. This syntax is used by prismjs for other option selections and inline comments.
I went with a change that doesn't require double quotes around the I wonder if I blew the commits by not using the conventional commit standard? I was thinking I just needed to worry about the pull request, not the individual commits to my fork. Hopefully that is correct. |
This is correct - we are "squashing and merging", so single commit will end up in master - and if there is more than 1 commit in PR - PR title is used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor inconsistencies to fix up and one extra question
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
I notice that the lint check is failing due to an extra space in |
You can merge Assuming
should fix lint problems Alternatively - you can go ahead and fix the lint separately in your branch - because it was fixed already in master - this change should not show in PR view |
Based on PR review, changed code to find the start and end of the snippet to use regular expressions. Nicer, easier to understand.
All right, code has sign off from me - it looks great and tests are great! Now just need to review for docs changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this in. I left a few comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Thank you for your patience, @BobWall23. And thanks to the other team members who have already reviewed! I've fixed a couple of merge conflicts and will merge this once tests pass.
Note: this says that we still need a Code owner review from the core team but pieh signed off on this a while back! |
Holy buckets, @BobWall23 — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
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! |
…ppets (gatsbyjs#24512) * Add the ability to embed named snippets Makes it possible for someone to add inline comments to a source file delineating one or more named snippets, and to embed snippets by name. * Modified syntax to better match prismjs Based on review feedback, changed from `#SN<snippetName>` to `{snippet: "snippetName"}`. Also, marking the named snippet in the referenced file uses `start-snippet{snippetName}` and `end-snippet{snippetName}` instead of `BEGIN SNIPPET snippetName` and `END SNIPPET snippetName`. This syntax is used by prismjs for other option selections and inline comments. * Code reformatter * Fix lint errors * Update packages/gatsby-remark-embed-snippet/README.md Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> * Update packages/gatsby-remark-embed-snippet/README.md Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> * Fix lint error * Reworked code to find named snippet. Based on PR review, changed code to find the start and end of the snippet to use regular expressions. Nicer, easier to understand. * Incorporate PR review feedback * Address PR review feedback Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> Co-authored-by: Aisha Blake <aisha@gatsbyjs.com>
Description
Adds a feature to the gatsby-remark-embed-snippet plugin that makes it possible for someone to add inline comments to a source file to delineate one or more named snippets, and to embed snippets by name.
Documentation
The new feature is documented in the
README.md
for thegatsby-remark-embed-snippet
plugin.Related Issues