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

docs: Add twoslash-svelte #955

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Hugos68
Copy link

@Hugos68 Hugos68 commented Dec 7, 2024

A note on documentation PRs

Closes #649

This PR replaced the twoslash with twoslash-svelte package to allow type hints to be available on svelte codeblocks.

Note:
Currently this PR installs the @hugokorte/twoslash-svelte PR, this is because the original/official twoslash-svelte package won't be published until This PR is merged. The code is simply a copy and published seperately.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

Copy link

vercel bot commented Dec 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev ❌ Failed (Inspect) Dec 7, 2024 11:37am

Copy link

vercel bot commented Dec 7, 2024

@Hugos68 is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@Rich-Harris
Copy link
Member

Thank you! It looks like line 689 needs updating...

-} else if (language === 'js' || language === 'ts') {
+} else if (language === 'js' || language === 'ts' || language === 'svelte') {

...along with line 700:

-lang: 'ts',
+lang: language === 'svelte' ? language : 'ts',

Though when I make those changes locally, I start seeing errors like this which I I don't really understand 😆 maybe @dummdidumm can make sense of them:

index.tsx
[2304] 128 - Cannot find name 'svelteHTML'.
[2304] 323 - Cannot find name '__sveltets_2_isomorphic_component'.
[2304] 357 - Cannot find name '__sveltets_2_partial'.
[2304] 378 - Cannot find name '__sveltets_2_with_any_event'.

@Hugos68
Copy link
Author

Hugos68 commented Dec 13, 2024

Though when I make those changes locally, I start seeing errors like this

Ahh, these are expected! That means something is working, thanks for checking it out, I'll make your changes and continue working on it. I do have to see the Svelte docs rendered is quite the module. Lots of stuff going on.

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.

Use shiki-twoslash for .svelte code blocks
2 participants