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

fix: wrong escape with link, image url when converting #2105

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

js87zz
Copy link
Contributor

@js87zz js87zz commented Dec 9, 2021

Please check if the PR fulfills these requirements

  • It's the right issue type on the title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has a description of the breaking change

Description


Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

Copy link

@adhrinae adhrinae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료합니다.

@@ -12,6 +12,31 @@ const reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-
const reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
const reEscapePairedChars = /[*_~`]/g;

const XMLSPECIAL = '[&<>"]';
const reXmlSpecial = new RegExp(XMLSPECIAL, 'g');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 정규표현식은 리터럴로 표현이 안되어서 RegExp 객체로 만드신건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저 문자열들을 따로 사용해서 정규식을 만드는 경우가 있을 수 있어서 이전에 마크다운 파서에서처럼 똑같이 분리해서 작성해두었습니다. 추후 따로 재사용성이 전혀 없다고 판단되면 그때 통합할게요~

@js87zz js87zz force-pushed the fix/link-escape-when-converting branch from 27afee8 to aa13340 Compare December 10, 2021 10:30
@js87zz js87zz merged commit bc6f31b into master Dec 10, 2021
@js87zz js87zz deleted the fix/link-escape-when-converting branch December 10, 2021 10:38
@ibedarev
Copy link

Hi. Why do you need to escape &?

@js87zz
Copy link
Contributor Author

js87zz commented Feb 2, 2022

@ibedarev
It's mistake. It will be fixed.

ahamelers pushed a commit to ahamelers/tui.editor that referenced this pull request Aug 21, 2023
* fix: wrong escape with link, image url

* chore: add test case(image, link url escape)
@cary-hu
Copy link

cary-hu commented Nov 15, 2023

Why not using encodeURI for url encode

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

Successfully merging this pull request may close these issues.

4 participants