Skip to content

Replace W3C validator check #1074

@edent

Description

@edent

We currently send all new SVGs to the W3C validator.

await fetch("https://validator.w3.org/nu/?out=gnu", {

This sometimes fails valid files with:

  1) images/svg/example.svg
       should be validated by the w3c validator:
     AssertionError: expected '<!DOCTYPE html><html lang="en-US"><he…' to be empty
      at /home/runner/work/SuperTinyIcons/SuperTinyIcons/test/test.js:45:38
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Context.<anonymous> (test/test.js:38:13)

Is there a way to validate SVGs locally?

Some things I've tried which don't really work:

https://github.com/ietf-tools/svgcheck

  • Doesn't allow short colours "The attribute 'fill' does not allow the value '#fff', replaced with 'white'"

https://github.com/validator/validator/releases

https://github.com/sindresorhus/is-svg

  • Validator seems very weak. Approves files even with broken whitespace or extra text at the end.

Any other thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions