Repository navigation
Description
What happens
Inside a component with browser behavior (js), Citry checks that each
<c-raw> block and each Markup value is complete HTML, because Vue
inserts it as one block. The check also refuses character references that
the HTML standard calls parse errors, although the browser decodes them
without trouble and they cannot change where a tag ends. The error then
explains a rule about tags that the block does not break:
from citry import Citry, Component
app = Citry(autodiscover=False)
class Footer(Component):
citry = app
template = """
<footer><c-raw><p>© 2026 Example</p></c-raw></footer>
"""
js = """
$component({data() { return {}; }});
"""
Footer().render().serialize()ValueError: The <c-raw> block at line 2, column 16 is not a complete HTML fragment: '<p>© 2026 Example</p>'. Inside an interactive component, Vue inserts this HTML as one block, so every tag it opens must be closed inside it, it must not close a tag it did not open, and a '<' that does not start a tag must be written as '<'. Fix the HTML, or move the tags it shares with the template into it. ...
The browser reads © 2026 as © 2026. The same check
(citry_core.html_transform.validate_html_fragment_boundary) refuses
each of these, and accepts <p>&</p>:
| Fragment | What the browser reads |
|---|---|
<p>© 2026</p>, <p> </p> |
© 2026, a no-break space (a legacy name without ;) |
<p>a&foo;b</p> |
a&foo;b (an unknown name stays as written) |
<b>ab</b>, <b>ab</b> |
the code point, kept as written |
<b>a€b</b> |
a€b (U+0080 to U+009F map to Windows-1252) |
<p>�</p> |
U+FFFD |
The browser column and the error names come from parse5 7.3.0 (the
parser jsdom uses). The check was run with citry_core built from #288's
branch, which does not change it. #284
(fix/control-characters-in-page-text) makes the check accept a literal
control character or noncharacter, but not the references in this
table; its description lists , € and  as left
for a separate decision.
Is this a bug
The check is meant to accept only a strict subset of HTML, and its doc
comment says it "rejects every tokenizer error except" the ones #284
allows. So refusing these references follows its written contract.
Two things are still wrong:
- The error message names three rules about tags and
<. A reader with
© 2026in a footer cannot tell from it what to change. - None of these references can change the tree: each one decodes to text
(or stays text) in the browser. The tokenizer Citry uses (html5gum)
follows the standard's decoding rules; a test should confirm it decodes
each row as the table shows. The rule exists to keep Vue's
block intact, and these do not threaten it. Legacy names without;,
such as©and , are common in hand-written and older HTML.
Cause
crates/citry_html_transform/src/output_scanner.rs on #284's branch:
validate_html_fragment_boundary (line 528) fails on every tokenizer
error that error_keeps_input_as_written (line 400) does not allow, and
that function allows only ControlCharacterInInputStream and
NoncharacterInInputStream. The HTML standard names the errors for
these references missing-semicolon-after-character-reference,
unknown-named-character-reference, control-character-reference,
noncharacter-character-reference and null-character-reference. The
Python message comes from reject_cross_boundary_html in
packages/py/citry/citry/_vue/opaque_html.py:12-32.
Who hits it
Authors of interactive components who paste existing HTML into a
<c-raw> block, or pass it as Markup, when that HTML writes a legacy
entity without ; or an unusual numeric reference. Static pages are not
affected.
Fix direction
Build on #284. Either:
- accept the character reference errors in
error_keeps_input_as_written
(the five above, pluscharacter-reference-outside-unicode-range,
surrogate-character-referenceand
absence-of-digits-in-numeric-character-reference), because none
of them opens or closes an element; or - keep refusing them, and give them their own message that names the
reference and its fix, such as "write©with a;".
Option 1 matches what the check is for. Whichever is chosen, add the
table above as Rust test cases and one Python test with the Footer
example, and record the choice in the doc comment of
validate_html_fragment_boundary.
Activity