feat: allow document assets #1601
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows docs to have their own assets. The pattern is similar to the tutorials: you can have a
+assetsfolder at the root of yourdocsfolder. To reference them in your markdown you can doa couple of things I don't like:
create_indexa newglobimport. This is because we usereadin the+server.tsfile that needs the actual import and not?url...we could doread(await import(asset[name]))but that's too complex a dynamic import for vite.pnpm docs-sync -won HMR vite refreshes the import of the image, adding a time query parameter to invalidate the cache. However,readdoesn't support query parameters, so it fails...is this a bug in read? The alternative would be to remove the search, but that could lead to cached content (and be a bit of a hack).Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.