pyssg is pre-1.0 and under active development - APIs, config, and themes may change.
pyssg.plugins.link_resolver

1 min read

pyssg.plugins.link_resolver

Internal link resolver.

Rewrites Markdown links to local .md files into the target page's resolved URL, and records a LINK connection (reverse) per resolved link so backlinks work. Runs during evaluate_collections -- after all documents are parsed and their pages generated -- so every target URL is known.

Rewriting always starts from the document's pre-resolution HTML (__content_html_raw__), so a target moving/renaming updates the link on the next finalize even though the linking document was not itself re-parsed. The rewritten content_html is re-hashed, which is what makes the render sweep re-render a page whose link targets changed (keeping incremental == full).

rewrite_links(build: Build, html: str, doc: Document) -> str

finalize_content tap: rewrite internal .md links + record LINK edges.

class LinkResolverPlugin

Resolves and rewrites internal Markdown links.

LinkResolverPlugin.apply(self, builder: Builder) -> None

Factory used in pyssg.config.py.