Ipython: Allow references to Python variables in Markdown cells

Created on 20 Feb 2013  Â·  49Comments  Â·  Source: ipython/ipython

In PR #2592 @Carreau has come up with a syntax for referencing Python variables in Markdown cells. It uses the Jinja style {{x}} syntax. We love this idea, but there are some things that have to be worked out:

  • [ ] What syntax do we use? Are we happy with the {{}}
  • [ ] How do we make sure we are processing Markdown in a robust and sane way for latex and literate stuff. We are slowly diverging away from pure Markdown and that is really dangerous. We want the notebook format to work very broadly and having our own Markdown syntax seems like a bad idea.
  • [ ] How to handle errors, i.e., undefined variables.
  • [ ] What do we want to do about other display formats. Seems like a dangerous path to start to allow non-text formats.
closed-pr notebook

Most helpful comment

I think this feature is really important to have for someone who comes from Rmarkdown. R has done a much better job in creating nice reports.

All 49 comments

so,, is this dead? It would be great as the prior thread pointed out? Sorry to bump wish I had the skilz to implement ( I don't) but I sure would use...

Not dead, just need to get a few things done first.

I just asked about this on SO, only to find that it was a double duplicate from here and here.

My 2c would be that

  • Jinja syntax would be great
  • It seems from a quick look that markdown doesn't really have a 'pure', but if all the formatting conventions from a well established implementation ( :octocat: github would be a nice one) were followed then adding an injection method isn't actually a markdown issue.
  • could errors be a user configurable thing? An option of [invisible (nothing happens), the word error, or a dirty great stack trace ]
  • As long as it's a text response then it could be injected before it is passed to the markdown renderer, so it could inject html or even more markdown!

Not to advocate any particular syntax (I think {{}} is fine), but here's comparable design for R: http://www.rstudio.com/ide/docs/authoring/using_markdown (They use ``` as the delimiter).

Lunamark uses