mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-18 06:03:04 +00:00
fix(engine): never let document text close the generated HTML style element (#1955)
This commit is contained in:
@@ -90,7 +90,10 @@ pub(super) fn html(doc: &Document, id: NodeId) -> String {
|
||||
let ctx = Ctx::new(doc, id);
|
||||
let mut out = Markup::new(&ctx, CodeLang::Html);
|
||||
out.node(id, None, 0, "");
|
||||
format!("{}\n<style>\n{}{}</style>\n", out.markup, out.tokens.root_rule(), out.styles)
|
||||
// Document text can reach the stylesheet through any property: `<\/` reads back as `</` inside a CSS
|
||||
// string and can never close the element early.
|
||||
let css = format!("{}{}", out.tokens.root_rule(), out.styles).replace("</", "<\\/");
|
||||
format!("{}\n<style>\n{css}</style>\n", out.markup)
|
||||
}
|
||||
|
||||
/// Markup being built for a layer tree: HTML (`class`), React JSX (`className`), Vue
|
||||
|
||||
Reference in New Issue
Block a user