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

RMarkdown/RNotebook support #86

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

RMarkdown/RNotebook support #86

wants to merge 34 commits into from

Conversation

grst
Copy link

@grst grst commented Nov 19, 2017

I created RMarkdown support for ipymd. With my extension, Rmd files edited in rstudio can be directly opened with jupyter.

Notably, this format two output-files:

  • .Rmd, the rmarkdown source code
  • .nb.html, where the output is stored.

Like that, input and output are separated, which is really handy when working with version control.

Images are fully supported

Images and other content, such as tables, are fully supported. Unlike the other markdown formats, Rmarkdown is thus a full replacement for jupyter nbformat.

The ipymd-cell representation was not sufficient

As I wanted to cover all information from jupyter nbformat, the sparse cell representation used for the other formats was not sufficient. I therefore use the jupyter nbformat as internal representation and convert directly between notebook and rmarkdown. This required to implement a 'special case' in FormatManager.

I couldn't think of an elegant solution to address this, without rewriting a good deal of core code.

I added a virtualenv for testing/developing

make jupyter will run jupyter in a virtual environment with ipymd enabled, so that
I don't have to mess with my production instance of jupyter.

I improved the README

I restructured the README, starting with a concise motivation, then an overview of formats and installation instructions

grst added 30 commits November 2, 2017 16:16
The jupyter virtualenv uses the ContentsManager by default, which
facilitates testing.
Merge these utility functions with testing utilities
which were previously located in test-utils.
Added additional metadata to example 5.
Like this it can be accessed as a helper function
from a different place.
html conversion requires pypandoc as dependency.
There is no way we can reproduce the *exact* .nb.html
as produced by rstudio. The difference is, however, irrelveant
(e.g. different ways of rendering markdown to html).

We now have two test-files: ipymd should be able to *read* rstudio
Rmd, and to *read and write* ipymd Rmd.
Implement 'error' output type.
Missing output were ignored.
Adapted unittests accordingly.
As a part of this, the way how an <--rnb-output--> chunk is
generated is entirely rewritten. All elements from
the jupyter notebook are now contained in b64, while maintaining
compatibility to rstudio.
Fixed some minor issues in rmarkdown format.
@grst grst closed this Nov 19, 2017
@grst grst reopened this Nov 19, 2017
@rossant
Copy link
Owner

rossant commented Nov 23, 2017

Thanks for this, it sounds very good! I'm afraid I might not have time to review this carefully in the near future. I'm wondering if there is any watcher here who'd be willing to have a look and even have commit rights on this repository? FWIW I've also been working on another project, https://github.com/podoc/podoc, which might some day replace ipymd. It is still highly experimental. The work that has been done in this PR might be used there as well.

@grst
Copy link
Author

grst commented Nov 23, 2017

Thanks for pointing me to podoc! This looks very interesting and you are very welcome to re-use the code there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants