fix: bound document nesting and escape generated urls

This commit is contained in:
randogoth 2026-10-04 22:30:44 +03:00
parent c29364d8e0
commit 49a63503d0
10 changed files with 276 additions and 19 deletions

View file

@ -57,7 +57,7 @@ mod tests {
/// Render at a narrow width so wrapping is visible, with no margins so the
/// assertions read as the content itself.
fn render_with(settings: &PageSettings, width: u16, markdown: &str) -> String {
let doc = parse::markdown(markdown);
let doc = parse::markdown(markdown).unwrap();
let ctx = RenderCtx { url: "/x", title: "T", settings, width: Some(width) };
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
}
@ -266,7 +266,7 @@ mod separation_tests {
use super::*;
fn render(markdown: &str) -> String {
let doc = parse::markdown(markdown);
let doc = parse::markdown(markdown).unwrap();
let settings = PageSettings { margin_left: 0, margin_right: 0, ..Default::default() };
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: Some(40) };
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
@ -299,7 +299,7 @@ mod optional_feature_tests {
use super::*;
fn render_with(settings: &PageSettings, width: u16, markdown: &str) -> String {
let doc = parse::markdown(markdown);
let doc = parse::markdown(markdown).unwrap();
let ctx = RenderCtx { url: "/x", title: "T", settings, width: Some(width) };
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
}