1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

LibWeb: Use file's URL as document's URL when loading markdown files

A markdown file gets loaded as an inline content document by
`create_document_for_inline_content()`, for which the default document
URL is "about:error". That breaks the fragment links.

Overriding "about:error" URL by passing the URL of the just loaded
markdown file as an argument to `HTMLParser::run()` ensures that the URL
of the document is as expected.
This commit is contained in:
ronak69 2024-01-29 15:47:21 +00:00 committed by Andrew Kaster
parent 6c31f2a68a
commit 05e53b5fd3

View file

@ -78,7 +78,7 @@ static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::Document>> load_markdown_docume
return;
auto parser = HTML::HTMLParser::create(document, markdown_document->render_to_html(extra_head_contents), "utf-8");
parser->run(document.url());
parser->run(url);
};
auto process_body_error = [](auto) {