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

The "Jupytext Notebook" viewer works for more notebook extensions #882

Merged
merged 2 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ When Jupytext is installed, `.py` and `.md` files have a notebook icon. And you
</details>
<details>
<summary>With a click on the text file in JupyterLab</summary>
To do that, you will need to change the default viewer for text files supported by Jupytext by copy-pasting the following settings in `Document Manager` section:
To do that, you will need to change the default viewer for text notebooks by copy-pasting the following settings (or the subset that matches your use case) in the `Document Manager` section:

```json
{
"defaultViewers": {
"markdown": "Jupytext Notebook",
"jupytext-md": "Jupytext Notebook"
"myst": "Jupytext Notebook",
"r-markdown": "Jupytext Notebook",
"quarto": "Jupytext Notebook",
"julia": "Jupytext Notebook",
"python": "Jupytext Notebook",
"r": "Jupytext Notebook"
}
}
```
Expand Down
7 changes: 6 additions & 1 deletion binder/labconfig/default_setting_overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"@jupyterlab/docmanager-extension:plugin": {
"defaultViewers": {
"markdown": "Jupytext Notebook",
"jupytext-md": "Jupytext Notebook"
"myst": "Jupytext Notebook",
"r-markdown": "Jupytext Notebook",
"quarto": "Jupytext Notebook",
"julia": "Jupytext Notebook",
"python": "Jupytext Notebook",
"r": "Jupytext Notebook"
}
}
}
13 changes: 10 additions & 3 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
Jupytext ChangeLog
==================

1.13.3-dev (2021-12-03)
-------------------

**Changed**
- The "Jupytext Notebook" factory that lets the user configure the Notebook viewer as the default for text notebooks accepts more filetypes: "myst", "r-markdown" and "quarto" ([#803](https://github.com/mwouts/jupytext/issues/803))


1.13.2 (2021-11-30)
-------------------

**Changed**
- The extension for Jupyter Lab benefited from a series of improvements contributed by [Frédéric Collonval](https://github.com/fcollonval):
- A new "Jupytext Notebook" factory offers the option to open text notebooks directly with the notebook view (#803). To use it, follow the instructions in the [documentation](https://github.com/mwouts/jupytext/blob/main/docs/index.md#install).
- The ICommandPalette is optional, for compatibility with RISE within JupyterLab [RISE#605](https://github.com/damianavila/RISE/pull/605)
- A new "Jupytext Notebook" factory offers the option to open text notebooks directly with the notebook view ([#803](https://github.com/mwouts/jupytext/issues/803)). To use it, follow the instructions in the [documentation](https://github.com/mwouts/jupytext/blob/main/docs/index.md#install).
- The ICommandPalette is optional, for compatibility with RISE within JupyterLab [RISE[#605](https://github.com/mwouts/jupytext/issues/605)](https://github.com/damianavila/RISE/pull/605)
- Added support for translation
- Branch `master` was renamed to `main` (links update)
- Branch `master` was renamed to `main` (links in the documentation were updated)


1.13.1 (2021-10-07)
Expand Down
9 changes: 7 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ When Jupytext is installed, `.py` and `.md` files have a notebook icon. And you
</details>
<details>
<summary>With a click on the text file in JupyterLab</summary>
To do that, you will need to change the default viewer for text files supported by Jupytext by copy-pasting the following settings in `Document Manager` section:
To do that, you will need to change the default viewer for text notebooks by copy-pasting the following settings (or the subset that matches your use case) in the `Document Manager` section:

```json
{
"defaultViewers": {
"markdown": "Jupytext Notebook",
"jupytext-md": "Jupytext Notebook"
"myst": "Jupytext Notebook",
"r-markdown": "Jupytext Notebook",
"quarto": "Jupytext Notebook",
"julia": "Jupytext Notebook",
"python": "Jupytext Notebook",
"r": "Jupytext Notebook"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = "1.13.2"
__version__ = "1.13.3-dev"
4 changes: 4 additions & 0 deletions packages/labextension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.3.8 (2021-12-03)

- The "Jupytext Notebook" factory that lets the user configure the Notebook viewer as the default for text notebooks accepts more filetypes: "myst", "r-markdown" and "quarto" ([#803](https://github.com/mwouts/jupytext/issues/803))

# 1.3.7 (2021-11-30)

The extension for Jupyter Lab benefited from a series of improvements contributed by [Frédéric Collonval](https://github.com/fcollonval):
Expand Down
2 changes: 1 addition & 1 deletion packages/labextension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-jupytext",
"version": "1.3.7",
"version": "1.3.8",
"description": "Save Jupyter Notebooks as Scripts or Markdown files that work well with version control & external text editors",
"keywords": [
"jupyter",
Expand Down
24 changes: 19 additions & 5 deletions packages/labextension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,33 @@ const extension: JupyterFrontEndPlugin<void> = {

// Define file types
app.docRegistry.addFileType({
name: "jupytext-md",
displayName: trans.__("Markdown File"),
name: "myst",
displayName: trans.__("MyST Markdown Notebook"),
extensions: [".myst", ".mystnb", ".mnb"],
icon: markdownIcon
});

app.docRegistry.addFileType({
name: "r-markdown",
displayName: trans.__("R Markdown Notebook"),
// Extension file are transformed to lower case...
extensions: [".rmd", ".qmd"],
extensions: [".rmd"],
icon: markdownIcon
});

app.docRegistry.addFileType({
name: "quarto",
displayName: trans.__("Quarto Notebook"),
extensions: [".qmd"],
icon: markdownIcon
});

// Duplicate notebook factory to apply it on markdown file
// Duplicate notebook factory to apply it on Jupytext notebooks
// Mirror: https://github.com/jupyterlab/jupyterlab/blob/8a8c3752564f37493d4eb6b4c59008027fa83880/packages/notebook-extension/src/index.ts#L860
const factory = new NotebookWidgetFactory({
name: "Jupytext Notebook",
// label: trans.__("Jupytext Notebook"), // will be needed in JupyterLab 4
fileTypes: ["jupytext-md", "markdown", "python"],
fileTypes: ["markdown", "myst", "r-markdown", "quarto", "julia", "python", "r"],
modelName: notebookFactory.modelName ?? "notebook",
preferKernel: notebookFactory.preferKernel ?? true,
canStartKernel: notebookFactory.canStartKernel ?? true,
Expand Down