Sphinx extension to build Notion pages.
Project description
Notion Builder for Sphinx
Builder for Sphinx which enables publishing documentation to Notion.
See a sample document source and the published Notion page for an example of what it can do.
Installation
sphinx-notionbuilder is compatible with Python 3.11+.
$ pip install sphinx-notionbuilder
Add the following to conf.py to enable the extension:
"""Configuration for Sphinx."""
extensions = ["sphinx_notion"]
sphinx-notionbuilder also works with a variety of Sphinx extensions:
See a sample document source and the published Notion page for an example of each of these.
To set these up, install the extensions you want to use and add them to your conf.py, before sphinx_notion:
"""Configuration for Sphinx."""
extensions = [
"atsphinx.audioplayer",
"sphinx.ext.mathjax",
"sphinx_iframes",
"sphinx_immaterial.task_lists",
"sphinx_simplepdf",
"sphinx_toolbox.collapse",
"sphinx_toolbox.rest_example",
"sphinxcontrib.video",
"sphinxcontrib_text_styles",
"sphinxnotes.strike",
"sphinx_notion",
]
Supported Notion Block Types
The following syntax is supported:
Headers
Bulleted lists
TODO lists (with checkboxes)
Code blocks
Table of contents
Block quotes
Callouts
Collapsible sections (using the collapse directive from sphinx-toolbox )
Rest-example blocks (using the rest-example directive from sphinx-toolbox )
Images (with URLs or local paths)
Videos (with URLs or local paths)
Audio (with URLs or local paths)
PDFs (with URLs or local paths)
Embed blocks (using the iframe directive from sphinx-iframes )
Tables
Strikethrough text (using the strike role from sphinxnotes-strike )
Colored text and text styles (bold, italic, monospace) (using various roles from sphinxcontrib-text-styles )
Mathematical equations (inline and block-level, using the math role and directive from sphinx.ext.mathjax )
See a sample document source and the published Notion page.
All of these can be used in a way which means your documentation can still be rendered to HTML.
Unsupported Notion Block Types
Bookmark
Breadcrumb
Child database
Child page
Column and column list
Divider
File
Link preview
Mention
Synced block
Template
Heading with is_toggleable set to True
Uploading Documentation to Notion
Build documentation with the notion builder. For eaxmple:
$ sphinx-build -W -b notion source build/notion
After building your documentation with the Notion builder, you can upload it to Notion using the included command-line tool.
Prerequisites
Create a Notion integration at notion-integrations
Get your integration token and set it as an environment variable:
$ export NOTION_TOKEN="your_integration_token_here"
Usage
# The JSON file will be in the build directory, e.g. ./build/notion/index.json
$ notion-upload --file path/to/output.json --parent-page-id parent_page_id --title "Page Title"
Or with a database parent:
$ notion-upload --file path/to/output.json --parent-database-id parent_database_id --title "Page Title"
Arguments:
--file: Path to the JSON file generated by the Notion builder
--parent-page-id: The ID of the parent page in Notion (must be shared with your integration) - mutually exclusive with --parent-database-id
--parent-database-id: The ID of the parent database in Notion (must be shared with your integration) - mutually exclusive with --parent-page-id
--title: Title for the new page in Notion
The command will create a new page if one with the given title doesn’t exist, or update the existing page if one with the given title already exists.
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 sphinx_notionbuilder-2025.10.24.2.tar.gz.
File metadata
- Download URL: sphinx_notionbuilder-2025.10.24.2.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae43fcf9d1e9c1a2b1034fb1d4b50154d8024e8ad78d0d1546c2140318d55ce6
|
|
| MD5 |
2a37996dd8bb4daf107ead64ceee7158
|
|
| BLAKE2b-256 |
0fc84792702dc5c6f024fad7cc854d556384fb43e9261108196f1f2fbf64a104
|
Provenance
The following attestation bundles were made for sphinx_notionbuilder-2025.10.24.2.tar.gz:
Publisher:
release.yml on adamtheturtle/sphinx-notionbuilder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_notionbuilder-2025.10.24.2.tar.gz -
Subject digest:
ae43fcf9d1e9c1a2b1034fb1d4b50154d8024e8ad78d0d1546c2140318d55ce6 - Sigstore transparency entry: 638393962
- Sigstore integration time:
-
Permalink:
adamtheturtle/sphinx-notionbuilder@04e342dfce097caf5ca4ba5f8c8711c7bbc1387a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@04e342dfce097caf5ca4ba5f8c8711c7bbc1387a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sphinx_notionbuilder-2025.10.24.2-py2.py3-none-any.whl.
File metadata
- Download URL: sphinx_notionbuilder-2025.10.24.2-py2.py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5947ad9df8631850e0b047ba6fc051603b64b317e8b4f884479b11fa7269354c
|
|
| MD5 |
d092efebe59b4bfad4571a7f3158dd89
|
|
| BLAKE2b-256 |
eb2cf671b5a06f7fdb56c8aa327d2886e31b1a5debf2e402a3bcaf73799f7b61
|
Provenance
The following attestation bundles were made for sphinx_notionbuilder-2025.10.24.2-py2.py3-none-any.whl:
Publisher:
release.yml on adamtheturtle/sphinx-notionbuilder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_notionbuilder-2025.10.24.2-py2.py3-none-any.whl -
Subject digest:
5947ad9df8631850e0b047ba6fc051603b64b317e8b4f884479b11fa7269354c - Sigstore transparency entry: 638393985
- Sigstore integration time:
-
Permalink:
adamtheturtle/sphinx-notionbuilder@04e342dfce097caf5ca4ba5f8c8711c7bbc1387a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@04e342dfce097caf5ca4ba5f8c8711c7bbc1387a -
Trigger Event:
workflow_dispatch
-
Statement type: