Validation¶
Broken links are easy to miss – pages get renamed or moved, and references silently stop working. Zensical validates all internal links at build time by scanning every Markdown file and resolving all references: inline links, reference-style links, footnotes, link definitions, and anchors.
Additionally, the build can be aborted when issues are found by enabling strict mode.
Configuration¶
Validation is enabled by default. All checks can be individually toggled:
Validation can also be completely disabled:
Links and footnotes¶
The following checks for links and footnotes are available:
unresolved_referencesunresolved_footnotesunused_definitionsunused_footnotesshadowed_definitionsshadowed_footnotesinvalid_linksinvalid_link_anchors
unresolved_references¶
Warn when a link or image reference has no matching definition.
Example
unresolved_footnotes¶
Warn when a footnote reference has no matching definition.
Example
unused_definitions¶
Warn when a link definition is never referenced.
Example
unused_footnotes¶
Warn when a footnote definition is never referenced.
Example
shadowed_definitions¶
Warn when a link definition is declared more than once.
Example
This [reference][id] has two definitions.
[id]: https://example.com/shadowed
[id]: https://example.com
shadowed_footnotes¶
Warn when a footnote definition is declared more than once.
Example
invalid_links¶
Warn when a link points to a page that does not exist.
Example
invalid_link_anchors¶
Warn when a link points to an anchor that does not exist.
Example
Usage¶
Just you write your content as usual, and Zensical will automatically validate all links and footnotes at build time.
If issues are found, a warning is emitted with the file name, line number, and a helpful message.
Escaping¶
If you want to intentionally wrap a phrase with brackets without creating a link, you can escape the opening bracket with a backslash, i.e., \[. The closing bracket does not need to be escaped:
While escaping is technically not necessary when no link definition is present, it is recommended to avoid accidentally creating a link when a definition is later added.
Moreover, link validation assumes that bracketed phrases are intended to be links or footnotes, so it will emit warnings for any unresolved references or unused definitions. Escaping allows you to avoid these warnings and clearly indicate that the brackets are not meant to create a link.
Strict mode¶
If you want to enforce link validation and fail the build when issues are found, you can enable strict mode by using the --strict command-line option:
The build is aborted after reporting all issues, and the exit code is set to 1 to indicate failure. This can be useful in CI/CD pipelines to ensure that all links are valid before deploying the site.