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

Leading spaces at the beginning of the next line are not ignored when using a backslash as a hard line break #619

Open
danjelalura opened this issue Jul 29, 2024 Discussed in #618 · 1 comment · Fixed by acrolinx/flexmark-java#1

Comments

@danjelalura
Copy link

Discussed in #618

Originally posted by danjelalura July 24, 2024
Hello community,

This piece of text:

foo\
     bar

and this piece of text:

foo  
     bar

are represented differently in the DOM when parsed.

In the first case, a backslash is used as a hard line break and in the second case 2 spaces are used as a hard line break. Even though both of these representations of a hard line break are shown as HardLineBreak, for the first case, the spaces at the beginning of the next line are not ignored. The offsets however, disregard the whitespaces.

First case:

Document[0, 13]
      Paragraph[0, 13]
              Text[0, 3] chars:[0, 3, "foo"]
              HardLineBreak[3, 5]
              Text[10, 13] chars:[10, 13, "     bar"] 

Second case:

Document[0, 14]
      Paragraph[0, 14]
              Text[0, 3] chars:[0, 3, "foo"]
              HardLineBreak[3, 6]
              Text[11, 14] chars:[11, 14, "bar"] 

I am having a hard time understanding why this happens. This could potentially lead to issues when making use of the information provided by the above representation.
Thank you for your help!

@Kijimuna
Copy link
Contributor

@vsch What seems suspicious in regards to that issue is that no "leading-space-gobbling" seems to happen in case of a backslash-hardline-break, in contrast to all other line breaks 🤔.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants