blob: dfb67efd15bfb6dba7faa52c3525eaf05140fd37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// Normalize input string
// https://spec.commonmark.org/0.29/#line-ending
const NEWLINES_RE = /\r\n?|\n/g
const NULL_RE = /\0/g
export default function normalize (state) {
let str
// Normalize newlines
str = state.src.replace(NEWLINES_RE, '\n')
// Replace NULL characters
str = str.replace(NULL_RE, '\uFFFD')
state.src = str
}
|