sesh / ready

Are you production ready?
ISC License
26 stars 4 forks source link

Check for unnecessary HTML entities #13

Closed Seirdy closed 1 year ago

Seirdy commented 1 year ago

Characters such as “”’ are perfectly valid in HTML, and don't need HTML entities. The Google Style Guide recommends only using entities where reasonable, and I am inclined to agree: they make the HTML source less readable and larger.

sesh commented 1 year ago

Google style guide reference for this: https://google.github.io/styleguide/htmlcssguide.html#Entity_References

There is no need to use entity references like —, ”, or ☺, assuming the same encoding (UTF-8) is used for files and editors as well as among teams.

This is somewhat vague, but I think I can add a check for this.

sesh commented 1 year ago

MDN page for this one: https://developer.mozilla.org/en-US/docs/Glossary/Entity

This links to the "official" list of named entities: https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references

sesh commented 1 year ago

I've gone with a regular expression to find the entities and a warning for this one.