[IPython-User] Python code in a markdown cell

Brian Granger ellisonbg@gmail....
Tue Apr 10 13:20:36 CDT 2012


On Tue, Apr 10, 2012 at 9:27 AM, Michael Hadmack <hadmack@gmail.com> wrote:
> Thanks for your response Brian.  As far as i'm concerned the Markdown fields
> shouldn't update anything unless you execute that cell.  Although it would
> be preferable for the original python to be retained in whatever markup so
> that it can be re-executed later, much like how LaTeX is handled now.  I
> have looked into extending the IPython markdown parsing system but it seems
> to be a borrowed JS library full of regex black magic.  Are there any plans
> to re-implement the parser in pure python to be called from JS in the
> notebook and be extendable?

Definitely not.  The whole benefit of markdown is that it can be
rendered in the browser without an extra hit to the server.  This
keeps the notebook zippy quick for editing/rendering markdown.  I
think that whatever solution we come up with will have to play well
with Markdown.  Most likely, we can make a pass with our own custom
rendered before the markdown rendered is run.  But there is a serious
problem with this.  We want our markdown to be true markdown that can
be rendered by anyone with any compliant renderer.  This is a tough
problem.

Cheers,

Brian

> -Mike
>
>
> On Tue, Apr 10, 2012 at 5:51 AM, Brian Granger <ellisonbg@gmail.com> wrote:
>>
>> Mike,
>>
>> We have thought about this, but don't have a solution yet.  There are
>> some subtle issues involved, especially if you want to keep the field
>> updated as the corresponding python object changes.
>>
>> Cheers,
>>
>> Brian
>>
>> On Mon, Apr 9, 2012 at 3:36 PM, Michael Hadmack <hadmack@hawaii.edu>
>> wrote:
>> > Hi All,
>> >
>> > Is there a way that you can execute python code from within a markdown
>> > cell?
>> >  For example I want to refer to the value a result from an earlier
>> > python
>> > cell from within my markdown text.  Presently I just copy and paste but
>> > I
>> > would like to do this dynamically.  Really what I suppose is needed is a
>> > new
>> > markdown tag that will pass the contents to IPython.display() via
>> > Javascript??.  Thanks.
>> >
>> > -Mike
>> >
>> >
>> > _______________________________________________
>> > IPython-User mailing list
>> > IPython-User@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/ipython-user
>> >
>>
>>
>>
>> --
>> Brian E. Granger
>> Cal Poly State University, San Luis Obispo
>> bgranger@calpoly.edu and ellisonbg@gmail.com
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com


More information about the IPython-User mailing list