Skip to content

Use shiki-twoslash for docs #3324

@Rich-Harris

Description

@Rich-Harris

Describe the problem

These are the endpoint docs rendered on my screen:

image

There's a full page of TypeScript throat-clearing before we get to the bit that people actually want to see:

image

It's useful to have the types documented, but not like this.

Another problem with our docs: the types can get out of date, as seen here. It would be nice if somehow snippets in our docs were typechecked.

Describe the proposed solution

We could potentially solve both problems with @orta's https://shikijs.github.io/twoslash.

Questions to which I don't know the answer:

  • Can it be made to work with Svelte components?
  • Does it work with JSDoc syntax?
  • Do we have any concerns about accessibility, if type information is hidden behind hovers?

Aside: doing this would presumably require cooperation between this repo, sveltejs/sites, and sveltejs/action-deploy-docs. Before leaping into it we might want to consider whether the current setup is to our liking, or whether we might want to move to multi-page docs with search and interactive components (likely powered by mdsvex).

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy