30 releases

0.8.2 Sep 30, 2024
0.8.1 Jul 27, 2024
0.7.0 Jun 15, 2024
0.6.4 Mar 16, 2024
0.1.5 Mar 29, 2023

#156 in Images

Download history 20/week @ 2024-06-17 3/week @ 2024-06-24 10/week @ 2024-07-01 100/week @ 2024-07-22 209/week @ 2024-07-29 1/week @ 2024-08-05 3/week @ 2024-08-12 21/week @ 2024-09-16 48/week @ 2024-09-23 195/week @ 2024-09-30

264 downloads per month

MIT/Apache

47KB
187 lines

mdbook-tailor

This is a preprocessor for mdbook.

We plan to take some more time before a major release 🐣

🔺It includes some issues as noted in Issues.

Purpose

The following warnings in PageSpeed Insights can be eliminated by using this preprocessor.

warning

Explicitly setting the width and height of image elements will reduce layout deviations and improve CLS.

Corresponding image file

The image files that this project can handle depend on Imaging library.

An Image Processing Library

It supports PNG, JPEG, GIF, WebP etc. as generally used in web pages 😉

🔺AVIF is not currently supported.

Installation

  1. Use cargo to install.
cargo install mdbook-tailor
  1. Add the following to book.toml.
[preprocessor.tailor]

Usage

  1. Use markdown notation as usual.
![example](example.webp)
  1. Do the mdbook build as usual.
mdbook build

The HTML generated from the above steps should contain the image size as measured by the mdbook-tailor. In addition, a delayed loading setting will be added!

<img src="example.webp" alt="example" width="789" height="456" loading="lazy">

Example

This is actually a site I am producing myself ☺️

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~13–24MB
~373K SLoC