Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
normalize.py20 linesDownload Raw Back to rules_core
1"""Normalize input string."""2 3import re4 5from .state_core import StateCore6 7# https://spec.commonmark.org/0.29/#line-ending8NEWLINES_RE = re.compile(r"\r\n?|\n")9NULL_RE = re.compile(r"\0")10 11 12def normalize(state: StateCore) -> None:13    # Normalize newlines14    string = NEWLINES_RE.sub("\n", state.src)15 16    # Replace NULL characters17    string = NULL_RE.sub("\ufffd", string)18 19    state.src = string20 
codekingpro/portable-devtools · Team Ai