This commit is contained in:
yuin 2021-09-11 11:20:50 +09:00
parent f37563cfa8
commit 351308fb72
3 changed files with 16 additions and 2 deletions

View file

@ -381,9 +381,17 @@ a* b c d *e*
<aaa >
//= = = = = = = = = = = = = = = = = = = = = = = =//
25: code block starts with tab
25: Indented code blocks can start with tab
//- - - - - - - - -//
x
//- - - - - - - - -//
<pre><code> x</code></pre>
//= = = = = = = = = = = = = = = = = = = = = = = =//
26: NUL bytes must be replaced with U+FFFD
OPTIONS: {"enableEscape": true}
//- - - - - - - - -//
hello\x00world
//- - - - - - - - -//
<p>hello\ufffdworld</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

View file

@ -719,6 +719,12 @@ func (d *defaultWriter) Write(writer util.BufWriter, source []byte) {
continue
}
}
if c == '\x00' {
d.RawWrite(writer, source[n:i])
d.RawWrite(writer, []byte("\ufffd"))
n = i + 1
continue
}
if c == '&' {
pos := i
next := i + 1

View file

@ -223,7 +223,7 @@ Diff
if err := m.Convert([]byte(source(&testCase)), &out, opts...); err != nil {
panic(err)
}
ok = bytes.Equal(bytes.TrimSpace(out.Bytes()), []byte(expected(&testCase)))
ok = bytes.Equal(bytes.TrimSpace(out.Bytes()), bytes.TrimSpace([]byte(expected(&testCase))))
}
type diffType int