Skip to main content

Jupyterlab extension to automatically insert content into markdown - such as TOC, bibliography, list of figures etc.

Project description

jupyterlab_markdown_insert_content_extension

GitHub Actions npm version PyPI version Total PyPI downloads JupyterLab 4

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

  1. Open a markdown file or create a markdown cell in a notebook
  2. Position cursor where you want the TOC inserted
  3. Right-click and select "Insert Table of Contents"
  4. 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


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file jupyterlab_markdown_insert_content_extension-1.0.40.tar.gz.

File metadata

File hashes

Hashes for jupyterlab_markdown_insert_content_extension-1.0.40.tar.gz
Algorithm Hash digest
SHA256 a015f25e57fb692dba06dc506c32fec1c95ec57a032c0e431f4db6e7f95529de
MD5 5fa57d4eb3124facf6e172320c52b295
BLAKE2b-256 736d3f20475ec2da16ea2c22d9479fa5ff68cd212646a3dde31c301dc18827af

See more details on using hashes here.

File details

Details for the file jupyterlab_markdown_insert_content_extension-1.0.40-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_markdown_insert_content_extension-1.0.40-py3-none-any.whl
Algorithm Hash digest
SHA256 264356a1f56c6af77a9a1ab9acef64705a79157957dc8eca850e70ecd46a1492
MD5 73e7bdf85b1c2197b2f374d85f4ead78
BLAKE2b-256 e07e5b5e848eda5b154c987fe38839713a4c716416330e14fa63fe358e88421c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page