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

Follow the tutorial for switching to shiki twoslash codeblocks #1

Closed
wants to merge 1 commit into from

Conversation

orta
Copy link
Owner

@orta orta commented Apr 10, 2020

This is now outdated, and I'd recommend following the instructions on https://www.npmjs.com/package/gatsby-remark-shiki-twoslash


Takes the default template from: npx gatsby new gatsby-twoslash-shiki-blog https://github.com/gatsbyjs/gatsby-starter-blog and switches it to use Shiki + twoslash code samples

Summary:

  • Switch gatsby-remark-prismjs -> gatsby-remark-shiki-twoslash in config
  • Add dependencies
  • Add CSS
  • Add JS
  • Add twoslash after code samples (I excluded that from this PR to keep it focused)

Preview link: https://gatsby-twoslash-shiki-blog-example.now.sh/new-beginnings/
NPM: https://www.npmjs.com/package/gatsby-remark-shiki-twoslash
Twoslash: https://www.npmjs.com/package/@typescript/twoslash

@Jack-Works
Copy link

gatsby-remark-shiki-twoslash/dist/dom no longer exists in 0.7.0

@orta
Copy link
Owner Author

orta commented Oct 6, 2020

Good point, these have moved into shiki-twoslash: shiki-twoslash/dist/dom instead.

@molebox
Copy link

molebox commented Jul 9, 2021

Hey @orta , im trying to add this to a gatsby project and am getting this error: If you're trying to use a package make sure that 'shiki-twoslash/dist/dom' is installed. If you're trying to use a local file make sure that the path is correct.

The import: import {setupTwoslashHovers} from "shiki-twoslash/dist/dom"

Do you have any ideas whats going on here?

@orta
Copy link
Owner Author

orta commented Jul 9, 2021

How did you get to this link? I should make them all re-direct to the npm module which is always to date: https://www.npmjs.com/package/gatsby-remark-shiki-twoslash

@molebox
Copy link

molebox commented Jul 9, 2021

How did you get to this link? I should make them all re-direct to the npm module which is always to date: https://www.npmjs.com/package/gatsby-remark-shiki-twoslash

This PR? On the npm package readme, the first line: Read this PR and apply the same to your project. links here.

But that readme doesnt explain about setting up the twoslash hover. I looked at this PR then saw your comment above about the change re: shiki-twoslash/dist/dom

@orta
Copy link
Owner Author

orta commented Jul 9, 2021

Ace, thanks removed - the highlights come entirely from the CSS! Shiki Twoslash doesn't use JS at all.

@orta orta closed this Jul 9, 2021
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.

None yet

3 participants