mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.6k stars 386 forks source link

Register arbritrary kernel languages with docRegistry #1188

Closed mahendrapaipuri closed 10 months ago

mahendrapaipuri commented 10 months ago

Fixes #1164

Now users can configure default Viewers for docManager to open them as Notebooks. By default text notebooks will always open as file with editor factory.

@parmentelat @mwouts Could you please test the patch and see if it is the desired behaviour? Current implementation will open markdown, myst, Rmd and qmd formats as notebooks by default. Is it intended? I m asking because this was the behaviour in 1.15.x and I have not changed it. I guess you would like the markdown variants open as text files by default and able to change them as notebooks by overriding default viewers. If so, let me know, I will make necessary changes.

@mwouts What is the reason of choosing format as md:myst for MyST? I have noticed that creating a MyST text notebook creates the file with .md extension. Is it not supposed to be created with .myst extension? If so, we need to change the format to myst.

Cheers!!

github-actions[bot] commented 10 months ago

Thank you for making this pull request.

Did you know? You can try it on Binder: Binder:lab or Binder:notebook.

Also, the version of Jupytext developed in this PR can be installed with pip:

pip install git+https://github.com/mahendrapaipuri/jupytext.git@viewer_for_generic_languages

(this requires nodejs, see more at Developing Jupytext)

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7223622) 97.73% compared to head (8866366) 97.73%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1188 +/- ## ======================================= Coverage 97.73% 97.73% ======================================= Files 29 29 Lines 4456 4456 ======================================= Hits 4355 4355 Misses 101 101 ``` | [Flag](https://app.codecov.io/gh/mwouts/jupytext/pull/1188/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts) | Coverage Δ | | |---|---|---| | [external](https://app.codecov.io/gh/mwouts/jupytext/pull/1188/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts) | `75.05% <ø> (-0.12%)` | :arrow_down: | | [functional](https://app.codecov.io/gh/mwouts/jupytext/pull/1188/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts) | `88.56% <ø> (ø)` | | | [integration](https://app.codecov.io/gh/mwouts/jupytext/pull/1188/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts) | `77.31% <ø> (ø)` | | | [unit](https://app.codecov.io/gh/mwouts/jupytext/pull/1188/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts) | `66.56% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marc+Wouts#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mwouts commented 10 months ago

Thanks @mahendrapaipuri ! Just tested and it works like a charm. Now I have the 'bash' type for documents (screenshot below) and adding it to the Jupytext viewer let me open it as a notebook with a single click.

I think most MyST users prefer to use .md as the file extension, because it's mostly Markdown, and this way you can get it rendered as such on GitHub, etc.

Current implementation will open markdown, myst, Rmd and qmd formats as notebooks by default. Is it intended? I m asking because this was the behaviour in 1.15.x and I have not changed it.

I think this is specific to Binder (which we configure in this way). Let me have a look.

image

mwouts commented 10 months ago

Current implementation will open markdown, myst, Rmd and qmd formats as notebooks by default. Is it intended? I m asking because this was the behaviour in 1.15.x and I have not changed it. I guess you would like the markdown variants open as text files by default and able to change them as notebooks by overriding default viewers

Well you're right! Well I'd say that we let this as such (nobody complained about this, plus the notebook editor does look very similar to the markdown viewer for markdown files). Thanks for pointing this out