{"id":18961668,"url":"https://github.com/trialanderrororg/html-to-notion-blocks","last_synced_at":"2026-04-01T16:30:17.894Z","repository":{"id":130692333,"uuid":"607887990","full_name":"TrialAndErrorOrg/html-to-notion-blocks","owner":"TrialAndErrorOrg","description":"Transform HTML to Notion blocks","archived":false,"fork":false,"pushed_at":"2023-03-14T22:30:46.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T04:52:44.380Z","etag":null,"topics":["abstract","ast","syntax","tree","unified"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrialAndErrorOrg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tefkah"}},"created_at":"2023-02-28T21:58:22.000Z","updated_at":"2024-12-12T07:17:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"9035ca22-8e3c-4d42-94c0-dad080a3b19c","html_url":"https://github.com/TrialAndErrorOrg/html-to-notion-blocks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fhtml-to-notion-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fhtml-to-notion-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fhtml-to-notion-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fhtml-to-notion-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrialAndErrorOrg","download_url":"https://codeload.github.com/TrialAndErrorOrg/html-to-notion-blocks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239958283,"owners_count":19724925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract","ast","syntax","tree","unified"],"created_at":"2024-11-08T14:13:56.528Z","updated_at":"2026-04-01T16:30:17.815Z","avatar_url":"https://github.com/TrialAndErrorOrg.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tefkah"],"categories":[],"sub_categories":[],"readme":"\u003e **Note**\n\u003e This repository is automatically generated from the [main parser monorepo](https://github.com/TrialAndErrorOrg/parsers). Please submit any issues or pull requests there.\n\n# html-to-notion-blocks\n\n[![npm version](https://badge.fury.io/js/html-to-notion-blocks.svg)](https://badge.fury.io/js/html-to-notion-blocks) [![npm downloads](https://img.shields.io/npm/dm/html-to-notion-blocks.svg)](https://www.npmjs.com/package/html-to-notion-blocks)\n\nTransform HTML to Notion blocks\n\n## Contents\n\n*   [html-to-notion-blocks](#html-to-notion-blocks)\n    *   [Contents](#contents)\n    *   [What is this?](#what-is-this)\n    *   [When should I use this?](#when-should-i-use-this)\n    *   [Install](#install)\n    *   [Use](#use)\n    *   [API](#api)\n        *   [`htmlToNotion()`](#htmltonotion)\n            *   [Signature](#signature)\n            *   [Parameters](#parameters)\n            *   [Returns](#returns)\n    *   [Security](#security)\n    *   [Related](#related)\n    *   [License](#license)\n\n## What is this?\n\nA small library that transforms HTML to Notion blocks. It is based on [rehype-to-notion][rehype-to-notion].\n\n## When should I use this?\n\nYou want a simple way to convert HTML to Notion blocks. If you want to control the conversion process, you should use [rehype-to-notion][rehype-to-notion] instead.\n\n## Install\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as\n\n```bash\npnpm add html-to-notion-blocks\n# or with yarn\n# yarn add html-to-notion-blocks\n# or with npm\n# npm install html-to-notion-blocks\n```\n\n## Use\n\n```ts\nimport { htmlToNotion } from 'html-to-notion-blocks'\n\nconst html = '\u003cp\u003eHello world!\u003c/p\u003e'\n\nconst notionBlocks = htmlToNotion(html)\n\nconsole.log(notionBlocks)\n// [\n//   {\n//     object: 'block',\n//     type: 'paragraph',\n//     paragraph: {\n//       text: [\n//         {\n//           type: 'text',\n//           text: {\n//             content: 'Hello world!',\n//             link: null\n//           },\n//           annotations: {\n//             bold: false,\n//             italic: false,\n//             strikethrough: false,\n//             underline: false,\n//             code: false,\n//             color: 'default'\n//           },\n//           plain_text: 'Hello world!',\n//           href: null\n//         }\n//       ]\n//     }\n//   }\n// ]\n```\n\n## API\n\n***\n\n### `htmlToNotion()`\n\n#### Signature\n\n```ts\nhtmlToNotion(html: string, options?: Options): BlockObjectRequest[];\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `html` | `string` |\n| `options?` | `Options` |\n\n#### Returns\n\n`BlockObjectRequest`[]\n\nDefined in:  [lib/html-to-notion-blocks.ts:5](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/notion/html-to-notion-blocks/src/lib/html-to-notion-blocks.ts#L5)\n\n## Security\n\nUse of `html-to-notion-blocks` can open you up to a [cross-site scripting (XSS)][xss] attack. If you are processing user input, be sure to use a HTML sanitizer, such as [rehype-sanitize][rehype-sanitize].\n\n## Related\n\n*   [rehype-to-notion][rehype-to-notion]\n    — Transform HTML to Notion blocks\n*   [rehype-sanitize][rehype-sanitize]\n*   [rehype][rehype]\n    — HTML processor powered by plugins part of the [unified][unified] collective\n\n## License\n\n[GPL-3.0-or-later](LICENSE) © Thomas F. K. Jorna\n\n[unified]: https://unifiedjs.com\n\n[unifiedgh]: https://github.com/unifiedjs/unified\n\n[xast-from-xml]: https://github.com/syntax-tree/xast-util-from-xml\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour\n\n[rejour-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-parse\n\n[rejour-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-stringify\n\n[rejour-move-abstract]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-move-abstract\n\n[rejour-meta]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-meta\n\n[rejour-relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-relatex\n\n[relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex\n\n[relatex-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/relatex-parse\n\n[jast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast\n\n[jast-util-to-texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast-util-to-texast\n\n[jastscript]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jastscript\n\n[texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast\n\n[texast-util-to-latex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast-util-to-latex\n\n[hast]: https://github.com/syntax-tree/hast\n\n[xast]: https://github.com/syntax-tree/xast\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[mdast-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[latex-utensils]: https://github.com/tamuratak/latex-utensils\n\n[latexjs]: https://github.com/latexjs/latexjs\n\n[reoff]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff\n\n[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse\n\n[reoff-rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-rejour\n\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast\n\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast-util-to-jast\n\n[rehype-to-notion]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/notion/rehype-to-notion\n\n[html-to-notion-blocks]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/notion/html-to-notion-blocks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fhtml-to-notion-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrialanderrororg%2Fhtml-to-notion-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fhtml-to-notion-blocks/lists"}