feat: let a site render its xhtmlmp/html output as a Mews Profile page
All checks were successful
CI / check (push) Successful in 48s
CI / release (push) Successful in 6m48s

A new mews_profile site setting switches the XHTML-MP 1.2 doctype, the
conformance marker, the viewport tag and the default stylesheet link, and
drops raw HTML passthrough and off-site or data: images that the profile's
permitted-element list cannot vouch for.
This commit is contained in:
randogoth 2026-10-11 08:22:52 +03:00
parent 1b47145522
commit c9bde15f5c
9 changed files with 357 additions and 70 deletions

View file

@ -295,7 +295,8 @@ mod tests_support {
pub fn render(markdown: &str) -> String {
let doc = parse::markdown(markdown).unwrap();
let settings = PageSettings::default();
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: None };
let ctx =
RenderCtx { url: "/x", title: "T", settings: &settings, width: None, mews_hosts: None };
let out = Gemtext.render(&doc, &ctx).unwrap();
String::from_utf8(out.body).unwrap()
}
@ -398,7 +399,8 @@ mod tests {
// Pagination is a WML concern; a Gemini client scrolls one document.
let doc = parse::markdown("a\n\nb\n").unwrap();
let settings = PageSettings::default();
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: None };
let ctx =
RenderCtx { url: "/x", title: "T", settings: &settings, width: None, mews_hosts: None };
let plain = String::from_utf8(Gemtext.render(&doc, &ctx).unwrap().body).unwrap();
assert_eq!(plain, "a\n\nb\n");
}