kangax / kangax/html-minifier

Feature Request: HTML Escaping

Open
#549 9 comments 2 reactions 0 assignees View on GitHub
possible-feature
Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

Use Case: I've got ~50 code examples in my site, in 6 languages. Those languages native syntax obviously causes Parse Errors with html-minifier because they aren't escaped. I've been escaping them, but it has become unmanageable and really tough to run/update these code samples. While there are solutions that I've been looking in to, I think a solution could be built into html-minifier:

```
options: {
escapeFragments: [ /

[\S\s]*<\/code><\/pre>/ ]

}
```

alternatively (though less preferable):

```

```

I tried solving this using `ignoreCustomFragments`, which made the build pass, but browsers render this incorrectly when you use code that resembles html open/close tags such as `Map batchMap = new HashMap();`

It seems like there's been enough issues posted about html entities that I'm not the only one that would benefit from a built in solution: #446 #195 #282

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.