Repository navigation
feat(core): block-owned HTML export post-processing - #3362
nperez0111 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
CI follow-up: the only initial failures were 27 existing color-inheritance cases, also failing on the base branch (run 43469007818). Root cause was React CSS overriding core color fallbacks with unresolved theme variables outside a themed root. Commit 2ec2315 restores the same 18 fallbacks as core; themed values still take precedence. An independent sub-agent reviewed the fix (READY). Docker verification: 70 passed, 2 existing skips across Chromium, Firefox, and WebKit, including color inheritance, postProcessHTML, and static rendering. Watching the fresh full CI run. |
|
Why
The HTML serializer currently knows too much about specific blocks. It has special steps for numbered lists, checkboxes, toggles and tables, even though those details really belong to the blocks themselves.
Ideally, the serializer should just assemble the HTML. A block should be able to clean up its own output, whether it is a built-in block or a custom one.
Some of that cleanup needs the whole document, though. List numbering, for example, depends on the surrounding blocks, so it cannot happen while rendering each block in isolation.
What this changes
This adds a
postProcessHTMLhook to block implementations. It runs once per block type, after the full HTML has been assembled:rootis the complete exported DOM.blockOutputsmaps the rendered blocks of that type to their output nodes and elements, so the hook does not need to find or parse those blocks again.The same hook runs for both HTML export methods. There is no format flag; a block can target the DOM structure it needs to adjust.
The existing list numbering, checkbox, toggle and table cleanup now lives with those blocks instead of in the internal serializer. This does not remove internal HTML serialization yet, but it moves us toward a serializer that does not need to know about individual block types.
Checked
CI also exposed an existing color-inheritance failure on the base branch. A separate commit restores the missing CSS fallback colors; the existing tests now pass without changing their assertions.