notion-to-html-converter v1.0.1
Notion to HTML Converter
notion-to-html-converter
is an npm package that converts Notion page blocks into HTML. This package leverages the Notion API to fetch page content and then translates that content into HTML, which you can use to render in your web application.
Features
- Fetches content from Notion pages using Notion's API.
- Converts Notion blocks into basic HTML elements.
- Handles various block types like paragraphs, headings, lists, and checkboxes.
Installation
To install the notion-to-html-converter
package, use npm:
npm install notion-to-html-converter
Usage
Basic Example
Here’s a simple example demonstrating how to use notion-to-html-converter to convert a Notion page to HTML:
const { convertNotionPageToHtml } = require('notion-to-html-converter');
// Replace with your Notion integration token and page ID
const notionToken = 'your-notion-token-here';
const pageId = 'your-notion-page-id-here';
convertNotionPageToHtml(notionToken, pageId)
.then(html => {
console.log('HTML:', html);
})
.catch(error => {
console.error('Error:', error);
});
Parameters
notionToken (string): Your Notion integration token. This is required to authenticate requests to the Notion API. pageId (string): The ID of the Notion page you want to convert.
Notes
Ensure your Notion integration has the necessary permissions to access the page. Update the Notion API version in the request header if there are changes or updates to the API.
Contributing
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.
11 months ago