uniorg icon indicating copy to clipboard operation
uniorg copied to clipboard

Lost space symbol after checkbox values

Open Artawower opened this issue 3 years ago • 2 comments

Hello! I tried to parse structure like this:

console.log(
  stringify(
    parse(`
- [ ] checkbox 1
- [ ] checkbox 2`)
  ),
  null,
  2
);

And i see next output:

- [ ]checkbox 1
- [ ]checkbox 2

But I was expecting the original text, is this expected behavior? (Space symbol is lost at the moment of parsing)

Artawower avatar Jul 31 '22 12:07 Artawower

Hey, thanks for the bug report!

It's more likely that space is lost in the uniorg-stringify rather than parser.

One option to fix that is to add trailing whitespace for checkboxes here: https://github.com/rasendubi/uniorg/blob/da79786f7c3afda29f8fb65052e09ca4fec6d4f3/packages/uniorg-stringify/src/stringify.ts#L86-L92

rasendubi avatar Aug 06 '22 11:08 rasendubi

That makes sense, I thought it was a parser, because I expected the space character to be inside the "value" property. And a structure like children: [ { { { type: 'text', value: 'checkbox 2' } ] was expected as children: [ { { { type: 'text', value: ' checkbox 2' } ]. But if it's a stringify thing, that's probably even easier to fix 🙂

Artawower avatar Aug 08 '22 19:08 Artawower

This is fixed in [email protected]

rasendubi avatar Jan 29 '23 05:01 rasendubi