-
Notifications
You must be signed in to change notification settings - Fork 28
[docs-infra] Add CodeHighlighter component for loading demos and codeblocks #379
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
Merged
Merged
Changes from all commits
Commits
Show all changes
232 commits
Select commit
Hold shift + click to select a range
394e18f
Add CodeHighlighter component for loading demos and codeblocks
dav-is 464f786
Add first docs
dav-is 940b0ec
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 4f46987
Refactor CodeHighlighter
dav-is b76621b
Stabilize API
dav-is fc65c6c
Fix context types
dav-is 6c935b6
Transformers, Linking, Improve docs display
dav-is 64d432b
Improve highlighting transforms
dav-is 1fef68b
Replace TsToJs lib
dav-is 7ad5d7e
removeTypes from tsx file
dav-is 1a2b3a3
Fix docs build
dav-is 67d2b8d
TS/JS Switcher working
dav-is 48f825e
Fix filename switcher
dav-is 186261f
loadVariant support extraFiles transforms
dav-is 4f796f2
Get webpack loader working
dav-is a2132b8
Refactor loader with tests
dav-is fc1a814
Improve module resolution logic
dav-is b013c08
Add loadCode()
dav-is d419bbb
Rewrite loadVariant with tests
dav-is 8863f10
loadVariant returns dependencies
dav-is 8925b29
More loadVariant edge cases
dav-is 0b1b59a
Improve transform and parse tests
dav-is 710569e
Improve loadFallbackCode and add tests
dav-is 0d50e7d
Refactor loader and fallback loading
dav-is 0bed161
Add more info to readme + extensions recommendation for MDX
dav-is 79573f8
loadCode() cache
dav-is bc0314f
Rename loadCode and loadVariantCode to loadCodeMeta and loadVariantMeta
dav-is f153846
loadVariantMeta is now optional
dav-is 28f5450
Refactor getFileNameFromUrl() and remove use of node:path
dav-is ff85803
refactor to `serverLoadSource` and `serverLoadCodeMeta`
dav-is e423baa
Rename `loadPrecomputedCodeHighlighter`
dav-is 76752b8
improve transforms exports, rename loaderUtils
dav-is d8cbd2c
More renaming
dav-is b1a18d5
Rename fix
dav-is a11f4eb
Improve transform testing
dav-is 5fa3649
Refactor, remove delete calls
dav-is 9d06df8
Refactor useHighlighted hook
dav-is 5a8926b
Change parseSource type to by synchronous
dav-is 7e1af5f
Refactor Client Component with tests
dav-is bbafcb3
Fix tests
dav-is 1efaed8
Fix infinite loop
dav-is 6b0c2ce
useCode + useDemo improvements
dav-is 016137d
loadFallbackCode produces valid initialData tests
dav-is c55f17c
Add tests and validation ensuring the `allFilesListed=true` doesn't l…
dav-is 35c5c43
Fix transforms
dav-is 23cdc59
Cleanup Demo CSS, Add file tabs
dav-is 5b833ce
resolveModulePath should be isomorphic
dav-is b861f57
Fix webpack cache paths
dav-is baa3941
Fix loadVariant test
dav-is 07c01fd
Update package scripts
dav-is 2cc1fe9
Fix loadVariant relative paths
dav-is bac7c40
Normalize extraFiles
dav-is b302794
Transformation bugfixes
dav-is 5108f3e
Progress on docs
dav-is ff05e79
Add copy button to docs
dav-is 5053c4c
Workaround until publishing is fixed
dav-is 155277e
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 75c9448
Fix bad merge
dav-is 5db5c70
Another package.json fix
dav-is d91dcd7
Fix named imports
dav-is 1452ff0
Improve createDemo() API
dav-is 84b2377
Add fileConventions to Contributing page
dav-is c00afa2
Update createDemo() docs
dav-is 823b06a
Fix more createDemo() calls
dav-is 22c94da
Remove mentions of precompute: true
dav-is 30c1060
Improve docs output
dav-is 7a2a637
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is db25238
Variant Selector
dav-is a1e05ac
Got Code Controller Demos Working
dav-is 8cf4b43
Setup esm only build
dav-is 0deda80
Node 22 Requirement
dav-is dfe214e
Handle markdown code blocks at build time
dav-is 9fb408a
Cleanup
dav-is 8761252
transformMarkdownCodeVariants
dav-is 63c7d45
Improve loader testing, docs
dav-is e7a8dc0
Improve CodeContent
dav-is d990e85
Fix markdown -> html <code> AST parsing
dav-is a700be8
<CodeHighlighter> without filename or URL
dav-is d560759
Skip transforms for inline code snippets by default
dav-is dcb6018
Rename to transformMarkdownCode
dav-is f3324d2
Fix rename
dav-is 84d1af4
Fix markdown escaping
dav-is 40678b4
Clarify inline variant defs
dav-is 26ef082
Improve docs more
dav-is 2a009f6
Improve useCode / useDemo
dav-is f362ced
File Linking, improved name + slug generation
dav-is 900bb60
Variant and transform preference storage, improve demo and code display
dav-is 7dc3d3c
Prettier + Cleanup
dav-is 1ee499c
pnpm dedupe
dav-is 78df427
pnpm dedupe again
dav-is 9c0cda1
Parse and Pass `externals` for use in export to stackblitz
dav-is a2d2b95
Renaming
dav-is a72a30a
useDemo + CodeSandbox + StackBlitz
dav-is d088606
pnpm dedupe
dav-is afb544c
rename to transformMarkdownRelativePaths
dav-is 9c08751
Handle highlightAt hydration / idle
dav-is 56785b7
Formatting
dav-is 257fd26
Refactor useLocalStorage
dav-is d74ca5c
Bugfixes
dav-is a6a9603
Move docs to davis/add-code-highlighter-docs branch
dav-is 73f494e
Prettier
dav-is aeaf382
Move build-time style processes like webpack loaders, remark plugins,…
dav-is 2e0ba37
Fix remaining pieces from move
dav-is 49d60ae
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 417532e
pnpm dedupe
dav-is 0338a8a
Use MUI useLocalStorageState
dav-is 7882897
refactor into useUrlHashState()
dav-is 6ddf9e1
pnpm dedupe
dav-is 27420f7
Add globalsCode and createDemoGlobal()
dav-is 83058ae
Allow passing `demoGlobalData` in abstractCreateDemo()
dav-is 85dfbd5
Fix tests
dav-is 63169c6
Add merging for globalsCode
dav-is 40c0cdb
Fix overlaid code
dav-is 013510f
bugfixes, line count, disable js transforms for now
dav-is 6fbfe9b
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is e2f7f65
Add line gutters
dav-is e8cd8a8
Merge branch 'davis/add-code-highlighter-loader' of github.com:mui/mu…
dav-is dc5bfcb
Improve line count, fix codesandbox, improve types in useCode
dav-is 81a4c45
Improve Exports API
dav-is a6af70f
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 07f45b7
Add title and description suffixes and versioning for exports
dav-is 214ca59
Fix adding `./App.tsx` bug
dav-is 6d60131
Fix lint
dav-is e641ab9
variantType, usePreference, custom prefs prefix,
dav-is c2abda7
Fix duplicate files when moving in variant transform
dav-is 95d7e5c
Fix HTML output with CRA
dav-is 421e7ee
Lint
dav-is bfb12d6
Improve export formatting, pass vite options
dav-is df9c0d1
Handle Client-Side Errors
dav-is f4b21d3
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is c7d7303
Update package.json version
dav-is 295914d
Add type descriptions
dav-is b8e0c11
throw Error in precompute
dav-is d3e00c7
Add types to package.json
dav-is 087737e
Fix hot-reload state for precomputed code blocks
dav-is 4ad3bd3
Select initial variant properly
dav-is ca49142
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is ec7367a
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 3fe282c
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 3432180
pnpm dedupe
dav-is e577ff0
Fix lint
dav-is 584c93d
Fix build
dav-is bc658f4
Fix prettier
dav-is 19d3f20
Optimize factory parse function
dav-is 7f8e5c2
Add more js-docs, code review
dav-is cecad7c
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 8881180
Move Externals Provider to a 'use client' based loader
dav-is 72cfbce
Fix build
dav-is 4ab4bab
Remove outdated tests
dav-is e6c2212
Fix webpack build
dav-is cb599e4
pnpm dedupe
dav-is df03ec3
store parser in globalThis
dav-is 268015d
Simplify loadVariant function params
dav-is 895da07
Simplify loadFallbackCode function params
dav-is 6e58101
Code review
dav-is 551d89b
Pull heavy files from the base client bundle
dav-is 7dc6ce6
Improve applyTransform test case
dav-is 61a399c
Add console.error if variant load error during server render
dav-is 065df9b
parameters -> arguments
dav-is 4255097
Remove idea for cli tool from error
dav-is e6cb907
Add Next.js Plugin
dav-is 9e5730e
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 12fdec1
Fix merge conflict
dav-is 3e20015
Fix Fallback Bugs
dav-is 4dbb82c
Fix unit tests
dav-is 5a4bcc0
Updated test too soon
dav-is 32e7519
Add bundle
Janpot a006dc6
Improve relative path resolution
dav-is 4c9d5d8
Update README link
dav-is 99e5501
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 4a91028
Add server-only imports where helpful
dav-is 2a59b6d
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is fc64da5
Update package.json to fit new format
dav-is 44292b3
Some code review changes
dav-is a3592a3
Cleanup deps
dav-is e85f81c
pnpm dedupe
dav-is 9241cb5
Refactor useUrlHashState to improve hash synchronization and subscrib…
dav-is 07d55d6
Revert "Add server-only imports where helpful"
dav-is da02cb1
Replace useOnHydrate and useOnIdle
dav-is 3639656
Refactor useControlledCode to simplify return values and update relat…
dav-is 03d42c1
Improve CodeHighlighter Types
dav-is cc5803c
Refactor renderWithInitialSource and CodeInitialSourceLoader for impr…
dav-is c1b2cd6
Re-add exported types
dav-is bc8eac6
Use `path-module` in loadVariant
dav-is b97fd11
Allow client loading without `forceClient` when using <CodeProvider>
dav-is 469ab8e
Enhance error logging in CodeHighlighterClient with URL context and a…
dav-is dad1305
pnpm dedupe
dav-is b12db50
pnpm dedupe
dav-is 16d8a23
Refactor addPathsToVariant
dav-is e31a6e1
Rewrite addPathsToVariant
dav-is 394547d
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is f48420d
Improve Error Experience
dav-is 217e486
prettier
dav-is 8efef8c
Simplify useUrlHashState()
dav-is f6ce76a
Remove markdown transformers not added in this PR
dav-is d47226b
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is fee457c
prettier
dav-is 22569df
Add 'allowExternalVariants' option to parseCreateFactoryCall
dav-is 860a696
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 0a3accb
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 4dd1926
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is d78ad51
Cleanup CodeHighlighter exports
dav-is abee2e4
Fix lint
dav-is d1e246d
pnpm dedupe
dav-is 51c39f2
pnpm dedupe again
dav-is d514832
For code longer than 120 lines, only render highlighted lines when vi…
dav-is 548b450
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 538ad1c
pnpm dedupe
dav-is 43f3ae4
fix lint
dav-is 08cfb13
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 042d5e3
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 71f8a26
Add enhanceAfter and rename highlightAt to highlightAfter
dav-is dc7e87e
Compress hast in html in production
dav-is d21653d
Remove performance logs for now
dav-is 2e3b047
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 9955521
Fix Loading Component
dav-is 3927a95
Add support for CSS @import
dav-is 3dcfc5f
Support imports within mdx files
dav-is 7ce59e5
Refactor parseImports
dav-is 0975202
Collect and remove comments during import parse
dav-is 5ed9de6
Optimize rewriteImports()
dav-is 8e18364
Add docs-infra copilot instructions
dav-is 78973c8
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 8ad83f7
Merge branch 'master' into davis/add-code-highlighter-loader
dav-is 9f6c252
Support createSnippet<typeof Component>(import.meta.url) factories
dav-is b143bc1
Optimize parseCreateFactoryCall
dav-is 871853f
Add more notes to copilot instructions
dav-is 057c877
Rename parseImports() to parseImportsAndComments()
dav-is 68b354d
Improve semantic structure of code in html
dav-is c621b19
Rename transformHtmlCode to transformHtmlCodePrecomputed
dav-is 0655ced
transformHtmlCodePrecomputed should output a <pre> tag
dav-is fe108c9
Parse vanilla markdown output within transformHtmlCodePrecomputed
dav-is File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["unifiedjs.vscode-mdx", "dbaeumer.vscode-eslint"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.