Skip to content

refactor(strip_html): remove striptags deps#232

Merged
SukkaW merged 1 commit intohexojs:masterfrom
SukkaW:strip-html
Sep 20, 2020
Merged

refactor(strip_html): remove striptags deps#232
SukkaW merged 1 commit intohexojs:masterfrom
SukkaW:strip-html

Conversation

@SukkaW
Copy link
Member

@SukkaW SukkaW commented Sep 20, 2020

striptags is the most safe strip HTML lib (as it implements a AST parser instead of using regex).

However:

  • striptags implements a simple Symbol polyfill that Hexo doesn't need (we target latest Node.js LTS)
  • striptags supports stream and many other features (like tags whitelist) that Hexo doesn't need as well
  • In order to supports those features striptags introduce a bit performance drawback.

The PR re-implements the striptags without those unneeded features. The unit test cases are adopted from striptags.

@SukkaW SukkaW requested a review from a team September 20, 2020 14:17
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 97.661% when pulling 732602d on SukkaW:strip-html into 19315b8 on hexojs:master.

@SukkaW SukkaW merged commit 57f70d9 into hexojs:master Sep 20, 2020
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
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.

3 participants