aaren / notedown

Markdown <=> IPython Notebook
BSD 2-Clause "Simplified" License
855 stars 115 forks source link

Extract code from markdown file #37

Open vincentqb opened 8 years ago

vincentqb commented 8 years ago

Is there a way of extracting the code chunks directly from notedown?

aaren commented 8 years ago

You mean to strip all of the non code content from a file?

There isn't a way to do that but it wouldn't be difficult to add. It would have to be enabled with a flag. What do you think a good flag name would be?

vincentqb commented 8 years ago

Yes, either stripping or commenting out the non-code content would do. The latter option is what ipython nbconvert does when converting to code.

For the flag, how about "--to code" or "--code" ?

randy3k commented 8 years ago

I suggest to support something like knits-spin http://yihui.name/knitr/demo/stitch/ https://divyup.wordpress.com/2015/07/11/knitr-and-spin-in-r/ Basically, it converts the markdown blocks to special comment lines (with #' starts) and the code block to plain code lines.

And it is more interesting to support the another direction of conversion, i.e., converting documented python, jupyter or R scripts to jupyter notebooks.