scanner
Primitives partagées de scan de fichiers Markdown OKF.
Shared Markdown file scanning primitives for OKF.
- class okflint.scanner.Header(level, text, line)[source]
Bases:
objectRepresents an H1 or H2 heading in a file.
- class okflint.scanner.MarkdownLink(text, target, is_external, broken)[source]
Bases:
objectRepresents a markdown link [text](url) in a file.
- class okflint.scanner.WikiLink(raw, target, alias, section, resolved_path, broken, ambiguous)[source]
Bases:
objectRepresents an Obsidian wikilink [[…]] in a file.
- okflint.scanner.blank_code_spans(content)[source]
Blank out fenced code blocks and inline code spans.
Allows link extraction without false positives inside code zones. Replaces code zone content with spaces while preserving character positions (line numbers unchanged). An unclosed fence at end of file is treated as open until EOF.
- okflint.scanner.build_file_index(roots, exclude_patterns=None)[source]
Index all .md files under a list of roots for wikilink resolution.
- Parameters:
- Return type:
- Returns:
Dictionary stem → list of paths relative to the first root.
- okflint.scanner.extract_headers(content)[source]
Extract H1 and H2 headings with their line number in the body.
Must receive content pre-blanked via blank_code_spans to ignore # characters inside code blocks.
- okflint.scanner.extract_markdown_links(content, file_path, bundle_path)[source]
Extract [text](target) markdown links and verify internal links.
External URLs (http:// / https://) are not checked.
- Parameters:
- Return type:
- Returns:
List of MarkdownLink.