#422
createJsonRenderTransform: the indent of a patch line leaks into the prose
Version: @json-render/core 0.21.0
When a patch line is indented, the transform emits the leading whitespace as prose before it starts buffering at {. The prose then carries stray spaces where the patch line was.
Repro
Stream x\n {"op":"add","path":"/root","value":"report"}\ny:
- Expected: prose
x\nyand one patch. - Actual: prose
x\n yand one patch.
Ask
Hold leading whitespace at the start of a line until the line is known not to be a patch.
Opened https://github.com/vercel-labs/json-render/pull/432 with a fix and regression coverage. Leading whitespace is held until the line is classified, so indented patch lines no longer add spaces to the prose; ordinary indentation and blank lines are preserved. Coverage includes chunk boundaries and stream closure.