Skip to content

Commit

Permalink
Rework virtual files
Browse files Browse the repository at this point in the history
Before Volar, the ESM, JSX, and markdown parts of virtual files had to
map character by character, with parts shadowed by whitespace
characters. This was still how virtual files were built. However,
because of how Volar mappings work, this is unnecessary.

This change overhauls how virtual files are generated. This leads to
more flexibility of virtual files, meaning we can omit or inject
content.

This is already leveraged in several ways:

- Markdown nodes in MDX are represented by TypeScript fragments. This
  provides compatibility with JSX elements that require children on a
  type level.
- Markdown text nodes in MDX are represented by TypeScript JSX
  expressions containing an empty string.
- JavaScript chunks are represented in the virtual markdown files as
  HTML comments.
  • Loading branch information
remcohaszing committed Dec 11, 2023
1 parent a738090 commit e1c3250
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 323 deletions.
Loading

0 comments on commit e1c3250

Please sign in to comment.