marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.39k stars 158 forks source link

Include html headings in `View outline` #1582

Closed metaboulie closed 3 weeks ago

metaboulie commented 4 weeks ago

Describe the bug

Sometimes I need to put a heading in the center of the output, in this case <h2 align="center">XYZ</h2> is convenience, but in the outline panel, the outline excludes these html headings

Screenshot 2024-06-09 at 14 19 33

Environment

{ "marimo": "0.6.17", "OS": "Darwin", "OS Version": "22.3.0", "Processor": "arm", "Python Version": "3.12.3", "Binaries": { "Browser": "125.0.6422.142", "Node": "v22.2.0" }, "Requirements": { "click": "8.1.7", "importlib-resources": "missing", "jedi": "0.19.1", "markdown": "3.6", "pymdown-extensions": "10.8.1", "pygments": "2.18.0", "tomlkit": "0.12.5", "uvicorn": "0.30.1", "starlette": "0.37.2", "websockets": "12.0", "typing-extensions": "4.12.2", "black": "24.4.2" } }

Code to reproduce

No response

mscolnick commented 3 weeks ago

You need to add an id to the <h1/h2/h3>, otherwise the heading is not clickable/navigate-able.

mo.md("""
# Heading 1

<h2 id="custom">Heading 2</h2>
""")
image