A collection of reusable components for working with the Notion API.
This repository contains essential utilities used in viaSocket Automation to process, transform, and manipulate Notion content programmatically.
The goal of this project is to provide reliable conversion tools between Notion blocks and various output formats, making it easier to integrate Notion into automation pipelines, content workflows, and developer tools.
- Convert Notion Blocks → Markdown
- Convert Notion Blocks → HTML
- Preserve rich text formatting
- Handle nested blocks
- Support for all common Notion block types
- Graceful fallback for unsupported blocks
- Clean output
- Structured reporting of unsupported blocks
Future tools planned:
- Markdown → Notion block converter
- Notion block utilities
- Content automation helpers
This repository exists to store the core Notion transformation logic used internally in viaSocket automation workflows.
It focuses on:
- Converting Notion data structures
- Standardizing content transformations
- Making Notion automation easier for developers
Converts a Notion API block array into a clean Markdown string.
📖 Full documentation → notionToMarkdown.md
import notionToMarkdown from "./converters/notionToMarkdown.js"
const result = await notionToMarkdown(notionBlocks, {
auth: "ntn_your_api_key"
})
console.log(result.markdownContent)Converts a Notion API block array into a semantic HTML string.
📖 Full documentation → notionToHtml.md
import notionToHtml from "./converters/notionToHtml.js"
const result = await notionToHtml(notionBlocks, {
auth: "ntn_your_api_key"
})
console.log(result.htmlContent)- Clean output (Markdown and HTML)
- Preserve as much Notion structure as possible
- Never silently discard unsupported blocks
- Keep functions portable and dependency-free
Upcoming utilities:
- Markdown → Notion block converter
- Notion rich text utilities
- Notion page export tools
This library is useful for:
- Automation platforms
- Static site generators
- Knowledge base exports
- Content synchronization
- Notion backup tools
notion-components/
│
├── converters/
│ ├── notionToMarkdown.js
│ └── notionToHtml.js
│
├── utils/
│
├── examples/
│
├── notionToMarkdown.md
├── notionToHtml.md
└── README.md
Contributions are welcome.
If you want to improve support for additional Notion block types or add new converters, feel free to open a pull request. For major changes, please open an issue first to discuss what you would like to change.
Built and maintained for viaSocket Automation by RoystonSanctis