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

Allow code to be executed in markdown blocks and insert result #1915

Closed
theideasmith opened this issue Nov 22, 2016 · 5 comments
Closed

Allow code to be executed in markdown blocks and insert result #1915

theideasmith opened this issue Nov 22, 2016 · 5 comments

Comments

@theideasmith
Copy link

I was thinking that for researchers who are doing analysis from within jupyter it would be really nice if the results from some computation could be automatically pasted into the textual discussion of the results. Assuming the delimiter & is used

Example
Consider the following function:

from math import sin, pi
def f(x): return sin(x)

Let us now compute &f(pi)& => 0

Here we've actually called a function from within a markdown block and inserted its result in place of the function call.

@takluyver
Copy link
Member

We've discussed this multiple times, and there's an extension that tries to do it. We don't want to implement it in the notebook directly until CommonMark agrees on a decent extension syntax for Markdown, so we're not just introducing extra ad-hoc additions to the markdown syntax.

@theideasmith
Copy link
Author

Ok thanks so much!

On Nov 22, 2016, at 11:53 AM, Thomas Kluyver notifications@github.com wrote:

We've discussed this multiple times, and there's an extension http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/python-markdown/readme.html that tries to do it. We don't want to implement it in the notebook directly until CommonMark agrees on a decent extension syntax for Markdown, so we're not just introducing extra ad-hoc additions to the markdown syntax.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #1915 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AF5Q_CFwKHJqZ4ZTMspDfvAb7yczz8V-ks5rAx4cgaJpZM4K5q33.

@ellisonbg ellisonbg added this to the No Action milestone Dec 23, 2016
@gnestor
Copy link
Contributor

gnestor commented Apr 27, 2017

One other option is to use IPython.display.Markdown in a code cell:

image

from IPython.display import Markdown

one = 1
two = 2
three = one + two

Markdown("# Title")
Markdown("""
# Math
## Addition
Here is a simple addition example: {one} + {two} = {three}
""".format(one=one, two=two, three=three))

There is an active discussion happening on ipython (ipython/ipython#2958) so let's close this and move the discussion over there.

@gnestor gnestor closed this as completed Apr 27, 2017
@drorata
Copy link

drorata commented Feb 22, 2018

@takluyver Is there any update from the CommonMark front?

@kitaev-chen
Copy link

I think you need this:

neuron for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=neuron.neuron-IPE
https://www.youtube.com/watch?v=amuV0z9eVg4

it's powerful but still a little bit hard to use. hopefully, it can be better in the future so we can write jupyter notebook in vs code.

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

No branches or pull requests

6 participants