diff --git a/Cargo.lock b/Cargo.lock index 14cc4c3..3f97cd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,6 +91,15 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "ar_archive_writer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a" +dependencies = [ + "object", +] + [[package]] name = "arbitrary" version = "1.4.2" @@ -100,6 +109,12 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "argparse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8ebf5827e4ac4fd5946560e6a99776ea73b596d80898f357007317a7141e47" + [[package]] name = "assetserver" version = "0.0.1" @@ -178,7 +193,7 @@ checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -187,6 +202,30 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitflags" version = "2.10.0" @@ -267,7 +306,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -288,6 +327,32 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "const_format" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -316,6 +381,26 @@ dependencies = [ "typenum", ] +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_arbitrary" version = "1.4.2" @@ -324,7 +409,20 @@ checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", +] + +[[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.108", ] [[package]] @@ -345,15 +443,30 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "emojis" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c1c1870b766fc398e5f0526498d09c94b6de15be5fd769a28bbc804fb1b05d" +dependencies = [ + "phf 0.13.1", +] + [[package]] name = "encoding_rs" version = "0.8.35" @@ -363,12 +476,29 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "entities" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "fancy-regex" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + [[package]] name = "find-msvc-tools" version = "0.1.4" @@ -492,7 +622,7 @@ dependencies = [ "indexmap", "lasso", "once_cell", - "phf", + "phf 0.11.3", "rand 0.8.5", ] @@ -518,6 +648,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "html-escape" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" +dependencies = [ + "utf8-width", +] + [[package]] name = "http" version = "1.3.1" @@ -708,6 +847,16 @@ dependencies = [ "zerovec", ] +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "1.1.0" @@ -829,6 +978,21 @@ dependencies = [ "zlib-rs", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linkify" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dfa36d52c581e9ec783a7ce2a5e0143da6237be5811a0b3153fedfdbe9f780" +dependencies = [ + "memchr", +] + [[package]] name = "litemap" version = "0.8.1" @@ -871,7 +1035,7 @@ name = "macro-assets" version = "0.0.1" dependencies = [ "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -880,16 +1044,30 @@ version = "0.0.1" dependencies = [ "grass", "quote", - "syn", + "syn 2.0.108", ] [[package]] -name = "markdown" -version = "1.0.0" +name = "markdown-it" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb" +checksum = "f99c010929c8217b2dc0940954267a2e15a15f17cb309cd1f299e21933f84fac" dependencies = [ - "unicode-id", + "argparse", + "const_format", + "derivative", + "derive_more", + "downcast-rs", + "entities", + "html-escape", + "linkify", + "mdurl", + "once_cell", + "readonly", + "regex", + "stacker", + "syntect", + "unicode-general-category", ] [[package]] @@ -928,7 +1106,18 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn", + "syn 2.0.108", +] + +[[package]] +name = "mdurl" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5736ba45bbac8f7ccc99a897f88ce85e508a18baec973a040f2514e6cdbff0d2" +dependencies = [ + "idna 0.3.0", + "once_cell", + "regex", ] [[package]] @@ -1033,6 +1222,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.46" @@ -1073,6 +1268,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -1121,7 +1325,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_macros", - "phf_shared", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_shared 0.13.1", ] [[package]] @@ -1130,7 +1343,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ - "phf_shared", + "phf_shared 0.11.3", "rand 0.8.5", ] @@ -1141,10 +1354,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" dependencies = [ "phf_generator", - "phf_shared", + "phf_shared 0.11.3", "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1156,6 +1369,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1168,6 +1390,19 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "plist" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" +dependencies = [ + "base64", + "indexmap", + "quick-xml", + "serde", + "time", +] + [[package]] name = "potential_utf" version = "0.1.4" @@ -1177,6 +1412,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1203,7 +1444,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", "version_check", ] @@ -1227,7 +1468,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1239,6 +1480,25 @@ dependencies = [ "prost", ] +[[package]] +name = "psm" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01" +dependencies = [ + "ar_archive_writer", + "cc", +] + +[[package]] +name = "quick-xml" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" +dependencies = [ + "memchr", +] + [[package]] name = "quinn" version = "0.11.9" @@ -1368,6 +1628,17 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "readonly" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2a62d85ed81ca5305dc544bd42c8804c5060b78ffa5ad3c64b0fb6a8c13d062" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -1478,7 +1749,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn", + "syn 2.0.108", "walkdir", ] @@ -1498,6 +1769,15 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustls" version = "0.23.34" @@ -1560,6 +1840,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "serde" version = "1.0.228" @@ -1587,7 +1873,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1632,10 +1918,11 @@ version = "0.0.1" dependencies = [ "assetserver", "axum", + "emojis", "libservice", "macro-assets", "macro-sass", - "markdown", + "markdown-it", "maud", "tracing", "utoipa", @@ -1728,6 +2015,19 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "stacker" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f8b29fb42aafcea4edeeb6b2f2d7ecd0d969c48b4cf0d2e64aafc471dd6e59" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.59.0", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1740,6 +2040,17 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.108" @@ -1768,7 +2079,28 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", +] + +[[package]] +name = "syntect" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925" +dependencies = [ + "bincode", + "fancy-regex", + "flate2", + "fnv", + "once_cell", + "plist", + "regex-syntax", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "walkdir", + "yaml-rust", ] [[package]] @@ -1788,7 +2120,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1800,6 +2132,37 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.2" @@ -1850,7 +2213,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1958,7 +2321,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2053,10 +2416,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] -name = "unicode-id" -version = "0.3.6" +name = "unicode-bidi" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ba288e709927c043cbe476718d37be306be53fb1fafecd0dbe36d072be2580" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-general-category" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" [[package]] name = "unicode-ident" @@ -2064,6 +2433,21 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "untrusted" version = "0.9.0" @@ -2077,11 +2461,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", - "idna", + "idna 1.1.0", "percent-encoding", "serde", ] +[[package]] +name = "utf8-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -2114,7 +2504,7 @@ checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2233,7 +2623,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -2313,6 +2703,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.60.2" @@ -2472,6 +2871,15 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yoke" version = "0.8.1" @@ -2491,7 +2899,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", "synstructure", ] @@ -2512,7 +2920,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2532,7 +2940,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", "synstructure", ] @@ -2572,7 +2980,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6381d38..79dd11a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,8 @@ utoipa-swagger-ui = { version = "9.0.2", features = [ ] } maud = { version = "0.27.0", features = ["axum"] } grass = "0.13.4" -markdown = "1.0.0" +markdown-it = "0.6.1" +emojis = "0.8.0" # # MARK: Async & Parallelism @@ -123,7 +124,6 @@ anyhow = "1.0.97" url = { version = "2.5.7", features = ["serde"] } num = "0.4.3" - # # Macro utilities # diff --git a/crates/service/service-webpage/Cargo.toml b/crates/service/service-webpage/Cargo.toml index d6c1369..9fee011 100644 --- a/crates/service/service-webpage/Cargo.toml +++ b/crates/service/service-webpage/Cargo.toml @@ -17,4 +17,5 @@ axum = { workspace = true } tracing = { workspace = true } utoipa = { workspace = true } maud = { workspace = true } -markdown = { workspace = true } +markdown-it = { workspace = true } +emojis = { workspace = true } diff --git a/crates/service/service-webpage/src/components/md.rs b/crates/service/service-webpage/src/components/md.rs index ec81979..a4dec77 100644 --- a/crates/service/service-webpage/src/components/md.rs +++ b/crates/service/service-webpage/src/components/md.rs @@ -1,106 +1,170 @@ -use markdown::{CompileOptions, Constructs, LineEnding, Options, ParseOptions}; +use emojis::Emoji; +use markdown_it::parser::inline::{InlineRule, InlineState}; +use markdown_it::{Node, NodeValue, Renderer}; use maud::{Markup, PreEscaped, Render}; pub struct Markdown<'a>(pub &'a str); -const OPTS: Options = Options { - parse: ParseOptions { - constructs: Constructs { - attention: true, - autolink: false, - block_quote: true, - character_escape: true, - character_reference: true, - code_indented: false, - code_fenced: true, - code_text: true, - definition: true, - frontmatter: false, - gfm_autolink_literal: true, - gfm_footnote_definition: false, - gfm_label_start_footnote: false, - gfm_strikethrough: false, - gfm_table: false, - gfm_task_list_item: false, - hard_break_escape: false, - hard_break_trailing: false, - heading_atx: true, - heading_setext: false, - label_start_image: false, - label_start_link: true, - label_end: true, - list_item: true, - math_flow: false, - math_text: false, - mdx_esm: false, - thematic_break: false, - - // INLINE HTML - html_flow: false, - html_text: false, - - // INLINE {} - mdx_expression_flow: true, - mdx_expression_text: true, - - // INLINE HTML (alternative) - mdx_jsx_flow: false, - mdx_jsx_text: false, - }, - - gfm_strikethrough_single_tilde: false, - math_text_single_dollar: false, - mdx_expression_parse: None, - mdx_esm_parse: None, - }, - - compile: CompileOptions { - allow_any_img_src: false, - allow_dangerous_html: false, - allow_dangerous_protocol: false, - default_line_ending: LineEnding::LineFeed, - gfm_footnote_back_label: None, - gfm_footnote_clobber_prefix: None, - gfm_footnote_label_attributes: None, - gfm_footnote_label_tag_name: None, - gfm_footnote_label: None, - gfm_task_list_item_checkable: false, - gfm_tagfilter: false, - }, -}; - impl Render for Markdown<'_> { fn render(&self) -> Markup { - /* - let mut ast = markdown::to_mdast(MD_A, &opts.parse).unwrap(); - let walk = AstWalkMut::new(&mut ast); + // TODO: init once + let md = &mut markdown_it::MarkdownIt::new(); + markdown_it::plugins::cmark::add(md); + markdown_it::plugins::html::add(md); + md.inline.add_rule::(); + md.inline.add_rule::(); - for i in walk { - match i { - AstWalkMutStep::Exit(node) => { - match node { - Node::MdxTextExpression(x) => { - println!("{x:?}"); - } - Node::MdxFlowExpression(x) => { - println!("{x:?}"); - } - _ => continue, - } + let md = md.parse(&self.0); + let html = md.render(); - *node = Node::Text(Text { - value: "LOL".to_owned(), - position: node.position().cloned(), - }) - } - _ => {} - } - } - - println!("{ast:?}"); - */ - - let md = markdown::to_html_with_options(self.0, &OPTS).unwrap(); - return PreEscaped(md); + return PreEscaped(html); } } + +// +// MARK: extensions +// + +#[derive(Debug)] +pub struct InlineEmote(&'static Emoji); + +impl NodeValue for InlineEmote { + fn render(&self, _node: &Node, fmt: &mut dyn Renderer) { + fmt.text(self.0.as_str()); + } +} + +impl InlineRule for InlineEmote { + const MARKER: char = ':'; + + fn run(state: &mut InlineState<'_, '_>) -> Option<(Node, usize)> { + let input = &state.src[state.pos..state.pos_max]; + + if !input.starts_with(':') { + return None; + } + + let end_idx = input[1..].find(':')? + 1; + let emote = emojis::get_by_shortcode(&input[1..end_idx])?; + + Some((Node::new(InlineEmote(emote)), end_idx + 1)) + } +} + +#[derive(Debug)] +pub struct InlineMdx(String); + +impl NodeValue for InlineMdx { + fn render(&self, node: &Node, fmt: &mut dyn Renderer) { + if mdx_style(&self.0, node, fmt) { + return; + } + + fmt.open("code", &[]); + fmt.text(&self.0); + fmt.close("code"); + } +} + +impl InlineRule for InlineMdx { + const MARKER: char = '{'; + + fn run(state: &mut InlineState<'_, '_>) -> Option<(Node, usize)> { + let input = &state.src[state.pos..state.pos_max]; + if !input.starts_with('{') { + return None; + } + + let mut balance = 1; + let mut end = 1; + for i in input[1..].bytes() { + match i { + b'}' => balance -= 1, + b'{' => balance += 1, + _ => {} + } + + if balance == 0 { + break; + } + + end += 1; + } + + if balance != 0 { + return None; + } + + let content = &input[1..end]; + Some((Node::new(InlineMdx(content.to_owned())), content.len() + 2)) + } +} + +fn mdx_style(mdx: &str, _node: &Node, fmt: &mut dyn Renderer) -> bool { + let mdx = mdx.trim(); + + if !mdx.starts_with("style(") { + return false; + } + + let skip = 6; + let mut balance = 1; + let mut end = skip; + for i in mdx[skip..].bytes() { + match i { + b')' => balance -= 1, + b'(' => balance += 1, + _ => {} + } + + if balance == 0 { + break; + } + + end += 1; + } + + if balance != 0 { + return false; + } + + let style = &mdx[skip..end].trim(); + let content = &mdx[end + 1..].trim(); + + let mut style_str = String::new(); + + for kv in style.split(";") { + let mut s = kv.split(":"); + let k = s.next(); + let v = s.next(); + + if k.is_none() || v.is_none() || s.next().is_some() { + return false; + } + + let k = k.unwrap().trim(); + let v = v.unwrap().trim(); + + match k { + "color" => { + style_str.push_str("color:"); + style_str.push_str(v); + style_str.push_str(";"); + } + + "color_var" => { + style_str.push_str("color:var(--"); + style_str.push_str(v); + style_str.push_str(");"); + } + + _ => continue, + } + } + + fmt.open("span", &[("style", style_str)]); + fmt.text(&content); + fmt.close("span"); + + return true; +} diff --git a/crates/service/service-webpage/src/routes/betalupi.rs b/crates/service/service-webpage/src/routes/betalupi.rs index e4a810d..91530a7 100644 --- a/crates/service/service-webpage/src/routes/betalupi.rs +++ b/crates/service/service-webpage/src/routes/betalupi.rs @@ -24,13 +24,7 @@ pub async fn betalupi() -> Markup { html!( (Backlinks(&[("/", "home")], "whats-a-betalupi")) - (Markdown(MD_A)) - - br {} - - (Markdown(MD_B)) - - br {} + (Markdown(MD)) img alt="betalupi map" class="image" src=(Image_Betalupi::URL) {} ) @@ -38,7 +32,7 @@ pub async fn betalupi() -> Markup { } } -const MD_A: &str = r#"[es]: https://github.com/endless-sky/endless-sky +const MD: &str = r#"[es]: https://github.com/endless-sky/endless-sky [*Stellaris*]: https://www.paradoxinteractive.com/games/stellaris/about [Arabic]: https://en.wikipedia.org/wiki/List_of_Arabic_star_names [wiki-betalupi]: https://en.wikipedia.org/wiki/Beta_Lupi @@ -52,10 +46,16 @@ Stellar names (especially those of [Arabic] origin) make pretty good hostnames: Beta Lupi also happens to be a real star in the southern constellation of Lupus ([wiki][wiki-betalupi]), but that's not particularly important. -A snippet of the [_Endless Sky_][es] map is below."#; +A snippet of the [_Endless Sky_][es] map is below. -const MD_B: &str = r#"**In other words:** Try finding a `.com` domain that... +
+ + +**In other words:** Try finding a `.com` domain that... - Isn't already taken - Doesn't sound awful -- Isn't owned by a scalper that's selling it for $300"#; +- Isn't owned by a scalper that's selling it for $300" + +
+"#; diff --git a/crates/service/service-webpage/src/routes/links.rs b/crates/service/service-webpage/src/routes/links.rs index 3be0042..d01a729 100644 --- a/crates/service/service-webpage/src/routes/links.rs +++ b/crates/service/service-webpage/src/routes/links.rs @@ -24,19 +24,7 @@ pub async fn links() -> Markup { html!( (Backlinks(&[("/", "home")], "links")) - (Markdown(MD_A)) - - hr style="margin-top: 8rem; margin-bottom: 8rem" {} - - (Markdown(MD_B)) - - hr style="margin-top: 8rem; margin-bottom: 8rem" {} - - (Markdown(MD_C)) - - hr style="margin-top: 8rem; margin-bottom: 8rem" {} - - (Markdown(MD_D)) + (Markdown(MD)) ) )) } @@ -49,11 +37,13 @@ https://www.commitstrip.com/en/ http://www.3dprintmath.com/ */ -const MD_A: &str = r#"# Bookmarks +const MD: &str = r#"# Bookmarks -This is a heavily opinionated bookmarks toolbar."#; +This is a heavily opinionated bookmarks toolbar. -const MD_B: &str = r#"## Podcasts +
+ +## Podcasts - :star: [Darknet Diaries](https://darknetdiaries.com/): A perennial classic. - [Art of Manliness](https://www.artofmanliness.com/podcast/): Philosophy, literaure, psychology. @@ -88,9 +78,11 @@ const MD_B: &str = r#"## Podcasts - [User Friendly](https://en.wikipedia.org/wiki/User_Friendly): Old-school. Offline and archived. - [PhD Comics](https://phdcomics.com/): Quality academic humor. Discontinued. - :star: [Spintronics](https://store.upperstory.com/collections/spintronics/products/spintronics-act-one): Mechanical circuits. Very clever toy. -- :star: [Turing Tumble](https://store.upperstory.com/collections/turing-tumble-game/products/turing-tumble): Modern Dr. Nim"#; +- :star: [Turing Tumble](https://store.upperstory.com/collections/turing-tumble-game/products/turing-tumble): Modern Dr. Nim -const MD_C: &str = r#"## Tools +
+ +## Tools - :star: [Numbat](https://numbat.dev/) - [MxToolbox](https://mxtoolbox.com/) @@ -157,9 +149,12 @@ const MD_C: &str = r#"## Tools ## Rust - [Understanding Memory Ordering in Rust](https://emschwartz.me/understanding-memory-ordering-in-rust/) -- [Unfair Rust Quiz](https://this.quiz.is.fckn.gay/): wtfjs, but in Rust."#; +- [Unfair Rust Quiz](https://this.quiz.is.fckn.gay/): wtfjs, but in Rust. -const MD_D: &str = r#"## Misc + +
+ +## Misc - [Slide Rule Collection](https://www.followingtherules.info/) - [MK-61 Command Reference](http://www.thimet.de/CalcCollection/Calculators/Elektronika-MK-61/CmdRef.html)