Jupyterlab extension to automatically insert content into markdown - such as TOC, bibliography, list of figures etc.
Project description
jupyterlab_markdown_insert_content_extension
JupyterLab extension for inserting reusable content blocks into markdown files and notebook cells, starting with automatic table of contents generation.
Features
- Context menu integration - right-click in markdown editors or notebook cells to insert content
- Table of contents generation - automatically extracts headings and creates hierarchical TOC with working anchor links
- Configurable settings - customize TOC caption and maximum heading depth through JupyterLab settings
- Code block filtering - excludes headings within fenced code blocks from TOC
- JupyterLab-compatible anchors - generates anchor IDs matching JupyterLab's format for reliable navigation
- Dual mode support - works in both markdown file editors and notebook markdown cells
- Cursor-aware insertion - inserts content at current cursor position
Right-click in markdown editor or notebook cell to access the context menu:
Generated table of contents with hierarchical structure and working anchor links:
Configure TOC caption and maximum heading level through JupyterLab settings:
Requirements
- JupyterLab >= 4.0.0
Install
pip install jupyterlab_markdown_insert_content_extension
Usage
Insert Table of Contents
- Open a markdown file or create a markdown cell in a notebook
- Position cursor where you want the TOC inserted
- Right-click and select "Insert Table of Contents"
- TOC is generated with links to all headings in the document
Configure Settings
Access settings through Settings -> Settings Editor -> Markdown Insert Content:
- TOC Caption - markdown content inserted before TOC list (default:
## Table of Contents) - Maximum Heading Level - deepest heading level to include (1-6, default: 3)
Settings apply immediately without restart.
Uninstall
pip uninstall jupyterlab_markdown_insert_content_extension
Development
Development install
# Clone repository
git clone https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension.git
cd jupyterlab_markdown_insert_content_extension
# Set up virtual environment
python -m venv .venv
source .venv/bin/activate
pip install --editable "."
# Link extension with JupyterLab
jupyter labextension develop . --overwrite
# Build extension
jlpm install
jlpm build
Development workflow
# Watch mode - automatically rebuilds on changes
jlpm watch
# In another terminal, run JupyterLab
jupyter lab
Refresh JupyterLab after changes to load updated extension.
Development uninstall
pip uninstall jupyterlab_markdown_insert_content_extension
jupyter labextension list # Find labextensions folder
# Remove symlink from labextensions folder
Testing
Frontend tests:
jlpm test
Integration tests: See ui-tests/README.md for Playwright integration tests.
Packaging
See RELEASE.md for release process.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyterlab_markdown_insert_content_extension-1.0.21.tar.gz.
File metadata
- Download URL: jupyterlab_markdown_insert_content_extension-1.0.21.tar.gz
- Upload date:
- Size: 803.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9cc6b744a739b58ad7d190041bb827ec50b7013b5c41d6082a52ef0e46d083
|
|
| MD5 |
782c18ddfc8bfa12f90c2d78612ecc83
|
|
| BLAKE2b-256 |
b4ae9cc8f52302fdea2f4b3617f3c3979e75c6ed565cf2e406d2983f913c0ddd
|
File details
Details for the file jupyterlab_markdown_insert_content_extension-1.0.21-py3-none-any.whl.
File metadata
- Download URL: jupyterlab_markdown_insert_content_extension-1.0.21-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2e40f6984652fd88b63ce1c806947d23b4baf0d02211c534ea9865e06bcb68
|
|
| MD5 |
30a5d911bcce91da0c4b53dd8adc8a68
|
|
| BLAKE2b-256 |
ade6aaa6f6cd1c14f7144b88c7cf2be4fceb7348c4916ceffda570c817cc65f3
|