()
| 68 | |
| 69 | |
| 70 | def main() -> int: |
| 71 | markdown_files = git_ls_files("*.md") |
| 72 | |
| 73 | if not markdown_files: |
| 74 | print("No Markdown files found. Skipping internal link validation.") |
| 75 | return 0 |
| 76 | |
| 77 | failed = False |
| 78 | |
| 79 | for path in markdown_files: |
| 80 | markdown_text = strip_fenced_code(read_text(path)) |
| 81 | |
| 82 | for target in extract_link_targets(markdown_text): |
| 83 | resolved_path = resolve_local_target(path, target) |
| 84 | if resolved_path is None: |
| 85 | continue |
| 86 | |
| 87 | if not resolved_path.exists(): |
| 88 | print( |
| 89 | f"FAILED: {display_path(path)}: internal link target not found: {target}" |
| 90 | ) |
| 91 | failed = True |
| 92 | |
| 93 | return 1 if failed else 0 |
| 94 | |
| 95 | |
| 96 | if __name__ == "__main__": |
no test coverage detected