Package Exports
- docu-notion-kira
- docu-notion-kira/dist/docu-notion-styles.css
- docu-notion-kira/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (docu-notion-kira) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Description
KIRA's documentation system integrates with docu-notion-kira, a forked version of docu-notion tailored for Kira Network.
Docu-notion allows the use of Notion as the primary editing platform to produce content suitable for static site generators; Docusaurus in this case. This combination meets several challenging requirements, such as automatique deployment, editing workflow features, localization support via Crowdin, and capabilities for both online and offline distribution. Future plans include adding versioning capabilities.
How It Works ?
Docu-notion fetches content from a provided Notion root page and produce a structured folder of markdown-base files of its content. The root page has two main components:
- The Database (Optional) - This is where the documentation pages are stored. They include content and are equipped with workflow properties to facilitate a Kanban-style management process where pages can have metadata that can be leveraged and are published according to their ‘status’.
- The Outline Page (Mandatory) - This is a central Notion page that organizes content hierarchically. It serves as the foundation of the documentation structure. The arrangement of sub-pages within the Outline is directly reflected in the final documentation site and its sidebar navigation. These sub-pages should link back to the relevant documents housed in the database.
Page Structure in the Outline
Blocks listed under the Outline page can be of the following types:
A page level without Index : A page containing child pages or links to database pages, but doesn't have any content.
A page level with Index : A page containing child pages and/or links to database pages, and has content. An index.md will be created and all child pages and link to database page will be stripped out from it.
A link to a database page
Or a standard page with content
The use of the database is optional because pages with content can be directly included in the Outline. However, these pages won't have access to the advanced workflow features provided by the database properties. A level page (a.k.a Category in Docusaurus) function as subsections of the documentation. They are transformed into dropdown menus in the sidebar of the documentation site. If they hold content it will be parsed into an index.md.
Links
Docu-notion automatically identifies and removes blocks that are either child pages or links to pages located at the root level of the page. If you need to include such blocks within your content, they must be embedded within another block type, like a table or a column, or they should be accompanied by some text within the same block to trick this logic.
Custom Pages
Docusaurus automatically generates custom pages from the src/pages
directory, creating corresponding slugs and links. You can create any page within the root page in Notion, for instance naming it "src/page", and manually move these pages into the Docusaurus src/pages
folder as needed. This approach is simpler and easily managed using github workflow.
Note on Conflicts: Pages within src/pages
are prioritized by Docusaurus and can lead to conflicts with pages that have matching slugs elsewhere in the project. E.g. If both an index.md or a page with "/" slug in the main documentation and an "index.js" in src/pages
exist, Docusaurus will prioritize the content in src/pages
, potentially overlooking the index.md.
Custom parsing (Plugins)
Custom parsing logic can be created using plugins. See the plugin readme.
Callouts ➜ Admonitions
To map Notion callouts to Docusaurus admonitions, ensure the icon is for the type you want.
- ℹ️ ➜ note
- 📝➜ note
- 💡➜ tip
- ❗➜ info
- ⚠️➜ caution
- 🔥➜ danger
The default admonition type, if no matching icon is found, is "note".
Setup: Docu-notion-kira + docusaurus
Host specs:
Ubuntu 20.04
Software specs:
- NodeJS
[v21.4.0]
- npm
[v10.2.4]
- yarn
[v1.22.21]
NodeJS installation
- Create a Temporary Directory:
mkdir -p ~/tmp && cd ~/tmp
- Download NodeJS:
wget https://nodejs.org/dist/v21.4.0/node-v21.4.0-linux-x64.tar.xz
Unpack NodeJS and Set Environment Variables:
Use one of the following methods:
Method A (Persistent Environment Variables):
sudo mkdir -p /usr/local/lib/nodejs sudo tar -xJvf node-v21.4.0-linux-x64.tar.xz -C /usr/local/lib/nodejs echo 'export NODEJS_HOME=/usr/local/lib/nodejs/node-v21.4.0-linux-x64' | sudo tee -a /etc/profile echo 'export PATH=$NODEJS_HOME/bin:$PATH' | sudo tee -a /etc/profile source /etc/profile
Method B (Temporary Environment Variables):
sudo mkdir -p /usr/local/lib/nodejs sudo tar -xJvf node-v21.4.0-linux-x64.tar.xz -C /usr/local/lib/nodejs echo 'export NODEJS_HOME=/usr/local/lib/nodejs/node-v21.4.0-linux-x64' | sudo tee -a /etc/profile echo 'export PATH=$NODEJS_HOME/bin:$PATH' | sudo tee -a /etc/profile source /etc/profile
Install yarn:
npm install --global yarn
- Check Installed Versions:
node -v
npm -v
yarn -v
Clone and Prepare Repository for Docusaurus
- Clone the Repository:
cd ~/tmp
git clone https://github.com/kmlbgn/docs.kira.network.git
- Set Notion API Token and Root Page:
- Replace *** with your Notion token and root page ID.
- Set Environment Variables:
export DOCU_NOTION_SAMPLE_ROOT_PAGE=[***] export DOCU_NOTION_INTEGRATION_TOKEN=[***]
- Go to the root page and add docu-notion-kira integration. This page should have, as direct children, "Outline" (required) and "Database" (optional) pages. Follow these instructions. Source: Notion integration
- Install Dependencies:
npm install
- Parse Pages with docu-notion:
npx docu-notion-kira -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_SAMPLE_ROOT_PAGE
Starting Docusaurus Server
- Navigate to the Project Directory:
- Start the Docusaurus Server:
yarn start
- Source Docusaurus Intallation Guide
Docu-notion Command line
Usage: docu-notion-kira -n
Options:
flag | required? | description |
---|---|---|
-n, --notion-token |
required | notion api token, which looks like secret_3bc1b50XFYb15123RHF243x43450XFY33250XFYa343 |
-r, --root-page |
required | The 31 character ID of the page which is the root of your docs page in notion. The code will look like 9120ec9960244ead80fa2ef4bc1bba25 . This page must have a child page named 'Outline' |
-m, --markdown-output-path |
Root of the hierarchy for md files. WARNING: node-pull-mdx will delete files from this directory. Note also that if it finds localized images, it will create an i18n/ directory as a sibling. (default: "./docs") | |
-t, --status-tag |
Database pages without a Notion page property 'status' matching this will be ignored. Use '*' to ignore status altogether. (default: Publish ) |
|
--locales |
Comma-separated list of iso 639-2 codes, the same list as in docusaurus.config.js, minus the primary (i.e. 'en'). This is needed for image localization. (default: []) | |
-l, --log-level |
Log level (choices: info , verbose , debug ) |
|
-i, --img-output-path |
Path to directory where images will be stored. If this is not included, images will be placed in the same directory as the document that uses them, which then allows for localization of screenshots. | |
-p, --img-prefix-in-markdown |
When referencing an image from markdown, prefix with this path instead of the full img-output-path. Should be used only in conjunction with --img-output-path. | |
-h, --help | display help for command |