Skip to content
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

merged 9 commits into from Aug 22, 2019

Factory overrides #6813

merged 9 commits into from Aug 22, 2019


Copy link

@ian-r-rose ian-r-rose commented Jul 12, 2019

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.


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.

Copy link

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Jul 12, 2019

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

Copy link
Member Author

@ian-r-rose ian-r-rose commented Jul 12, 2019

Ran into an issue with old typedoc configuration, so I also updated the tdconfig.json files to use es2017. That should be mostly noise for the purposes of review.

Copy link
Member Author

@ian-r-rose ian-r-rose commented Jul 13, 2019

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

@jasongrout jasongrout self-requested a review Jul 29, 2019
@jasongrout jasongrout assigned jasongrout and afshin and unassigned jasongrout Jul 31, 2019
afshin approved these changes Aug 22, 2019
Copy link

@afshin afshin left a comment

This is awesome. Thanks, @ian-r-rose!

@ian-r-rose ian-r-rose force-pushed the factory-overrides branch from fa264ed to f126541 Aug 22, 2019
@afshin afshin force-pushed the factory-overrides branch from f126541 to cf7dc8b Aug 22, 2019
@jasongrout jasongrout removed their request for review Aug 22, 2019
@afshin afshin force-pushed the factory-overrides branch from f62a97d to 2c15805 Aug 22, 2019
@afshin afshin merged commit 15e6386 into jupyterlab:master Aug 22, 2019
9 checks passed
Copy link

@vidartf vidartf commented Aug 28, 2019

Is the diff here accurate?

@lock lock bot locked as resolved and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants