MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / NormalizeWhitespace

Class NormalizeWhitespace

markdown/preprocessors.py:66–75  ·  view source on GitHub ↗

Normalize whitespace for consistent parsing.

Source from the content-addressed store, hash-verified

64
65
66class NormalizeWhitespace(Preprocessor):
67 """ Normalize whitespace for consistent parsing. """
68
69 def run(self, lines: list[str]) -> list[str]:
70 source = '\n'.join(lines)
71 source = source.replace(util.STX, "").replace(util.ETX, "")
72 source = source.replace("\r\n", "\n").replace("\r", "\n") + "\n\n"
73 source = source.expandtabs(self.md.tab_length)
74 source = re.sub(r'(?<=\n) +\n', '\n', source)
75 return source.split('\n')
76
77
78class HtmlBlockPreprocessor(Preprocessor):

Callers 1

build_preprocessorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…