Skip to main content

API Reference

Auto-generated reference documentation for all public modules in zenzic. This section is English-only, as the source docstrings are written in English.


zenzic.core.scanner

Filesystem scanning utilities: repo root discovery, orphan page detection, asset tracking, and placeholder scanning.

::: zenzic.core.scanner options: members:

  • find_repo_root
  • find_config_file
  • find_orphans
  • find_placeholders
  • find_unused_assets
  • find_missing_directory_indices
  • calculate_orphans
  • calculate_unused_assets
  • check_placeholder_content
  • check_asset_references

zenzic.core.scorer

Documentation quality scoring engine: weighted 0–100 score computation, snapshot persistence, and snapshot loading.

::: zenzic.core.scorer options: members:

  • compute_score
  • save_snapshot
  • load_snapshot
  • ScoreReport
  • CategoryScore

zenzic.core.validator

Validation logic: broken link detection via MkDocs and Python snippet syntax checking.

::: zenzic.core.validator options: members:

  • validate_links
  • validate_snippets
  • check_snippet_content
  • SnippetError

zenzic.models.config

Configuration model.

::: zenzic.models.config options: members:

  • ZenzicConfig

zenzic.rules — Plugin SDK façade

zenzic.rules is the canonical entry point for plugin authors. It re-exports the stable API surface from zenzic.core.rules and is the only path that is guaranteed to remain stable across major versions.

from zenzic.rules import BaseRule, RuleFinding, Severity, run_rule

BaseRule

Abstract base class for all plugin rules. Subclass this and implement check():

from zenzic.rules import BaseRule, RuleFinding, Severity

class NoDraftRule(BaseRule):
rule_id = "no-draft"

def check(self, file_path, line_no, line):
if "DRAFT" in line:
return [RuleFinding(
rule_id=self.rule_id,
file_path=file_path,
line_no=line_no,
message="DRAFT marker found",
severity=Severity.WARNING,
)]
return []

run_rule — Test helper

Runs a single rule against a Markdown string. No engine setup required — designed for unit tests:

from zenzic.rules import BaseRule, RuleFinding, run_rule

def test_no_draft_rule():
findings = run_rule(NoDraftRule(), "# My Page\n\nDRAFT content here.")
assert len(findings) == 1
assert findings[0].severity == "warning"

Canonical location: run_rule is implemented in zenzic.core.rules and re-exported from zenzic.rules. Both import paths work; prefer from zenzic.rules import run_rule in plugin code.

RuleFinding, Severity, Violation, CustomRule

NamePurpose
RuleFindingDataclass returned by BaseRule.check() — carries rule_id, file_path, line_no, message, severity
SeverityEnum: Severity.ERROR, Severity.WARNING, Severity.INFO
ViolationAlias of RuleFinding — kept for backward compatibility
CustomRuleTOML-declared rule engine — used internally; not for subclassing

Entry-point registration

Register your rule so zenzic inspect capabilities discovers it:

# In your plugin's pyproject.toml
[project.entry-points."zenzic.rules"]
my-rule-name = "my_package.rules:MyRuleClass"