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

字符串中包含换行,能否忽略 #143

Open
linlinyang opened this issue May 22, 2024 · 2 comments
Open

字符串中包含换行,能否忽略 #143

linlinyang opened this issue May 22, 2024 · 2 comments

Comments

@linlinyang
Copy link

参考demo

  <code-diff
      old-string="const a = 2;"
      :new-string="'const a = 2;\nlet b = 3;'"
  ></code-diff>

期望const a = 2;这段应该不是差异
有处理办法吗

@Shimada666
Copy link
Owner

@09473ZH

@Jebediah-Hang
Copy link

检查新旧字符串是否都以换行符\n结尾( 正则 /\n$/),如果不是的话,就在字符串末尾添加换行符,确保新旧字符串都是以换行符结尾,就可以处理这种情况了。

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

No branches or pull requests

3 participants