Surface unknown node types; escape rule interpolations - #72
Open
jpcamara wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A custom editor node with no render rule doesn't break to_html — it quietly degrades: an unknown container renders its children without its own markup, and a node whose content lives only in its attributes renders nothing. Nothing reported that. This PR makes the degradation visible and hardens the escaping story around rules.
unknown_types
Y::Lexical#unknown_types/Y::ProseMirror#unknown_types(inherited byY::LexxyandY::Tiptap): the node types the document contains whosehandledis nil innode_types— exactly the setto_htmldegrades. It's the checklist companion to the existing discovery aid: render a real document from your editor in a test and assert the list is empty. Returns[]for a missing or wrong-shaped root, whereto_htmlreturns nil and nothing degrades.Escaping
Y::Lexxy's list-item rule interpolated the stored__checkedand__valueattributes raw. Stored attributes are collaborator input — a crafted value could break out of the attribute position. Both now go throughRenderRules.escape_attr. Legitimate editor values (booleans, integers) render byte-identically, so the parity fixtures are unaffected.escape_text/escape_attrpublic for splice callers, and both crate READMEs' callback examples now escape what they interpolate instead of demonstrating the unsafe pattern in a comment.lexical-yjs-html0.1.1 → 0.1.2,prosemirror-yjs-html0.1.2 → 0.1.3.Docs
The crate READMEs and the root README's rules section state the degradation contract (unknown containers unwrap; attribute-only nodes render nothing; on the ProseMirror side, unknown marks render their text unformatted) and point at
unknown_types.Tests: unknown_types across all four renderers plus the rule-covered and missing-root cases; a hostile
__checkedvalue renders escaped. Crate doctests cover the updated README examples.