An API to convert Markdown to Notion blocks.
This project provides an API endpoint to convert Markdown text into Notion-compatible blocks, leveraging the martian
library.
A hosted version of this API is available at https://md2notion.hilars.dev.
You can use the hosted API by sending a POST
request to:
https://md2notion.hilars.dev/
Example Request using curl
:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"md": "# Hello World\nThis is a test."}' \
https://md2notion.hilars.dev
Example Response:
[
{
"object": "block",
"type": "heading_1",
"heading_1": {
"rich_text": [
{
"type": "text",
"annotations": {
"bold": false,
"strikethrough": false,
"underline": false,
"italic": false,
"code": false,
"color": "default"
},
"text": {
"content": "Hello World"
}
}
]
}
},
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"annotations": {
"bold": false,
"strikethrough": false,
"underline": false,
"italic": false,
"code": false,
"color": "default"
},
"text": {
"content": "This is a test."
}
}
]
}
}
]
- Node.js
- Yarn or npm
git clone https://github.com/l4r-s/md2notion-api.git
cd md2notion-api
yarn install
yarn dev
The API will be running at http://localhost:3000
.
docker build -t md2notion-api .
docker run -p 3000:3000 md2notion-api
This project is built upon martian
, which does the heavy lifting of parsing Markdown into Notion blocks. Big thanks to the contributors of martian
for their excellent work!
If you find this project useful, consider buying me a coffee.