Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paragraph text is split into separate tokens when using backslash #1906

Closed
calculuschild opened this issue Jan 20, 2021 · 2 comments · Fixed by #1926
Closed

Paragraph text is split into separate tokens when using backslash #1906

calculuschild opened this issue Jan 20, 2021 · 2 comments · Fixed by #1926
Labels
category: inline elements L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue released

Comments

@calculuschild
Copy link
Contributor

Marked version: 1.2.7

Describe the bug
The inline.text rules seem to be splitting inline text when it encounters a backslash, resulting in two separate text tokens inside a paragraph token.

To Reproduce
Observe on the demo.

First second results in:

[
{type:"paragraph", raw:"First second", text:"First second", tokens:[
  {type:"text", raw:"First second", text:"First second"}
]}
]

But First\second results in

[
{type:"paragraph", raw:"First\\second", text:"First\\second", tokens:[
  {type:"text", raw:"First", text:"First"}
  {type:"text", raw:"\\second", text:"\\second"}
]}
]

Expected behavior
While the resulting HTML is the same, this causes issues when using, for instance, a custom text renderer. The expected string is instead sliced into multiple parts, which prevents handling of the complete string as a whole.

Either the two consecutive text tokens should be joined as they are in the "block" text, or the inline.text rules need to be fixed to not stop at the first backslash.

@UziTech
Copy link
Member

UziTech commented Jan 20, 2021

Hmm ... It looks like the block text combines the text tokens I think we could do something similar to inline text tokens.

@UziTech UziTech added L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue category: inline elements labels Jan 20, 2021
@github-actions
Copy link

github-actions bot commented Feb 7, 2021

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: inline elements L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants