Jupyter
Hextra Jupyter Notebook renderer shortcode.
1 minute read
Renders a Jupyter Notebook (.ipynb) as code blocks and Markdown cells.
{{% hextra/jupyter "example-notebook.ipynb" %}}
Parameters:
| Parameter | Description | Default |
|---|---|---|
| positional | Path or URL to the .ipynb file | (required) |
allowUnsafeHTML | Set to "true" to render raw HTML from notebook outputs | false |
filename | Optional filename to display as a header | (none) |
Example:
Sample Notebook 🔗
This Jupyter notebook demonstrates how the hextra/jupyter shortcode renders notebook cells.
It supports Markdown cells, code cells with syntax highlighting, and cell outputs.
# A simple Python greeting
message = "Hello from the Academy!"
print(message)
Hello from the Academy!
# Generate Fibonacci numbers
def fibonacci(n):
a, b = 0, 1
result = []
for _ in range(n):
a, b = b, a + b
result.append(a)
return result
fibonacci(10)
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
Summary 🔗
The notebook shortcode renders each cell in sequence:
- Markdown cells are rendered as formatted text.
- Code cells are displayed as syntax-highlighted code blocks.
- Outputs (stream text and execution results) appear below their code cells.