toolkit for mdBook [mirror of my GitHub repo] docs.tonywu.dev/mdbookkit/
permalinks rust-analyzer mdbook
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[docs] socials

+180 -7
+71
Cargo.lock
··· 195 195 checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" 196 196 197 197 [[package]] 198 + name = "bytemuck" 199 + version = "1.22.0" 200 + source = "registry+https://github.com/rust-lang/crates.io-index" 201 + checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" 202 + 203 + [[package]] 198 204 name = "byteorder" 199 205 version = "1.5.0" 200 206 source = "registry+https://github.com/rust-lang/crates.io-index" 201 207 checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 208 + 209 + [[package]] 210 + name = "byteorder-lite" 211 + version = "0.1.0" 212 + source = "registry+https://github.com/rust-lang/crates.io-index" 213 + checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" 202 214 203 215 [[package]] 204 216 name = "bytes" ··· 637 649 version = "2.3.0" 638 650 source = "registry+https://github.com/rust-lang/crates.io-index" 639 651 checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 652 + 653 + [[package]] 654 + name = "fdeflate" 655 + version = "0.3.7" 656 + source = "registry+https://github.com/rust-lang/crates.io-index" 657 + checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" 658 + dependencies = [ 659 + "simd-adler32", 660 + ] 640 661 641 662 [[package]] 642 663 name = "flate2" ··· 1252 1273 ] 1253 1274 1254 1275 [[package]] 1276 + name = "image" 1277 + version = "0.25.6" 1278 + source = "registry+https://github.com/rust-lang/crates.io-index" 1279 + checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a" 1280 + dependencies = [ 1281 + "bytemuck", 1282 + "byteorder-lite", 1283 + "image-webp", 1284 + "num-traits", 1285 + "png", 1286 + ] 1287 + 1288 + [[package]] 1289 + name = "image-webp" 1290 + version = "0.2.1" 1291 + source = "registry+https://github.com/rust-lang/crates.io-index" 1292 + checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f" 1293 + dependencies = [ 1294 + "byteorder-lite", 1295 + "quick-error", 1296 + ] 1297 + 1298 + [[package]] 1255 1299 name = "indexmap" 1256 1300 version = "2.8.0" 1257 1301 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1616 1660 checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" 1617 1661 dependencies = [ 1618 1662 "adler2", 1663 + "simd-adler32", 1619 1664 ] 1620 1665 1621 1666 [[package]] ··· 1946 1991 checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" 1947 1992 1948 1993 [[package]] 1994 + name = "png" 1995 + version = "0.17.16" 1996 + source = "registry+https://github.com/rust-lang/crates.io-index" 1997 + checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" 1998 + dependencies = [ 1999 + "bitflags 1.3.2", 2000 + "crc32fast", 2001 + "fdeflate", 2002 + "flate2", 2003 + "miniz_oxide", 2004 + ] 2005 + 2006 + [[package]] 1949 2007 name = "portable-atomic" 1950 2008 version = "1.11.0" 1951 2009 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2037 2095 ] 2038 2096 2039 2097 [[package]] 2098 + name = "quick-error" 2099 + version = "2.0.1" 2100 + source = "registry+https://github.com/rust-lang/crates.io-index" 2101 + checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" 2102 + 2103 + [[package]] 2040 2104 name = "quote" 2041 2105 version = "1.0.40" 2042 2106 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2472 2536 dependencies = [ 2473 2537 "libc", 2474 2538 ] 2539 + 2540 + [[package]] 2541 + name = "simd-adler32" 2542 + version = "0.3.7" 2543 + source = "registry+https://github.com/rust-lang/crates.io-index" 2544 + checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" 2475 2545 2476 2546 [[package]] 2477 2547 name = "similar" ··· 2986 3056 "anyhow", 2987 3057 "clap", 2988 3058 "glob", 3059 + "image", 2989 3060 "lol_html", 2990 3061 "minijinja", 2991 3062 "serde",
+2
README.md
··· 1 1 # mdbookkit 2 + 3 + ![mdbookkit hero image](docs/src/media/social.webp)
+5 -2
crates/mdbookkit/README.md
··· 1 - # mdbookkit — _toolkit for 📖 [mdBook]!_ 1 + # mdbookkit 2 + 3 + ![mdbookkit hero image](/docs/src/media/social.webp) 2 4 3 - [`mdbookkit`] provides quality-of-life plugins that you can use in your mdBook project. 5 + [`mdbookkit`] provides quality-of-life plugins that you can use in your [mdBook] 6 + project. 4 7 5 8 Right now, there are two mdBook [preprocessors], both for generating **correct and 6 9 versioned** external links from **easy-to-write** markup.
+86 -1
docs/app/main.css
··· 140 140 margin-block-end: 0; 141 141 } 142 142 } 143 + 144 + tr > td:first-of-type { 145 + white-space: nowrap; 146 + 147 + @media screen and (max-width: 420px) { 148 + white-space: normal; 149 + } 150 + } 143 151 } 144 152 145 153 .table-wrapper { ··· 173 181 174 182 .mdbook-alerts { 175 183 padding: 0.3rem 0 0.5rem 1rem; 184 + border-left: 0.25rem solid var(--mdbook-alerts-color); 176 185 177 186 .mdbook-alerts-title { 178 187 margin-block-end: 0; ··· 323 332 margin-block-end: 0; 324 333 } 325 334 326 - @media screen and (max-width: 768px) { 335 + @media screen and (max-width: 620px) { 327 336 overflow-x: auto; 328 337 329 338 > * { ··· 339 348 .hljs { 340 349 padding: 0; 341 350 background-color: unset; 351 + } 352 + } 353 + 354 + /* à la Google's developer docs */ 355 + 356 + @media screen and (max-width: 420px) { 357 + :root { 358 + /* 15px */ 359 + --page-padding: 0; 360 + } 361 + 362 + .content { 363 + /* 5px */ 364 + padding: 0; 365 + } 366 + 367 + .content main { 368 + > * { 369 + padding-inline: 20px; 370 + } 371 + 372 + > ul, 373 + > ol { 374 + padding-inline-start: 40px; 375 + } 376 + 377 + > p:has(> img) { 378 + padding-inline: 0; 379 + } 380 + 381 + > figure { 382 + padding-inline: 0; 383 + margin-block-end: 1rem; 384 + 385 + > figcaption { 386 + padding-inline: 20px; 387 + } 388 + 389 + &:not(.fig-text) { 390 + padding-inline: 0; 391 + } 392 + 393 + &.fig-text { 394 + padding: 0.8rem 20px; 395 + } 396 + 397 + > pre { 398 + padding-inline: 0; 399 + margin-block-end: 1rem; 400 + 401 + > code { 402 + padding: 0.8rem 20px; 403 + } 404 + } 405 + } 406 + 407 + > pre { 408 + padding-inline: 0; 409 + margin-block-end: 1rem; 410 + 411 + > code { 412 + padding: 0.8rem 20px; 413 + } 414 + } 415 + 416 + > blockquote { 417 + padding-inline-start: calc(20px - 0.25rem); 418 + } 419 + 420 + > .mdbook-alerts { 421 + padding-inline-end: 15px; 422 + } 423 + } 424 + 425 + .nav-wrapper { 426 + padding: 0 20px 32px 20px; 342 427 } 343 428 } 344 429
docs/app/socials.pxd

This is a binary file and will not be displayed.

+3 -3
docs/book.toml
··· 63 63 default-theme-color = "#0f1419" 64 64 65 65 [_metadata.socials."/"] 66 - image = "src/media/social.png" 66 + image = "src/media/social.webp" 67 67 title = "mdbookkit" 68 68 69 69 [_metadata.socials."/rustdoc-link"] 70 - image = "src/rustdoc-link/media/social.png" 70 + image = "src/rustdoc-link/media/social.webp" 71 71 title = "mdbook-rustdoc-link" 72 72 73 73 [_metadata.socials."/link-forever"] 74 - image = "src/link-forever/media/social.png" 74 + image = "src/link-forever/media/social.webp" 75 75 title = "mdbook-link-forever"
docs/src/media/social.png

This is a binary file and will not be displayed.

docs/src/media/social.webp

This is a binary file and will not be displayed.

docs/src/rustdoc-link/media/social.png

This is a binary file and will not be displayed.

docs/src/rustdoc-link/media/social.webp

This is a binary file and will not be displayed.

+1 -1
utils/clap-reflect/src/main.rs
··· 111 111 {% for option in options %} 112 112 113 113 <tr> 114 - <td style="text-align: left; white-space: nowrap;"> 114 + <td style="text-align: left;"> 115 115 116 116 [`{{ option.key }}`](#{{ option.key }}) 117 117
+4
utils/mdbook-socials/Cargo.toml
··· 13 13 anyhow = { workspace = true } 14 14 clap = { workspace = true } 15 15 glob = "0.3.2" 16 + image = { version = "0.25.6", features = [ 17 + "png", 18 + "webp", 19 + ], default-features = false } 16 20 lol_html = "2.2.0" 17 21 minijinja = { workspace = true } 18 22 serde = { workspace = true }
+8
utils/mdbook-socials/src/main.rs
··· 162 162 elem.remove(); 163 163 Ok(()) 164 164 }), 165 + element!(r#"img[src]"#, |elem| { 166 + let src = elem.get_attribute("src").unwrap(); 167 + let src = url.join(&src)?; 168 + let img = image::open(src.to_file_path().unwrap())?; 169 + elem.set_attribute("width", &img.width().to_string())?; 170 + elem.set_attribute("height", &img.height().to_string())?; 171 + Ok(()) 172 + }), 165 173 element!(r#"meta[name="description"]"#, |elem| { 166 174 let meta = jinja.get_template("index.html").unwrap().render(&ctx)?; 167 175 elem.set_attribute("content", &og_description)?;