Description
Things I want for all code blocks inside website v2:
- Accurate Syntax Highlighting for complex TS (ex)
- Hover support for symbols (ex)
- Inline reporting of errors (ex)
- The ability to tell a code block to switch from TS code to any arbitrary part of the tsc emit (ex)
- a JS file
- a d.ts file
- a source map
- The ability to create a working imports inside a codeblock (TS/JS/DTS)
- The ability to highlight lines, a line, or a range inside the line (ex)
Sidegoal:
Make this not directly tied to the website so that anyone with a Gatsby blog can re-use this for their own docs with very little setup.
Places with existing infra this can build from:
-
orta/lsif-tsc-remark-example
- an example of using the LSIF format (static language server protocol) to extract metadata. Overall, I think it's too much to go through the entire tsc-lsif, we could probably just steal the syntax for hover tokens and diagnostics and call it enough maybe. -
microsoft/TypeScript-New-Handbook
the handbook has a good set of existing examples for this, these could be re-formatted into Gatsby/remark plugins. -
andrewbranch/gatsby-remark-vscode
re-using VSCode at build time to handle the syntax highlighting. -
andrewbranch/blog
- uses the typescript API to inline annotate embedded TypeScript ( long form on how it works )