nast
nast copied to clipboard
A block-based intermediate representation for document-like content.
NAST
A block-based intermediate representation for document-like content.

Packages
| Name | Description | Status |
|---|---|---|
| nast-types | A TypeScript type definition module to specify data models for intermediate representation of data. | Experimental |
| nast-util-from-notionapi | Import data from a Notion page. | Stable |
| nast-util-from-orgzly | Import data from an org-mode file exported by Orgzly. | Proof of Concept |
| nast-util-to-react | Render data to JSX.Element or HTML. (Preferred) |
Stable |
| npdl | Download Notion pages as self-contained / single-file HTML files. | Stable |
| nast-util-to-svelte | Render data to HTML using Svelte. | - |
- Stability : Stable > Experimental > Proof of Concept
Development
Clone the repo and cd into it
git clone https://github.com/dragonman225/nast.git && cd nast
Install dependencies
-
yarn(required)npm i -g yarnWe use
yarnto manage package dependencies. -
lerna(required)npm i -g [email protected]This project is a monorepo managed with lerna. If you haven't heard of it before, this tutorial is a good starting point.
-
typedoc(optional)npm i -g typedoctypedocneeds to be available in the command-line for reference document generation. -
Graphviz (optional)
# For Arch Linux pacman -S graphviz # For macOS via Homebrew brew install graphvizdotneeds to available in the command-line for dependency graph generation.
Setup the project
yarn # Install and link dependencies
npx lerna run build # Build all packages
Testing
-
Test the overall functionality with
npdl.Download a Notion page and render it to HTML. Use the CSS theme at
packages/nast-util-to-react/src/theme.css.node packages/npdl/index.js -i=<notion_page_url> output.htmlUse an external theme.
node packages/npdl/index.js -i=<notion_page_url> --theme=<path_to_css> output.htmlJust download a Notion page without rendering to HTML.
node packages/npdl/index.js -i=<notion_page_url> --tree output.jsonnpdlhas more features, which can be listed withnode packages/npdl/index.jsYou can also install
npdlglobally.cd packages/npdl && npm i -g . -
Each package may have its own test suite, which is not covered here.
Contributing to NAST
- Contributing to the project
Troubleshooting
npx nx graphto check if the packages are correctly linked.- If a package is published with a new version, don't forget to update other packages that are using it.