Ask Your Question
0

Code and markdown cell

asked 2020-05-09 15:30:22 +0200

Cyrille gravatar image

updated 2020-05-09 16:00:46 +0200

Another perhaps stupid question : can we insert code inside a markdown cell, in such a way it can be evaluated ?

edit retag flag offensive close merge delete

Comments

Do you mean code to be displayed, or code to be evaluated?

slelievre gravatar imageslelievre ( 2020-05-09 15:40:54 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-05-09 15:51:58 +0200

slelievre gravatar image

To display code in a Markdown cell in Jupyter, use single backticks for inline code, triple backticks for code blocks.

For example:

In the next cell we will define `square` by

```
def square(x):
    return x * x
```

will render as

In the next cell we will define square by

def square(x):
    return x * x

Some Jupyter Notebook and JupyterLab extensions allow to evaluate code in a Mardown cell in Jupyter. See:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-09 15:30:22 +0200

Seen: 826 times

Last updated: May 09 '20