MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / normalize_separator

Function normalize_separator

scripts/fix_markdown_tables.py:54–66  ·  view source on GitHub ↗

Normalize separator row.

(line: str, expected_cols: int = 0)

Source from the content-addressed store, hash-verified

52
53
54def normalize_separator(line: str, expected_cols: int = 0) -> str:
55 """Normalize separator row."""
56 stripped = line.strip().rstrip(" ")
57 if stripped.startswith("|"):
58 stripped = stripped[1:]
59 if stripped.endswith("|"):
60 stripped = stripped[:-1]
61 parts = [p.strip() for p in stripped.split("|")]
62 if expected_cols > 0:
63 while len(parts) < expected_cols:
64 parts.append("---")
65 parts = parts[:expected_cols]
66 return "| " + " | ".join(parts) + " |"
67
68
69def fix_tables_in_content(content: str) -> str:

Callers 1

fix_tables_in_contentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected