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

Change default markdown editor to preview #6442

Closed
domoritz opened this issue May 30, 2019 · 10 comments
Closed

Change default markdown editor to preview #6442

domoritz opened this issue May 30, 2019 · 10 comments
Labels
pkg:markdownviewer status:Needs Discussion status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@domoritz
Copy link
Member

domoritz commented May 30, 2019

I think the default editor for markdown should be the preview, and not the text editor. It would be nice if from the preview there was an easy way to jump into the editor e.g. with double click as in the notebook.

Related to #4048 but not quite the same because I am not asking to make the default configurable.

@jasongrout jasongrout added this to the 1.1 milestone May 31, 2019
@jasongrout
Copy link
Contributor

Thanks for bringing this up! Adding to 1.1 since it isn't a blocker for 1.0.

@lmoresi
Copy link

lmoresi commented Jun 28, 2019

I am very much in favour of this change as I would like to sprinkle static markdown files among my suites of notebooks so that the lab environment can take the form of a textbook with live examples. The other part of my use-case is that I would like this to live in the cloud via jupyterhub so that genuinely inexperienced users will be the most likely people to find the content.

With notebook files acting as landing pages, it is all too easy for those inexperienced users to switch to editing before they know what the jupyterlab environment is about and how to get their rendered text back.

I don't really have an opinion as to whether this should be a change to the default behaviour or configurable (as in the related issue) so that nothing changes for most users.

@DraTeots
Copy link

DraTeots commented Jul 1, 2019

The came for us. At Electron Ion Collider (EIC) software consortium we would like to use JupyterLab as a users entry point for EIC software with set of jupyter notebooks and documentation in form of pdfs and notebooks.

BTW. Any dirty hack how to do it now (like copy extension, change one line, add as a new extension overriding the functionality) would be VERY welcome.

@domoritz
Copy link
Member Author

domoritz commented Jul 1, 2019

@DraTeots I think you can make your own extension (copying the internal one and changing its name + priority). We have done something similar with https://github.com/jupyterlab/jupyter-renderers.

@lmoresi
Copy link

lmoresi commented Jul 1, 2019 via email

@lmoresi
Copy link

lmoresi commented Jul 6, 2019

The came for us. At Electron Ion Collider (EIC) software consortium we would like to use JupyterLab as a users entry point for EIC software with set of jupyter notebooks and documentation in form of pdfs and notebooks.

BTW. Any dirty hack how to do it now (like copy extension, change one line, add as a new extension overriding the functionality) would be VERY welcome.

I found this to be not entirely trivial because of this in the fileeditor code:

  const factory = new FileEditorFactory({
    editorServices,
    factoryOptions: {
      name: FACTORY,
      fileTypes: ['markdown', '*'], // Explicitly add the markdown fileType so
      defaultFor: ['markdown', '*'] // it outranks the defaultRendered viewer.
    }
  });

which, I think, means that it is not so simple to blast out a new extension.

But I would point out that the use-case I raised (inexperienced users should not be able to edit files) can be accomplished (approximately) by disabling the editor extension by default. This is only a workaround for a particular case, but it is reversible via the jupyterlab terminal so expert users can restore their editing capability:

# Turn off markdown (and all other) editing capabilities:
jupyter-labextension disable @jupyterlab/fileeditor-extension
# Restore them 
jupyter-labextension enable @jupyterlab/fileeditor-extension

Obviously this is just a quick fix but it does not require any coding at all !

L

@DraTeots
Copy link

Thanks for the answer. That exactly what I figured out trying to override the plugin. But I still hoped that I just not familiar enough with API and there is a way to apply ordering some other way.

At this moment we came up with the solution to save a workspace in our docker image, so initial README.md is opened in the beginning. Still, this is very limited compared to what we would like to achieve

@ian-r-rose
Copy link
Member

A quick update here. With #6813 users can now customize the default viewer for markdown files. Open the advanced settings editor, go to the document manager settings, and enter:

{
  defaultViewers: {
    markdown: "Markdown Preview"
  }
}

We may add a menu item to do this automatically, but this should help folks unblock for now. The feature will be available in JupyterLab 1.1.

@lmoresi
Copy link

lmoresi commented Aug 23, 2019 via email

@jasongrout
Copy link
Contributor

Fixed by #6813.

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg:markdownviewer status:Needs Discussion status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

6 participants