Context: Forge M12 renders wiki pages and release notes. Relative links and images must be rewritten to bounded server routes after rendering (path traversal and external image safety), but Void/Text/Markdown.hpp offers no resolver callback for link/image destinations (only the scheme allow-list).
Need (optional): a link/image resolver hook in the render options, e.g. std::function<std::string(std::string_view destination, bool image)>, applied after scheme validation and before HTML escaping/emitting.
Tests/gate: resolver receives each destination exactly once in document order, its output is escaped, a throwing/overlong resolver result is bounded, and javascript:/data: destinations are still dropped regardless of the hook. Forge post-processes the rendered HTML until this lands.
Context: Forge M12 renders wiki pages and release notes. Relative links and images must be rewritten to bounded server routes after rendering (path traversal and external image safety), but `Void/Text/Markdown.hpp` offers no resolver callback for link/image destinations (only the scheme allow-list).
Need (optional): a link/image resolver hook in the render options, e.g. `std::function<std::string(std::string_view destination, bool image)>`, applied after scheme validation and before HTML escaping/emitting.
Tests/gate: resolver receives each destination exactly once in document order, its output is escaped, a throwing/overlong resolver result is bounded, and javascript:/data: destinations are still dropped regardless of the hook. Forge post-processes the rendered HTML until this lands.
MarkdownOptions::resolver (MarkdownResolver = std::function<std::string(std::string_view destination, bool image)>) is applied after the scheme allow-list check and before HTML escaping, once per emitted link/image destination in document order.
Its output is escaped like any other destination.
javascript:/data:/vbscript: destinations are still dropped and never reach the resolver (entity-smuggled variants included).
A throwing resolver falls back to the original validated destination; an overlong result is reported as MarkdownError::Code::output_limit via MarkdownLimits::max_output.
Resolver is not called for images when allow_images == false (nothing is emitted).
Implemented in e6745ac on `main`.
- `MarkdownOptions::resolver` (`MarkdownResolver = std::function<std::string(std::string_view destination, bool image)>`) is applied after the scheme allow-list check and before HTML escaping, once per emitted link/image destination in document order.
- Its output is escaped like any other destination.
- `javascript:`/`data:`/`vbscript:` destinations are still dropped and never reach the resolver (entity-smuggled variants included).
- A throwing resolver falls back to the original validated destination; an overlong result is reported as `MarkdownError::Code::output_limit` via `MarkdownLimits::max_output`.
- Resolver is not called for images when `allow_images == false` (nothing is emitted).
- Tests in `tests/standalone/Text/Markdown.cpp`: ordering/exactly-once, escaping, throw fallback, overlong bound, unsafe-destination bypass, disallowed images. Text+Testing suite: 627 tests, 624 passed, 3 skipped, 0 failed.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context: Forge M12 renders wiki pages and release notes. Relative links and images must be rewritten to bounded server routes after rendering (path traversal and external image safety), but
Void/Text/Markdown.hppoffers no resolver callback for link/image destinations (only the scheme allow-list).Need (optional): a link/image resolver hook in the render options, e.g.
std::function<std::string(std::string_view destination, bool image)>, applied after scheme validation and before HTML escaping/emitting.Tests/gate: resolver receives each destination exactly once in document order, its output is escaped, a throwing/overlong resolver result is bounded, and javascript:/data: destinations are still dropped regardless of the hook. Forge post-processes the rendered HTML until this lands.
Implemented in
e6745aconmain.MarkdownOptions::resolver(MarkdownResolver = std::function<std::string(std::string_view destination, bool image)>) is applied after the scheme allow-list check and before HTML escaping, once per emitted link/image destination in document order.javascript:/data:/vbscript:destinations are still dropped and never reach the resolver (entity-smuggled variants included).MarkdownError::Code::output_limitviaMarkdownLimits::max_output.allow_images == false(nothing is emitted).tests/standalone/Text/Markdown.cpp: ordering/exactly-once, escaping, throw fallback, overlong bound, unsafe-destination bypass, disallowed images. Text+Testing suite: 627 tests, 624 passed, 3 skipped, 0 failed.