Why web clippers drop code blocks and tables — and how I convert full articles into real Notion blocks locally
Most "save to Notion" tools don't lose your article on purpose. They lose it in two places, and neither of them is the Notion API. I build Notion Clip Pro, a Chrome extension that clips a page into the reader's own Noti
Most "save to Notion" tools don't lose your article on purpose. They lose it in two places, and neither of them is the Notion API.
I build Notion Clip Pro, a Chrome extension that clips a page into the reader's own Notion database with their own integration token. Before that I used several clippers, and kept finding the same thing in my own database: a page with the title, the URL, and a body that starts out as an article and then quietly stops being one. Headings become bold paragraphs. Code comes out as a grey block with no language and no indentation. Tables come out as lines of text with the pipes still in them.
This post is about the two failure points, the parts of the Notion API that dictate the shape of the fix, and what still doesn't work — because that last list is the useful half.
Disclosure: I'm the developer, and the extension is a product. The code below is from the shipped extension, not a sketch.
The API is not the bottleneck
Everything a clipper needs is in the API: code blocks with a language field, table blocks with table_row children, image blocks with an external URL (so no upload is needed), and headings, quotes, list items, dividers and bookmarks.
The API also sends CORS headers, so an extension's service worker can call api.notion.com directly with the user's own token. That is what makes a clipper with no backend possible at all: the token lives in chrome.storage, and the only network destination is Notion.
Four hard limits decide the architecture:
| Limit | What it forces |
|---|---|
| 2,000 characters per rich text object | split text, without breaking surrogate pairs |
| 100 rich text objects per block | a very long paragraph becomes several blocks |
| 100 blocks per create/append request | chunk the page, and never split a table from its rows |
a table must arrive with its rows and a matching table_width
|
a table is one unit or it is nothing |
Failure point one: extraction throws the structure away
The cheap way to clip a page is document.body.innerText, or "run Readability, take the paragraphs". Both produce a string, and a string has no block boundaries. Once the article is a string, h2, p and pre are indistinguishable, and whatever converts it downstream can only guess.
So extraction never lets it become a string. It walks the DOM and emits an intermediate block list:
// h1..h3 -> {type:'heading_2', rich:[{text,bold,italic,code,link}]}
// p -> {type:'paragraph', rich:[...]}
// pre>code -> {type:'code', text, language}
// ul / ol -> {type:'bulleted_list_item' | 'numbered_list_item', rich:[...]}
// table -> {type:'table', rows:[[cell]], hasColumnHeader}
// img -> {type:'image', url, caption}
That intermediate format is the whole design. It is JSON-safe, because it has to travel from the page back to the service worker through chrome.scripting.executeScript. It is testable without a browser. And conversion into Notion blocks becomes a pure function of data.
Choosing the container is the Readability problem, and the scoring is close to theirs:
var score = textLength * (1 - Math.min(0.9, linkDensity)) + paragraphs * 45;
if (node.tag === 'article') score *= 1.3;
score -= countTags(node, {nav: 1, aside: 1, form: 1}) * 180;
Two details matter more than the formula:
- Reject by link density. A container that is 55% anchor text is a list of links, not an article, however many words it holds.
-
Split "noise" into two strengths.
ad,sponsor,comment,share,related,cookie,sidebarare always furniture.widget,author,meta,promoare usually furniture — but not always. One documentation site I test against ships its entire article insidediv class="medium-widget". So weak signals are removed only when the element doesn't read like prose, meaning it contains no paragraph of reasonable length.
Failure point two: conversion is a pile of small, specific rules
Code language. A pre block almost never says what language it holds. It hints:
-
language-python,lang-jsfrom highlight.js and Prism -
highlight-source-jsfrom GitHub -
brush: pythonfrom SyntaxHighlighter -
data-lang="ts"from whoever wrote the theme
So collect signatures from the <code> element and from the <pre>, regex for those prefixes, and then map the result onto the set of values Notion actually accepts. js has to become javascript, py becomes python, c++ stays c++. Notion validates language against an enum, so an unmapped value isn't a graceful fallback, it's a 400. Anything unknown becomes plain text.
Splitting text. 2,000 characters per rich text object, and a naive slice(0, 2000) will eventually cut a surrogate pair in half — an emoji, or Japanese text outside the BMP. Notion stores what you send, so you get a lone surrogate and a broken character in the page.
var end = Math.min(source.length, index + limit);
if (end < source.length) {
var code = source.charCodeAt(end - 1);
if (code >= 0xd800 && code <= 0xdbff) end -= 1; // don't cut a surrogate pair
}
Tables. A table block must arrive with its rows as children and a table_width matching the widest row. Each cell is an array of rich text objects, so a cell can still hold a link or bold text. Rows count against the 100-block request limit, which is why chunking weighs a table as one unit plus its rows:
function weight(block) {
if (block.type === 'table' && block.table.children) return 1 + block.table.children.length;
return 1;
}
A table with 120 rows becomes two table blocks, 80 rows and 40 rows, both with the same width. It is ugly, but it keeps every cell aligned and every request under the limit. Creating the table empty and appending rows afterwards also works; it is slower and leaves a half-built table if it fails midway.
Images. Notion accepts either an uploaded file or an external URL. External keeps the clipper serverless — no proxy, no storage — and the cost is that the page keeps depending on the source site: when the image disappears there, the Notion page shows a broken image. Uploading would fix that and need either a server or a per-file round trip per image. I chose external URLs and wrote that trade-off into the listing.
Chunking, and the retry that actually matters. 100 blocks per request. When request 3 of 7 fails you have a half-written page, and the retry must not resend chunks 1 and 2, or the page gets its first 200 blocks twice. Keep only the unsent tail:
entry.pending = remaining.slice(sent);
One line, and it is the difference between "retry" and "delete the page and start again" — which, on a 1,500-block article, is not a small difference.
Duplicates, and why the check belongs before the write
A clipper that quietly creates a second page for the same URL makes the database worse every time you use it. The fix is not clever: query the data source before writing, filtering on the URL property, and if a row already exists, link to it instead of creating another one.
If you address Notion databases from the API today, one thing will bite. Since the 2025-09-03 API version a database can hold several data sources, and a database read with an older Notion-Version fails once a second source exists. Address data_source objects instead: GET /v1/data_sources/{id} for the schema, POST /v1/data_sources/{id}/query to search, and create pages with parent: {type: 'data_source_id'}.
What still fails
- Login-gated pages: the script reads what is rendered, so a paywalled article saves as far as the visible part and no further.
-
PDFs and
chrome://pages: extensions cannot be injected into them. - Canvas-rendered or image-only text: extraction yields almost nothing, and no amount of block mapping fixes that.
- Infinite scroll: the script runs on the DOM as it is when the clip is pressed. Text that has not been rendered yet is not there.
- Very long pages: capped at 1,500 blocks, with a visible note at the point where it was cut.
- Sites that change their markup: the ongoing maintenance cost of every clipper, and mine is not exempt.
Why "no server" was worth the constraints
Calling the API directly from the extension means there is no account to create, no quota to meter on my side, no place your articles pass through, and nothing of mine to breach. The token stays in the browser. The free limit — 20 clips a month on the free version — is a counter in extension storage that increments after a successful clip rather than before, because charging someone for a failure is a small betrayal that people notice and do not forget.
The costs are real: no server-side rendering for problem pages, no image hosting, no way to fix extraction for a broken site without shipping a new version, and a store review between me and every fix.
If you build a clipper, the intermediate block list is the decision I would make again. The 2,000-character splits, the language allowlist and the table weights are all downstream of it.
The extension
Notion Clip Pro is on the Chrome Web Store as a free version — 20 clips a month, all the block mapping above, nothing to pay to find out whether it works on the pages you actually read: https://chromewebstore.google.com/detail/ijpjkejlblhggefjpkhhlllbehboobjf
Pro ($6/month or $49/year) adds unlimited clips, custom property mapping, duplicate checking and bulk retry: https://linkguard.gumroad.com/l/notion-clip-pro
It is also on Product Hunt today: https://www.producthunt.com/products/notion-clip-pro
The store page lists the limitations of all the tools, including the ones I forgot to put in this post: https://linkguard-tools.github.io/
If a page comes out badly for you, a URL is worth more to me than a verdict — paste it in the comments and I'll look at what the extractor did with it.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.