You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the trailing spaces will be ignored. In most cases it makes sense - probably the whitespace is there by mistake. The problem is that when creating a new block programmatically with Mark.New the trimming is also applied. This makes incremental updates to string block difficult.
Say I have a text input that on change replaces the text block:
setTitle:Mark.Edit.Id->String->Mark.Parsed->Result (ListError) Mark.ParsedsetTitle id value ast =let
block =Mark.New.string value
edit =Mark.Edit.replace id block
inMark.update document edit ast
This works great except when a user tries to insert a space at the end of the field with intention of adding another word after it. Then the space simply does not get added.
It seems to me that trimming should be applied when parsing, but not when blocks are created with Mark.New.string.
The text was updated successfully, but these errors were encountered:
After some investigation I see that actually the whitespace is preserved in AST (Mark.Parsed) and trimmed when it's rendered. It seems to me that trimming should be a responsibility of the parser, not the render function. I'll prepare a PR. Please let me know if you disagree.
Trailing spaces from string blocks were not rendered, even when the
block was created using Mark.New.string. This commit removes trimming
when string is rendered and instead adds trimming to string block
parser. That way documents parsed from string behave the same as before,
but programmatically inserted whitespace is preserved.
When parsing a string block like this:
the trailing spaces will be ignored. In most cases it makes sense - probably the whitespace is there by mistake. The problem is that when creating a new block programmatically with
Mark.New
the trimming is also applied. This makes incremental updates tostring
block difficult.Say I have a text input that on change replaces the text block:
This works great except when a user tries to insert a space at the end of the field with intention of adding another word after it. Then the space simply does not get added.
It seems to me that trimming should be applied when parsing, but not when blocks are created with
Mark.New.string
.The text was updated successfully, but these errors were encountered: