Skip to content

Improve html escape #34911

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

Merged
merged 5 commits into from
Jul 1, 2025
Merged

Improve html escape #34911

merged 5 commits into from
Jul 1, 2025

Conversation

wxiaoguang
Copy link
Contributor

drop "escape-goat"

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 30, 2025
@wxiaoguang wxiaoguang added type/refactoring Existing code has been cleaned up. There should be no new functionality. and removed modifies/internal modifies/dependencies modifies/frontend labels Jun 30, 2025
@wxiaoguang wxiaoguang requested a review from silverwind June 30, 2025 11:02
@silverwind
Copy link
Member

Have you considered https://www.npmjs.com/package/lit-html?

@wxiaoguang
Copy link
Contributor Author

Have you considered https://www.npmjs.com/package/lit-html?

No, it too heavy and I believe we don't need it

@silverwind
Copy link
Member

silverwind commented Jun 30, 2025

Have you considered https://www.npmjs.com/package/lit-html?

No, it too heavy and I believe we don't need it

lit-html is pretty light and may have some features we want, thought I have never used it personally.

https://bundlephobia.com/package/lit-html@3.3.0

Also, the lint rule is designed for it:

https://github.com/github/eslint-plugin-github/blob/main/docs/rules/unescaped-html-literal.md

@wxiaoguang
Copy link
Contributor Author

lit-html is pretty light and may have some features we want, thought I have never used it personally.

But it isn't ... I have read their code.

Another problem is that even if we'd like to introduce lit-html, we still need to refactor the existing code first.

Our existing code like svg just doesn't work with it.

@wxiaoguang
Copy link
Contributor Author

Also, the lint rule is designed for it:

https://github.com/github/eslint-plugin-github/blob/main/docs/rules/unescaped-html-literal.md

It is designed to be general rule to check "html" prefix.

BTW: the check isn't complete, I proposed an update: https://github.com/github/eslint-plugin-github/pull/639

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 30, 2025
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Jul 1, 2025

@silverwind anything else to address?

Introducing lit-html or not, this PR is always necessary to refactor the existing code. And our html function is a subset of lit-html so it won't block us from introducing lit-html in the future (although I guess no in the near future)

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 1, 2025
@wxiaoguang wxiaoguang merged commit 1d4ad5a into go-gitea:main Jul 1, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.25.0 milestone Jul 1, 2025
@wxiaoguang wxiaoguang deleted the fix-js-html branch July 1, 2025 13:44
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 2, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Improve html escape (go-gitea#34911)
  Adds tooltip on branch commit counts (go-gitea#34869)
  Fix PR toggle WIP (go-gitea#34920)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/dependencies modifies/frontend modifies/internal type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants