Skip to main content

rewrite_links_to_bytes

Function rewrite_links_to_bytes 

Source
pub fn rewrite_links_to_bytes(bytes: &[u8], old: &Path, new: &Path) -> Vec<u8> 
Expand description

Byte-preserving counterpart to rewrite_links_to for externally dropped content that is not valid UTF-8.

Link targets are required to be valid UTF-8 before they can match a db.md path, but every byte outside the matched target (including an invalid display label or unrelated legacy-encoded prose) is copied verbatim. This lets rename retarget a live ASCII/UTF-8 wiki-link without either dangling it or replacing unrelated invalid bytes with U+FFFD.