jupyterlab-markdown-insert-content-extension 1.0.21__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jupyterlab_markdown_insert_content_extension-1.0.21/.claude/CLAUDE.md +36 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.claude/JOURNAL.md +35 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.claude/settings.local.json +16 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.copier-answers.yml +16 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.git +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.gitignore +128 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.prettierignore +6 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.resources/screenshot-menu.png +0 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.resources/screenshot-settings.png +0 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.resources/screenshot-toc.png +0 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/.yarnrc.yml +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/CHANGELOG.md +5 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/LICENSE +29 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/Makefile +118 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/PKG-INFO +177 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/README.md +122 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/RELEASE.md +80 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/babel.config.js +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/install.json +5 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jest.config.js +28 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/__init__.py +16 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/_version.py +4 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/package.json +202 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/schemas/jupyterlab_markdown_insert_content_extension/package.json.orig +197 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/schemas/jupyterlab_markdown_insert_content_extension/plugin.json +24 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/static/509.dadb8b0531cc246d3a34.js +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/static/728.1fca5e64a579e80f94a6.js +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/static/remoteEntry.21a8f7175f43b3f3bb39.js +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/static/style.js +4 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/jupyterlab_markdown_insert_content_extension/labextension/static/third-party-licenses.json +16 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/package-lock.json +10674 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/package.json +197 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/pyproject.toml +77 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/schema/plugin.json +24 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/setup.py +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/src/__tests__/jupyterlab_markdown_insert_content_extension.spec.ts +9 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/src/index.ts +288 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/style/base.css +5 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/style/index.css +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/style/index.js +1 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/tsconfig.json +25 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/tsconfig.test.json +3 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/README.md +167 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/jupyter_server_test_config.py +12 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/package.json +15 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/playwright.config.js +14 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/tests/jupyterlab_markdown_insert_content_extension.spec.ts +25 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/ui-tests/yarn.lock +0 -0
- jupyterlab_markdown_insert_content_extension-1.0.21/yarn.lock +9940 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!-- Import workspace-level CLAUDE.md configuration -->
|
|
2
|
+
<!-- See /home/lab/workspace/.claude/CLAUDE.md for complete rules -->
|
|
3
|
+
|
|
4
|
+
# Project-Specific Configuration
|
|
5
|
+
|
|
6
|
+
This file extends workspace-level configuration with project-specific rules.
|
|
7
|
+
|
|
8
|
+
## Project Context
|
|
9
|
+
|
|
10
|
+
**Project**: JupyterLab Markdown Insert Content Extension
|
|
11
|
+
**Type**: JupyterLab extension (TypeScript/Python hybrid)
|
|
12
|
+
**Purpose**: Extension for inserting reusable content blocks into markdown cells in JupyterLab
|
|
13
|
+
|
|
14
|
+
### Technology Stack
|
|
15
|
+
|
|
16
|
+
- JupyterLab 4.x extension framework
|
|
17
|
+
- TypeScript for frontend components
|
|
18
|
+
- Python for backend server extension
|
|
19
|
+
- npm/yarn for JavaScript dependency management
|
|
20
|
+
- jlpm for JupyterLab-specific tooling
|
|
21
|
+
- pytest for Python testing
|
|
22
|
+
|
|
23
|
+
### Naming Conventions
|
|
24
|
+
|
|
25
|
+
- Package name: `jupyterlab_markdown_insert_content_extension`
|
|
26
|
+
- Repository naming follows pattern: `jupyterlab_<feature>_extension`
|
|
27
|
+
- Python module uses underscores
|
|
28
|
+
- TypeScript/JavaScript uses camelCase for variables, PascalCase for classes
|
|
29
|
+
|
|
30
|
+
### Development Workflow
|
|
31
|
+
|
|
32
|
+
- Use `jlpm` command for package management (JupyterLab's wrapper around yarn)
|
|
33
|
+
- Development install: `pip install -e .`
|
|
34
|
+
- Build frontend: `jlpm build`
|
|
35
|
+
- Watch mode: `jlpm watch`
|
|
36
|
+
- Standard JupyterLab extension structure with `src/` and `style/` directories
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Claude Code Journal
|
|
2
|
+
|
|
3
|
+
This journal tracks substantive work on documents, diagrams, and documentation content.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
1. **Task - Project initialization and configuration**: Set up project-level Claude configuration by creating `.claude/CLAUDE.md` with project context for JupyterLab extension development and `.claude/JOURNAL.md` for tracking substantive work<br>
|
|
8
|
+
**Result**: Established local configuration importing workspace-level rules with technology stack details (JupyterLab 4.x, TypeScript, Python), naming conventions, and development workflow guidelines
|
|
9
|
+
|
|
10
|
+
2. **Task - TOC generation research**: Analyzed jupyterlab_markdown_viewer_toc_fix repository to understand JupyterLab's TOC mechanisms, markdown anchor generation, and navigation patterns<br>
|
|
11
|
+
**Result**: Documented findings on JupyterLab's TOC system including heading extraction, anchor ID generation rules (initially assumed GitHub-style lowercase), sanitizer behavior with data-jupyter-id attributes, and TableOfContentsUtils API usage
|
|
12
|
+
|
|
13
|
+
3. **Task - Core TOC insertion implementation**: Implemented table of contents insertion feature with heading extraction, anchor ID generation, and cursor-aware insertion for both markdown file editors and notebook cells<br>
|
|
14
|
+
**Result**: Created complete TOC insertion functionality in src/index.ts with context menu integration, dual-mode operation (file editor and notebook), hierarchical indentation (2 spaces per level), and proper markdown link formatting
|
|
15
|
+
|
|
16
|
+
4. **Task - Settings system implementation**: Added configurable settings for TOC generation including caption text and maximum heading level with JupyterLab settings registry integration<br>
|
|
17
|
+
**Result**: Created schema/plugin.json with validation rules, implemented ISettingRegistry integration with live updates, and established defaults (tocCaption: "## Table of Contents", tocMaxLevel: 6) with settings accessible via JupyterLab Settings Editor
|
|
18
|
+
|
|
19
|
+
5. **Task - Code block filtering enhancement**: Enhanced heading extraction to exclude headings within fenced code blocks (``` and ~~~) to prevent false positives in generated TOC<br>
|
|
20
|
+
**Result**: Implemented state tracking in extractHeadings function to toggle inCodeBlock flag and skip lines within code fence boundaries, preventing code examples from appearing in table of contents
|
|
21
|
+
|
|
22
|
+
6. **Task - Anchor ID generation correction**: Fixed anchor ID generation to match JupyterLab's actual format which preserves Title-Case and special characters rather than GitHub-style lowercase<br>
|
|
23
|
+
**Result**: Updated generateHeadingId function to preserve case and special characters (colons, commas, parentheses), replace only spaces with hyphens, and remove trailing pilcrow symbols (¶), ensuring generated links match JupyterLab's data-jupyter-id attributes exactly (e.g., "Technology Decision Summary¶" -> "Technology-Decision-Summary")
|
|
24
|
+
|
|
25
|
+
7. **Task - Version and release preparation**: Incremented version from 0.1.0 to 1.0.18 marking production readiness with all core features implemented and tested<br>
|
|
26
|
+
**Result**: Updated package.json version to 1.0.18 with complete feature set including TOC insertion, settings integration, code block filtering, and JupyterLab-compatible anchor generation ready for deployment
|
|
27
|
+
|
|
28
|
+
8. **Task - Settings default adjustment**: Changed default maximum heading level from 6 to 3 for more focused table of contents generation<br>
|
|
29
|
+
**Result**: Updated schema/plugin.json and src/index.ts to set tocMaxLevel default to 3, limiting TOC to H1-H3 headings by default while maintaining user configurability (1-6 range)
|
|
30
|
+
|
|
31
|
+
9. **Task - README documentation update**: Rewrote README.md following modus primaris principles with features listed first, all standard badges, and integrated screenshots<br>
|
|
32
|
+
**Result**: Created flowing narrative documentation with GitHub Actions, npm, PyPI, and download badges, prominent features section with bullet points, concise usage instructions, and three screenshots (.resources/screenshot-menu.png, screenshot-toc.png, screenshot-settings.png) showing context menu, generated TOC output, and settings interface with brief explanatory text before each image
|
|
33
|
+
|
|
34
|
+
10. **Task - GitHub Actions workflow update**: Replaced default workflow files with production-ready configurations from jupyterlab_markdown_viewer_toc_fix reference implementation<br>
|
|
35
|
+
**Result**: Created six workflow files - build.yml (CI with lint, test, build, package, isolated test, and integration tests), check-release.yml (release validation), enforce-label.yml (PR label enforcement), prep-release.yml (manual release preparation), publish-release.yml (two-step release publishing with npm/PyPI), and update-integration-tests.yml (Playwright snapshot updates via PR comments) with proper package naming jupyterlab_markdown_insert_content_extension throughout
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(jlpm build:*)",
|
|
5
|
+
"Bash(jlpm install:*)",
|
|
6
|
+
"Bash(git remote:*)",
|
|
7
|
+
"Bash(git add:*)",
|
|
8
|
+
"Bash(git commit:*)",
|
|
9
|
+
"Bash(git push:*)",
|
|
10
|
+
"Bash(jlpm run lint:fix:*)",
|
|
11
|
+
"Bash(jlpm prettier:*)"
|
|
12
|
+
],
|
|
13
|
+
"deny": [],
|
|
14
|
+
"ask": []
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: v4.5.0
|
|
3
|
+
_src_path: https://github.com/jupyterlab/extension-template
|
|
4
|
+
author_email: konrad.jelen@gmail.com
|
|
5
|
+
author_name: Stellars Henson
|
|
6
|
+
has_ai_rules: false
|
|
7
|
+
has_binder: false
|
|
8
|
+
has_settings: false
|
|
9
|
+
kind: frontend
|
|
10
|
+
labextension_name: jupyterlab_markdown_insert_content_extension
|
|
11
|
+
project_short_description: Jupyterlab extension to automatically insert content into
|
|
12
|
+
markdown - such as TOC, bibliography, list of figures etc.
|
|
13
|
+
python_name: jupyterlab_markdown_insert_content_extension
|
|
14
|
+
repository: ''
|
|
15
|
+
test: true
|
|
16
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitdir: ../../../.git/modules/private/jupyterlab/jupyterlab_markdown_insert_content_extension
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
*.bundle.*
|
|
2
|
+
lib/
|
|
3
|
+
node_modules/
|
|
4
|
+
*.log
|
|
5
|
+
.eslintcache
|
|
6
|
+
.stylelintcache
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.ipynb_checkpoints
|
|
9
|
+
*.tsbuildinfo
|
|
10
|
+
jupyterlab_markdown_insert_content_extension/labextension
|
|
11
|
+
# Version file is handled by hatchling
|
|
12
|
+
jupyterlab_markdown_insert_content_extension/_version.py
|
|
13
|
+
|
|
14
|
+
# Integration tests
|
|
15
|
+
ui-tests/test-results/
|
|
16
|
+
ui-tests/playwright-report/
|
|
17
|
+
|
|
18
|
+
# Created by https://www.gitignore.io/api/python
|
|
19
|
+
# Edit at https://www.gitignore.io/?templates=python
|
|
20
|
+
|
|
21
|
+
### Python ###
|
|
22
|
+
# Virtual environments
|
|
23
|
+
.venv
|
|
24
|
+
|
|
25
|
+
# Byte-compiled / optimized / DLL files
|
|
26
|
+
__pycache__/
|
|
27
|
+
*.py[cod]
|
|
28
|
+
*$py.class
|
|
29
|
+
|
|
30
|
+
# C extensions
|
|
31
|
+
*.so
|
|
32
|
+
|
|
33
|
+
# Distribution / packaging
|
|
34
|
+
.Python
|
|
35
|
+
build/
|
|
36
|
+
develop-eggs/
|
|
37
|
+
dist/
|
|
38
|
+
downloads/
|
|
39
|
+
eggs/
|
|
40
|
+
.eggs/
|
|
41
|
+
lib/
|
|
42
|
+
lib64/
|
|
43
|
+
parts/
|
|
44
|
+
sdist/
|
|
45
|
+
var/
|
|
46
|
+
wheels/
|
|
47
|
+
pip-wheel-metadata/
|
|
48
|
+
share/python-wheels/
|
|
49
|
+
.installed.cfg
|
|
50
|
+
*.egg
|
|
51
|
+
MANIFEST
|
|
52
|
+
|
|
53
|
+
# PyInstaller
|
|
54
|
+
# Usually these files are written by a python script from a template
|
|
55
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
56
|
+
*.manifest
|
|
57
|
+
*.spec
|
|
58
|
+
|
|
59
|
+
# Installer logs
|
|
60
|
+
pip-log.txt
|
|
61
|
+
pip-delete-this-directory.txt
|
|
62
|
+
|
|
63
|
+
# Unit test / coverage reports
|
|
64
|
+
htmlcov/
|
|
65
|
+
.tox/
|
|
66
|
+
.nox/
|
|
67
|
+
.coverage
|
|
68
|
+
.coverage.*
|
|
69
|
+
.cache
|
|
70
|
+
nosetests.xml
|
|
71
|
+
coverage/
|
|
72
|
+
coverage.xml
|
|
73
|
+
*.cover
|
|
74
|
+
.hypothesis/
|
|
75
|
+
.pytest_cache/
|
|
76
|
+
|
|
77
|
+
# Translations
|
|
78
|
+
*.mo
|
|
79
|
+
*.pot
|
|
80
|
+
|
|
81
|
+
# Scrapy stuff:
|
|
82
|
+
.scrapy
|
|
83
|
+
|
|
84
|
+
# Sphinx documentation
|
|
85
|
+
docs/_build/
|
|
86
|
+
|
|
87
|
+
# PyBuilder
|
|
88
|
+
target/
|
|
89
|
+
|
|
90
|
+
# pyenv
|
|
91
|
+
.python-version
|
|
92
|
+
|
|
93
|
+
# celery beat schedule file
|
|
94
|
+
celerybeat-schedule
|
|
95
|
+
|
|
96
|
+
# SageMath parsed files
|
|
97
|
+
*.sage.py
|
|
98
|
+
|
|
99
|
+
# Spyder project settings
|
|
100
|
+
.spyderproject
|
|
101
|
+
.spyproject
|
|
102
|
+
|
|
103
|
+
# Rope project settings
|
|
104
|
+
.ropeproject
|
|
105
|
+
|
|
106
|
+
# Mr Developer
|
|
107
|
+
.mr.developer.cfg
|
|
108
|
+
.project
|
|
109
|
+
.pydevproject
|
|
110
|
+
|
|
111
|
+
# mkdocs documentation
|
|
112
|
+
/site
|
|
113
|
+
|
|
114
|
+
# mypy
|
|
115
|
+
.mypy_cache/
|
|
116
|
+
.dmypy.json
|
|
117
|
+
dmypy.json
|
|
118
|
+
|
|
119
|
+
# Pyre type checker
|
|
120
|
+
.pyre/
|
|
121
|
+
|
|
122
|
+
# End of https://www.gitignore.io/api/python
|
|
123
|
+
|
|
124
|
+
# OSX files
|
|
125
|
+
.DS_Store
|
|
126
|
+
|
|
127
|
+
# Yarn cache
|
|
128
|
+
.yarn/
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Stellars Henson
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Makefile for Jupyterlab extensions version 1.26
|
|
2
|
+
# author: Stellars Henson <konrad.jelen@gmail.com>
|
|
3
|
+
# License: MIT Open Source License
|
|
4
|
+
|
|
5
|
+
.PHONY: build install clean uninstall publish dependencies mrproper increment_version install_dependencies check_dependencies upgrade help
|
|
6
|
+
.DEFAULT_GOAL := help
|
|
7
|
+
|
|
8
|
+
# Read current version from package.json (only if node is available)
|
|
9
|
+
VERSION := $(shell command -v node >/dev/null 2>&1 && node -p "require('./package.json').version" || echo "0.0.0")
|
|
10
|
+
|
|
11
|
+
## increment project version
|
|
12
|
+
increment_version:
|
|
13
|
+
@echo "Current version: $(VERSION)"
|
|
14
|
+
@bash -c 'CURRENT_VERSION=$(VERSION); \
|
|
15
|
+
IFS="." read -r major minor patch <<< "$$CURRENT_VERSION"; \
|
|
16
|
+
NEW_PATCH=$$((patch + 1)); \
|
|
17
|
+
NEW_VERSION="$$major.$$minor.$$NEW_PATCH"; \
|
|
18
|
+
echo "New version: $$NEW_VERSION"; \
|
|
19
|
+
sed -i "s/\"version\": \"$$CURRENT_VERSION\"/\"version\": \"$$NEW_VERSION\"/" package.json; '
|
|
20
|
+
|
|
21
|
+
## build packages
|
|
22
|
+
build: clean increment_version check_dependencies
|
|
23
|
+
npm install
|
|
24
|
+
yarn install
|
|
25
|
+
python -m build
|
|
26
|
+
|
|
27
|
+
## install package
|
|
28
|
+
install: build
|
|
29
|
+
pip install dist/*.whl --force-reinstall
|
|
30
|
+
|
|
31
|
+
## clean builds and installables
|
|
32
|
+
clean: uninstall check_dependencies
|
|
33
|
+
@command -v npm >/dev/null 2>&1 && npm run clean || true
|
|
34
|
+
@command -v npm >/dev/null 2>&1 && npm run clean:labextension || true
|
|
35
|
+
rm -rf dist lib || true
|
|
36
|
+
|
|
37
|
+
## uninstall package
|
|
38
|
+
uninstall: check_dependencies
|
|
39
|
+
pip uninstall -y dist/*.whl 2>/dev/null || true
|
|
40
|
+
|
|
41
|
+
## check if required dependencies are installed
|
|
42
|
+
check_dependencies:
|
|
43
|
+
@echo "Checking dependencies..."
|
|
44
|
+
@MISSING=""; \
|
|
45
|
+
command -v node >/dev/null 2>&1 || MISSING="$$MISSING node"; \
|
|
46
|
+
command -v npm >/dev/null 2>&1 || MISSING="$$MISSING npm"; \
|
|
47
|
+
command -v yarn >/dev/null 2>&1 || MISSING="$$MISSING yarn"; \
|
|
48
|
+
command -v twine >/dev/null 2>&1 || MISSING="$$MISSING twine"; \
|
|
49
|
+
if [ -n "$$MISSING" ]; then \
|
|
50
|
+
echo "Missing dependencies:$$MISSING"; \
|
|
51
|
+
echo "Installing missing dependencies..."; \
|
|
52
|
+
$(MAKE) install_dependencies; \
|
|
53
|
+
else \
|
|
54
|
+
echo "All dependencies are installed."; \
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
## publish package to public repository
|
|
58
|
+
publish: check_dependencies install
|
|
59
|
+
npm publish --access public
|
|
60
|
+
twine upload dist/*
|
|
61
|
+
|
|
62
|
+
## install all required build dependencies
|
|
63
|
+
install_dependencies:
|
|
64
|
+
conda install -y nodejs yarn --update-all
|
|
65
|
+
pip install twine
|
|
66
|
+
npm install rimraf
|
|
67
|
+
|
|
68
|
+
## upgrade all npm and yarn dependencies
|
|
69
|
+
upgrade: check_dependencies
|
|
70
|
+
jlpm up
|
|
71
|
+
|
|
72
|
+
## cleanup all build and metabuild artefacts
|
|
73
|
+
mrproper: clean uninstall
|
|
74
|
+
rm -rf node_modules .yarn || true
|
|
75
|
+
|
|
76
|
+
## prints the list of available commands
|
|
77
|
+
help:
|
|
78
|
+
@echo ""
|
|
79
|
+
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
|
|
80
|
+
@sed -n -e "/^## / { \
|
|
81
|
+
h; \
|
|
82
|
+
s/.*//; \
|
|
83
|
+
:doc" \
|
|
84
|
+
-e "H; \
|
|
85
|
+
n; \
|
|
86
|
+
s/^## //; \
|
|
87
|
+
t doc" \
|
|
88
|
+
-e "s/:.*//; \
|
|
89
|
+
G; \
|
|
90
|
+
s/\\n## /---/; \
|
|
91
|
+
s/\\n/ /g; \
|
|
92
|
+
p; \
|
|
93
|
+
}" ${MAKEFILE_LIST} \
|
|
94
|
+
| LC_ALL='C' sort --ignore-case \
|
|
95
|
+
| awk -F '---' \
|
|
96
|
+
-v ncol=$$(tput cols) \
|
|
97
|
+
-v indent=19 \
|
|
98
|
+
-v col_on="$$(tput setaf 6)" \
|
|
99
|
+
-v col_off="$$(tput sgr0)" \
|
|
100
|
+
'{ \
|
|
101
|
+
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
|
|
102
|
+
n = split($$2, words, " "); \
|
|
103
|
+
line_length = ncol - indent; \
|
|
104
|
+
for (i = 1; i <= n; i++) { \
|
|
105
|
+
line_length -= length(words[i]) + 1; \
|
|
106
|
+
if (line_length <= 0) { \
|
|
107
|
+
line_length = ncol - indent - length(words[i]) - 1; \
|
|
108
|
+
printf "\n%*s ", -indent, " "; \
|
|
109
|
+
} \
|
|
110
|
+
printf "%s ", words[i]; \
|
|
111
|
+
} \
|
|
112
|
+
printf "\n"; \
|
|
113
|
+
}'
|
|
114
|
+
@echo ""
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# EOF
|
|
118
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jupyterlab_markdown_insert_content_extension
|
|
3
|
+
Version: 1.0.21
|
|
4
|
+
Summary: Jupyterlab extension to automatically insert content into markdown - such as TOC, bibliography, list of figures etc.
|
|
5
|
+
Project-URL: Homepage, https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension.git
|
|
8
|
+
Author-email: Stellars Henson <konrad.jelen@gmail.com>
|
|
9
|
+
License: BSD 3-Clause License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2025, Stellars Henson
|
|
12
|
+
All rights reserved.
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without
|
|
15
|
+
modification, are permitted provided that the following conditions are met:
|
|
16
|
+
|
|
17
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
18
|
+
list of conditions and the following disclaimer.
|
|
19
|
+
|
|
20
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer in the documentation
|
|
22
|
+
and/or other materials provided with the distribution.
|
|
23
|
+
|
|
24
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
25
|
+
contributors may be used to endorse or promote products derived from
|
|
26
|
+
this software without specific prior written permission.
|
|
27
|
+
|
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
29
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
30
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
31
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
32
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
33
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
34
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
35
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
36
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
37
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Keywords: jupyter,jupyterlab,jupyterlab-extension
|
|
40
|
+
Classifier: Framework :: Jupyter
|
|
41
|
+
Classifier: Framework :: Jupyter :: JupyterLab
|
|
42
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: 4
|
|
43
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
|
|
44
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
|
|
45
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
46
|
+
Classifier: Programming Language :: Python
|
|
47
|
+
Classifier: Programming Language :: Python :: 3
|
|
48
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
53
|
+
Requires-Python: >=3.9
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
# jupyterlab_markdown_insert_content_extension
|
|
57
|
+
|
|
58
|
+
[](https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension/actions/workflows/build.yml)
|
|
59
|
+
[](https://www.npmjs.com/package/jupyterlab_markdown_insert_content_extension)
|
|
60
|
+
[](https://pypi.org/project/jupyterlab_markdown_insert_content_extension/)
|
|
61
|
+
[](https://pepy.tech/project/jupyterlab_markdown_insert_content_extension)
|
|
62
|
+
[](https://jupyterlab.readthedocs.io/en/stable/)
|
|
63
|
+
|
|
64
|
+
JupyterLab extension for inserting reusable content blocks into markdown files and notebook cells, starting with automatic table of contents generation.
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Context menu integration** - right-click in markdown editors or notebook cells to insert content
|
|
69
|
+
- **Table of contents generation** - automatically extracts headings and creates hierarchical TOC with working anchor links
|
|
70
|
+
- **Configurable settings** - customize TOC caption and maximum heading depth through JupyterLab settings
|
|
71
|
+
- **Code block filtering** - excludes headings within fenced code blocks from TOC
|
|
72
|
+
- **JupyterLab-compatible anchors** - generates anchor IDs matching JupyterLab's format for reliable navigation
|
|
73
|
+
- **Dual mode support** - works in both markdown file editors and notebook markdown cells
|
|
74
|
+
- **Cursor-aware insertion** - inserts content at current cursor position
|
|
75
|
+
|
|
76
|
+
Right-click in markdown editor or notebook cell to access the context menu:
|
|
77
|
+
|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
Generated table of contents with hierarchical structure and working anchor links:
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
Configure TOC caption and maximum heading level through JupyterLab settings:
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
- JupyterLab >= 4.0.0
|
|
91
|
+
|
|
92
|
+
## Install
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install jupyterlab_markdown_insert_content_extension
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
### Insert Table of Contents
|
|
101
|
+
|
|
102
|
+
1. Open a markdown file or create a markdown cell in a notebook
|
|
103
|
+
2. Position cursor where you want the TOC inserted
|
|
104
|
+
3. Right-click and select "Insert Table of Contents"
|
|
105
|
+
4. TOC is generated with links to all headings in the document
|
|
106
|
+
|
|
107
|
+
### Configure Settings
|
|
108
|
+
|
|
109
|
+
Access settings through Settings -> Settings Editor -> Markdown Insert Content:
|
|
110
|
+
|
|
111
|
+
- **TOC Caption** - markdown content inserted before TOC list (default: `## Table of Contents`)
|
|
112
|
+
- **Maximum Heading Level** - deepest heading level to include (1-6, default: 3)
|
|
113
|
+
|
|
114
|
+
Settings apply immediately without restart.
|
|
115
|
+
|
|
116
|
+
## Uninstall
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip uninstall jupyterlab_markdown_insert_content_extension
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
### Development install
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Clone repository
|
|
128
|
+
git clone https://github.com/stellarshenson/jupyterlab_markdown_insert_content_extension.git
|
|
129
|
+
cd jupyterlab_markdown_insert_content_extension
|
|
130
|
+
|
|
131
|
+
# Set up virtual environment
|
|
132
|
+
python -m venv .venv
|
|
133
|
+
source .venv/bin/activate
|
|
134
|
+
pip install --editable "."
|
|
135
|
+
|
|
136
|
+
# Link extension with JupyterLab
|
|
137
|
+
jupyter labextension develop . --overwrite
|
|
138
|
+
|
|
139
|
+
# Build extension
|
|
140
|
+
jlpm install
|
|
141
|
+
jlpm build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Development workflow
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Watch mode - automatically rebuilds on changes
|
|
148
|
+
jlpm watch
|
|
149
|
+
|
|
150
|
+
# In another terminal, run JupyterLab
|
|
151
|
+
jupyter lab
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Refresh JupyterLab after changes to load updated extension.
|
|
155
|
+
|
|
156
|
+
### Development uninstall
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip uninstall jupyterlab_markdown_insert_content_extension
|
|
160
|
+
jupyter labextension list # Find labextensions folder
|
|
161
|
+
# Remove symlink from labextensions folder
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Testing
|
|
165
|
+
|
|
166
|
+
**Frontend tests**:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
jlpm test
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Integration tests**:
|
|
173
|
+
See [ui-tests/README.md](./ui-tests/README.md) for Playwright integration tests.
|
|
174
|
+
|
|
175
|
+
### Packaging
|
|
176
|
+
|
|
177
|
+
See [RELEASE.md](RELEASE.md) for release process.
|