[IPython-dev] round-tripping md -> ipynb -> md

Jonathan Taylor jonathan.taylor at stanford.edu
Sat Mar 26 03:32:09 EDT 2016


The .md is not as good as carefully written .rst but it is a nice way to
"edit" notebooks in which the only distinction is code or not code.

If you want to decorate the cells with metadata as in a slideshow, this is
not going to do it, but at least it provides usual text editing for simple
notebooks where metadata is not an issue.  (I always harp on making slides
because a lot of what I need for teaching and talks is being able to have a
slideshow.)

Since notedown can read .Rmd maybe it can be tricked into slideshows as one
can compile slideshows from .Rmd using knitr so .Rmd files have the logic
of slide breaks.

(Cc'ed the jupyter google group in case this is known and/or there is
something better out there)


On Sat, Mar 26, 2016 at 12:13 AM, Jonathan Taylor <
jonathan.taylor at stanford.edu> wrote:

> For example, Group_LASSO.md is clean with no outputs (
> https://raw.githubusercontent.com/jonathan-taylor/regreg/consolidate_docs/doc/markdown/Group_LASSO.md
> )
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$ notedown
> Group_LASSO.md > tmp.ipynb;
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$ jupyter
> nbconvert --to markdown tmp.ipynb
>
> [NbConvertApp] Converting notebook tmp.ipynb to markdown
>
> [NbConvertApp] Writing 8767 bytes to tmp.md
>
>
> Now, let's do the round trip:
>
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$ notedown tmp.md
> > tmp2.ipynb
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$ jupyter
> nbconvert --to markdown tmp2.ipynb
>
> [NbConvertApp] Converting notebook tmp2.ipynb to markdown
>
> [NbConvertApp] Writing 8767 bytes to tmp2.md
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$ diff tmp.md
> tmp2.md
>
> *~/git-repos/regreg/doc/markdown **(consolidate_docs) *$
>
>
> Of course, if you edit tmp2.ipynb in the notebook, then of course tmp2.md
> will be different, but if you save it having cleared outputs the diff will
> be readable....
>
> On Fri, Mar 25, 2016 at 11:13 PM, Jonathan Taylor <
> jonathan.taylor at stanford.edu> wrote:
>
>> Hi all,
>>
>> Just wanted to say that round-tripping loop for writing and interacting
>> with docs seems to work fairly well. Brett's make system produces .md
>> __with output__ but if you save the .ipynb after having cleared the output
>> then the resulting .md is actually pretty good in limited attempts so far.
>>
>> So, one can write .md in an editor, fire up jupyter to interactively work
>> with the code and then get back to pretty clean .md rather easily.
>>
>> The .md saved with output is less usable for further editing as Brett
>> noted.
>>
>> --
>> Jonathan Taylor
>> Dept. of Statistics
>> Sequoia Hall, 137
>> 390 Serra Mall
>> Stanford, CA 94305
>> Tel:   650.723.9230
>> Fax:   650.725.8977
>> Web: http://www-stat.stanford.edu/~jtaylo
>>
>
>
>
> --
> Jonathan Taylor
> Dept. of Statistics
> Sequoia Hall, 137
> 390 Serra Mall
> Stanford, CA 94305
> Tel:   650.723.9230
> Fax:   650.725.8977
> Web: http://www-stat.stanford.edu/~jtaylo
>



-- 
Jonathan Taylor
Dept. of Statistics
Sequoia Hall, 137
390 Serra Mall
Stanford, CA 94305
Tel:   650.723.9230
Fax:   650.725.8977
Web: http://www-stat.stanford.edu/~jtaylo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160326/14832d90/attachment.html>


More information about the IPython-dev mailing list