Repository navigation
Linter
The linter analyses an SVG document to find and report problems with the document's contents.
- no-unknown-elements: reports elements that don't belong to it's parent's content-model
- no-unknown-attributes: reports attributes that don't belong to it's element's content model
- no-deprecated: reports elements and attributes that will be removed in SVG 2
- no-default-attributes: reports attributes that match their default value
- no-xlink: reports attributes in the xlink namespace
- unused-id: reports ids unreferences by styles, urls, etc.
- unused-xmlns: reports xmlns declarations that are unused
- invalid-attributes: reports attribute with invalid values
- missing-expected-attributes: reports elements missing a required attribute
The linter can be used either as a binary or as a language server.
The binary will analyse an SVG document and print a human-readable output.
The simplest way to run it is as follows
cat my-file.svg | oxvg lint checkThis let's you handle input and output yourself as you wish, but we do have some shortcuts for ease of use
# Read and report file to stdout
oxvg lint check my-file.svg
# Read and report many files to stdout
oxvg lint check svgs/
# Read and report many files and directories to stdout
oxvg lint check svgs/ -r
# Read and report many files and directories to stdout, including hidden files
oxvg lint check svgs/ -r -. --no-ignoreAs a language server you can view problems directly in your editor. The serve command will start a server that handles requests via stdin/stdout.
oxvg lint serve
There are currently no official editor distributions, but contributions to add editor plugins to this repo are more than welcome! If you use an editor that supports using language servers directly, you can try setting it up manually.
[[language]]
name = "svg"
scope = "source.svg"
file-types = ["svg"]
grammar = "xml"
language-servers = ["oxvg"]
formatter = { command = "oxvg", args = ["format"] }
auto-format = true
[language-server.oxvg]
command = "oxvg"
args = ["lint", "serve"]