Skip to main content

Module fuzzy_path

Module fuzzy_path 

Source
Expand description

Fuzzy path resolution and relative URL computation.

Wraps ContentGraph::resolve_path with typed results and provides relative_url for generating correct relative links between files using pretty URL format (directory-based).

Enums§

ResolvedRef
The result of resolving a reference against the content graph.

Functions§

percent_decode_path
Percent-decode %XX byte sequences back to the on-disk name. The inverse of percent_encode_path_segments, and it lives next to it so the pair cannot drift.
percent_encode_path_segments
Percent-encode a path, segment by segment, preserving / as the separator.
percent_encode_url
URL-aware sibling of percent_encode_path_segments. Splits at the first ? or #, runs the segment encoder on the path portion, and re-attaches the query/fragment verbatim. Use this for any string that flows into an HTML src=/href= attribute or a markdown [alt](url) link, where the caller cannot guarantee the value is a pure path.
relative_asset_path
Compute a relative URL from from_path’s parent directory to to_path, preserving the target filename and extension. Each path segment is percent-encoded so spaces and non-ASCII characters round-trip safely through the markdown parser and HTML attribute boundaries.
relative_url
Compute the relative URL from one file to another using pretty URL format.
resolve_reference
Resolve a reference string against the content graph.
split_url_path
Split a URL into its path portion and any ?query / #fragment suffix. The split happens at the first occurrence of ? or # (whichever appears first); if neither is present the suffix is empty. The suffix is returned verbatim, including the leading ? / #.