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
Factory overrides #6813
Factory overrides #6813
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
Ran into an issue with old typedoc configuration, so I also updated the |
Now with an auto-generated help string for the schema using @afshin's transformer mechanism: // Overrides for the default viewers for file types.
// Specify a mapping from file type name to document viewer name, for example:
//
// defaultViewers: {
// markdown: "Markdown Preview"
// }
//
// If you specify non-existent file types or viewers, or if a viewer cannot
// open a given file type, the override will not function.
//
// Available viewers:
// HTML Viewer
// Image
// CSVTable
// TSVTable
// JSON
// PDF
// Vega4
// Vega-Lite2
// Vega5
// Vega-Lite3
// Markdown Preview
// Notebook
// VDOM
// Editor
//
// Available file types:
// text
// notebook
// directory
// markdown
// python
// json
// csv
// tsv
// r
// yaml
// svg
// tiff
// jpeg
// gif
// png
// bmp
// html
// PDF
// vega4
// vega-lite2
// vega5
// vega-lite3
// vdom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. Thanks, @ian-r-rose!
fa264ed
to
f126541
Compare
f126541
to
cf7dc8b
Compare
f62a97d
to
2c15805
Compare
Is the diff here accurate? |
This adds a way for the end-user to override the default viewer for a given file type. I waffled for a while about whether this should be implemented on the file browser, the document manager, or the document registry. I went with the latter, since that handles all the logic for deciding which factories to use normally.
I am also thinking about adding a menu item to the "Settings" or "View" menu which exposes this for the markdown viewer specifically. Any thoughts about that?
This is a separate question from whether to make the markdown viewer default (which I would personally be in favor of), but should make it less pressing.
References
alleviates #6442, fixes #4048
Code changes
New function on the document registry to set an override for a given file type.
New user-settings in the
docmanager-extension
to expose this functionality.User-facing changes
Users can set their own default renderer for a file type.
Backwards-incompatible changes
None, as far as I can tell.