spezilinter

Crates.iospezilinter
lib.rsspezilinter
version1.1.2
sourcesrc
created_at2024-09-18 00:04:42.045343
updated_at2024-09-18 21:35:17.582163
descriptionspezifisch's linter for different file formats, linting for weirdly specific stuff
homepage
repositoryhttps://codeberg.org/spezifisch/spezilinter
max_upload_size
id1378453
size3,933,894
(spezifisch)

documentation

README

spezilinter

spezilinter is a personal linter for validating and enforcing specific rules on my blog posts. Maybe you can reuse some parts for your own stuff!

Features

  • Markdown Custom Tags Linting:
    • Lint special tags that I defined for my blog.
    • Checks if linked image file exists.
    • Validates image formats (JPG, PNG, etc.).
  • JPG: Validates that EXIF metadata has been stripped (e.g., GPS coordinates).
  • SVG (optional): Verifies SVG files for the presence of unsafe attributes like onload.

Installation

cargo install spezilinter

Usage

$ spezilinter --help
spezifisch's linter for different file formats, linting for weirdly specific stuff

Usage: spezilinter [OPTIONS] <files>...

Arguments:
  <files>...  List of markdown files to lint

Options:
      --root <root>          Root directory for resolving image paths [default: .]
      --disallow-onload      Disallow `onload` attribute in SVG files
      --stop-on-first-error  Stop on the first error encountered
  -h, --help                 Print help
  -V, --version              Print version

Development

Run

# inside this repository
cargo run -- --root <root-directory> <markdown-files>

Test

You'll need the bats package for this:

make ci

Pre-Commit Hook

Make sure to commit only cleanly formatted and tested code, please:

# run once
pre-commit install

# (optional) run manually
pre-commit run --all-files

License

GPL-3.0-only

Commit count: 0

cargo fmt