Rust library to generate static websites
5
fork

Configure Feed

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

feat: some docs work

+163 -68
+2 -2
crates/maudit/src/content.rs
··· 410 410 self.entries.iter().find(|entry| entry.id == id) 411 411 } 412 412 413 - pub fn into_params<P>(&self, cb: impl Fn(&Entry<T>) -> P) -> Vec<P> 413 + pub fn into_params<P>(&self, cb: impl FnMut(&Entry<T>) -> P) -> Vec<P> 414 414 where 415 415 P: Into<PageParams>, 416 416 { ··· 419 419 420 420 pub fn into_pages<Params, Props>( 421 421 &self, 422 - cb: impl Fn(&Entry<T>) -> crate::route::Page<Params, Props>, 422 + cb: impl FnMut(&Entry<T>) -> crate::route::Page<Params, Props>, 423 423 ) -> crate::route::Pages<Params, Props> 424 424 where 425 425 Params: Into<PageParams>,
+3
examples/README.md
··· 1 + # Examples 2 + 3 + This folder contains example Maudit projects that demonstrate various features and use cases. Each example is a standalone project that can be run and built independently.
-1
package.json
··· 5 5 "packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c", 6 6 "dependencies": { 7 7 "@tailwindcss/cli": "^4.0.0", 8 - "@tailwindcss/typography": "^0.5.15", 9 8 "tailwindcss": "^4.0.0", 10 9 "thumbhash": "^0.1.1" 11 10 },
-52
pnpm-lock.yaml
··· 11 11 '@tailwindcss/cli': 12 12 specifier: ^4.0.0 13 13 version: 4.0.0 14 - '@tailwindcss/typography': 15 - specifier: ^0.5.15 16 - version: 0.5.15(tailwindcss@4.0.0) 17 14 tailwindcss: 18 15 specifier: ^4.0.0 19 16 version: 4.0.0 ··· 189 186 resolution: {integrity: sha512-W3FjpJgy4VV1JiL7iBYDf2n/WkeDg1Il+0Q7eWnqPyvkPPCo/Mbwc5BiaT7dfBNV6tQKAhVE34rU5xl8pSl50w==} 190 187 engines: {node: '>= 10'} 191 188 192 - '@tailwindcss/typography@0.5.15': 193 - resolution: {integrity: sha512-AqhlCXl+8grUz8uqExv5OTtgpjuVIwFTSXTrh8y9/pw6q2ek7fJ+Y8ZEVw7EB2DCcuCOtEjf9w3+J3rzts01uA==} 194 - peerDependencies: 195 - tailwindcss: '>=3.0.0 || insiders || >=4.0.0-alpha.20' 196 - 197 189 braces@3.0.3: 198 190 resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} 199 191 engines: {node: '>=8'} 200 - 201 - cssesc@3.0.0: 202 - resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} 203 - engines: {node: '>=4'} 204 - hasBin: true 205 192 206 193 detect-libc@1.0.3: 207 194 resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} ··· 299 286 resolution: {integrity: sha512-FmGoeD4S05ewj+AkhTY+D+myDvXI6eL27FjHIjoyUkO/uw7WZD1fBVs0QxeYWa7E17CUHJaYX/RUGISCtcrG4Q==} 300 287 engines: {node: '>= 12.0.0'} 301 288 302 - lodash.castarray@4.4.0: 303 - resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==} 304 - 305 - lodash.isplainobject@4.0.6: 306 - resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} 307 - 308 - lodash.merge@4.6.2: 309 - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} 310 - 311 289 make-dir@3.1.0: 312 290 resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} 313 291 engines: {node: '>=8'} ··· 332 310 picomatch@2.3.1: 333 311 resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} 334 312 engines: {node: '>=8.6'} 335 - 336 - postcss-selector-parser@6.0.10: 337 - resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==} 338 - engines: {node: '>=4'} 339 313 340 314 semver@6.3.1: 341 315 resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} ··· 360 334 engines: {node: '>=14.17'} 361 335 hasBin: true 362 336 363 - util-deprecate@1.0.2: 364 - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} 365 - 366 337 snapshots: 367 338 368 339 '@parcel/watcher-android-arm64@2.5.0': ··· 489 460 '@tailwindcss/oxide-win32-arm64-msvc': 4.0.0 490 461 '@tailwindcss/oxide-win32-x64-msvc': 4.0.0 491 462 492 - '@tailwindcss/typography@0.5.15(tailwindcss@4.0.0)': 493 - dependencies: 494 - lodash.castarray: 4.4.0 495 - lodash.isplainobject: 4.0.6 496 - lodash.merge: 4.6.2 497 - postcss-selector-parser: 6.0.10 498 - tailwindcss: 4.0.0 499 - 500 463 braces@3.0.3: 501 464 dependencies: 502 465 fill-range: 7.1.1 503 - 504 - cssesc@3.0.0: {} 505 466 506 467 detect-libc@1.0.3: {} 507 468 ··· 571 532 lightningcss-win32-arm64-msvc: 1.29.1 572 533 lightningcss-win32-x64-msvc: 1.29.1 573 534 574 - lodash.castarray@4.4.0: {} 575 - 576 - lodash.isplainobject@4.0.6: {} 577 - 578 - lodash.merge@4.6.2: {} 579 - 580 535 make-dir@3.1.0: 581 536 dependencies: 582 537 semver: 6.3.1 ··· 598 553 599 554 picomatch@2.3.1: {} 600 555 601 - postcss-selector-parser@6.0.10: 602 - dependencies: 603 - cssesc: 3.0.0 604 - util-deprecate: 1.0.2 605 - 606 556 semver@6.3.1: {} 607 557 608 558 tailwindcss@4.0.0: {} ··· 616 566 is-number: 7.0.0 617 567 618 568 typescript@5.9.2: {} 619 - 620 - util-deprecate@1.0.2: {}
+107 -3
website/assets/prin.css
··· 1 1 @import "tailwindcss"; 2 2 3 - /* TODO: Get rid of this and build our own `prose` class */ 4 - @plugin "@tailwindcss/typography"; 5 - 6 3 @theme { 7 4 --color-our-white: #fafafa; 8 5 --color-our-black: #262421; ··· 76 73 background-position-y: calc(50%); 77 74 } 78 75 } 76 + 77 + .prose { 78 + font-size: 1.125rem; 79 + line-height: 1.75; 80 + } 81 + 82 + .prose h1, 83 + .prose h2, 84 + .prose h3, 85 + .prose h4, 86 + .prose h5 { 87 + font-weight: bold; 88 + } 89 + 90 + .prose h1 { 91 + margin-top: 0; 92 + margin-bottom: 0.5em; 93 + font-size: 2.25rem; 94 + line-height: 1.11111; 95 + } 96 + 97 + .prose h2 { 98 + margin-top: 1.2em; 99 + margin-bottom: 0.6em; 100 + font-size: 1.66667em; 101 + line-height: 1.33333; 102 + } 103 + 104 + .prose h2:first-child { 105 + margin-top: 0; 106 + } 107 + 108 + .prose h3 { 109 + margin-top: 1em; 110 + margin-bottom: 0.4em; 111 + font-size: 1.5rem; 112 + line-height: 1.4; 113 + } 114 + 115 + .prose h4 { 116 + margin-top: 0.8em; 117 + margin-bottom: 0.3em; 118 + font-size: 1.25rem; 119 + line-height: 1.5; 120 + } 121 + 122 + .prose h5 { 123 + margin-top: 0.8em; 124 + margin-bottom: 0.3em; 125 + font-size: 1.125rem; 126 + line-height: 1.55556; 127 + } 128 + 129 + .prose a { 130 + text-decoration: underline; 131 + } 132 + 133 + .prose p { 134 + margin-top: 1em; 135 + margin-bottom: 1em; 136 + line-height: 1.75; 137 + } 138 + 139 + .prose code { 140 + font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, 141 + Consolas, "DejaVu Sans Mono", monospace; 142 + font-size: 0.888889em; 143 + } 144 + 145 + .prose code:not(pre code) { 146 + font-weight: 600; 147 + } 148 + 149 + .prose code:not(pre code):before { 150 + content: "`"; 151 + } 152 + 153 + .prose code:not(pre code):after { 154 + content: "`"; 155 + } 156 + 157 + .prose pre { 158 + margin-left: -1.5rem; 159 + margin-right: -1.5rem; 160 + background-color: var(--color-darker-black); 161 + overflow-x: auto; 162 + padding-top: 1em; 163 + padding-inline-end: 1.5em; 164 + padding-bottom: 1em; 165 + border-radius: 0.375rem; 166 + margin-top: 2em; 167 + margin-bottom: 2em; 168 + padding-inline-start: 1.5em; 169 + font-size: 0.888889em; 170 + } 171 + 172 + .prose ul { 173 + list-style-type: disc; 174 + margin-top: 1em; 175 + margin-bottom: 1em; 176 + padding-left: 1.5em; 177 + } 178 + 179 + .prose li { 180 + margin-top: 0.5em; 181 + margin-bottom: 0.5em; 182 + }
+2 -2
website/content/docs/content.md
··· 200 200 ..Default::default() 201 201 }), 202 202 ], 203 - ..Default::default(), 203 + BuildOptions::default() 204 204 ); 205 205 } 206 206 ``` ··· 320 320 content_sources![ 321 321 "blog" => glob_markdown_with_options::<BlogPost>("content/blog/**/*.md", create_markdown_options()), 322 322 ], 323 - ..Default::default(), 323 + BuildOptions::default() 324 324 ); 325 325 } 326 326
+42 -1
website/content/docs/entrypoint.md
··· 4 4 section: "core-concepts" 5 5 --- 6 6 7 - At the core of a Maudit project is the `coronate` function. This function starts the build process and generates the output files. It is the entrypoint to your project and is where you define the pages, content and options that make up your website. 7 + At the core of a Maudit project is the [`coronate`](https://docs.rs/maudit/latest/maudit/fn.coronate.html) function. This function starts the build process and generates the output files. It is the entrypoint to your project and is where you'll pass the pages, content and options that make up your website. 8 8 9 9 In a `main.rs` file, import the `coronate` function and call it to build your project. Here is an example of a simple Maudit project: 10 10 ··· 36 36 See the [Routing](/docs/routing) documentation for more information on how to define routes. 37 37 38 38 ## Content 39 + 40 + The second argument to the `coronate` function is a list of content sources. Content sources are used to load content and data from various sources, such as the filesystem (ex: a folder of markdown files), a database, or a remote API. 41 + 42 + ```rs 43 + use maudit::content::content_sources; 44 + 45 + fn main() { 46 + coronate( 47 + routes![ 48 + // ... 49 + ], 50 + content_sources![ 51 + "source_name" => loader(...), 52 + ], 53 + Default::default() 54 + ); 55 + } 56 + ``` 57 + 58 + See the [Content](/docs/content) documentation for more information on how to define content sources. 39 59 40 60 ## Options 61 + 62 + The third argument to the `coronate` function is a `BuildOptions` struct. This struct contains various options that can be used to customize the build process. 63 + 64 + ```rs 65 + use maudit::BuildOptions; 66 + 67 + coronate( 68 + routes![ 69 + // ... 70 + ], 71 + content_sources![ 72 + // ... 73 + ], 74 + BuildOptions { 75 + output_dir: "public".into(), 76 + ..Default::default() 77 + } 78 + ); 79 + ``` 80 + 81 + For a full list of options, see the [`BuildOptions`](https://docs.rs/maudit/latest/maudit/struct.BuildOptions.html) reference.
+1 -1
website/content/docs/images.md
··· 67 67 } 68 68 ``` 69 69 70 - Processing images in Markdown files is currently not supported. 70 + Processing images in Markdown files using the standard syntax is currently not supported, but can be achieved using a custom [shortcode](/docs/content/#shortcodes) or [component](/docs/content/#components).
+1 -1
website/content/docs/library.md
··· 12 12 13 13 ## Function signature 14 14 15 - The built-in `coronate` function takes a list of routes (which all implements the [FullRoute](https://docs.rs/maudit/latest/maudit/route/trait.FullRoute.html) trait), [content sources](/docs/content), and some build options. We'll do the same. 15 + The built-in `coronate` function takes a list of routes (which all implements the [FullRoute](https://docs.rs/maudit/latest/maudit/route/trait.FullRoute.html) trait), [content sources](/docs/content), and [build options](https://docs.rs/maudit/latest/maudit/struct.BuildOptions.html). We'll do the same. 16 16 17 17 ```rs 18 18 use maudit::{
+1 -1
website/content/docs/manual-install.md
··· 14 14 15 15 ```toml 16 16 [dependencies] 17 - maudit = "0.1" 17 + maudit = "0.6" 18 18 ``` 19 19 20 20 Voilà! You can now use Maudit in your project. Check out the rest of the [documentation](/docs) for more information on how to use Maudit, or if you prefer jumping straght into the code, take a look at the [examples](https://github.com/bruits/maudit/tree/main/examples) and the [API documentation](https://docs.rs/maudit).
+2 -2
website/content/docs/templating.md
··· 4 4 section: "core-concepts" 5 5 --- 6 6 7 - Maudit supports using most Rust templating libraries. In general, if a library can return a String, you can use it to generate pages with Maudit. 7 + In general, if a library can return a String, you can use it to generate pages with Maudit. 8 8 9 - Through crate features, Maudit includes built-in helper methods and traits implementation for numerous popular templating libraries. 9 + Through crate features, Maudit includes built-in helper methods and traits implementation for popular templating libraries. 10 10 11 11 ## Maud 12 12
+1 -1
website/src/layout.rs
··· 111 111 aside.bg-linear-to-l."from-darker-white"."py-8"."h-full".border-r.border-r-borders.hidden.sm:block { 112 112 (left_sidebar(ctx)) 113 113 } 114 - main.w-full.max-w-larger-prose.mx-auto.sm:py-8.py-4 { 114 + main.w-full.max-w-larger-prose.mx-auto.sm:pt-8.py-4.pb-8.sm:pb-16 { 115 115 (main) 116 116 } 117 117 aside."py-8".hidden."sm:block" {
+1 -1
website/static/favicon.svg
··· 1 - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 64 64"><path fill="currentColor" d="M52.76 53.1c-8.5-1-8.5-1-13.84-.84h-5.34l-10.5 1.17a236.63 236.63 0 0 0-15.34 2L5.9 37.42 4.23 19.58l-.5-.17c-1-.33-1.66-1.67-1.5-3.17 0-.83.17-1 1-1.5.84-.67.84-.67 1.84-.5.83 0 1.17.17 1.5.5.5.5.5.5.67 2 0 1.34 0 1.67-.34 2l-.33.34 2.5 3.16c3.67 4.5 9.67 11.18 9.84 11.01l.67-2.5a320.85 320.85 0 0 1 2.16-10.67l-.66-1.34c-.5-.5-1.17-1.83-1.5-2.67l-.5-1.66 1-1.17c1-1 1-1.17 2.16-1.33 1.5-.5 2.17-.17 3 .83.84 1.33.84 1.83.17 3.83l-.66 2 1.16 3.5c1.17 3.18 1.17 3.18 4.5 8.68 3.34 5.34 4.17 6.5 4.34 6l.5-2.33 2.34-10 1.66-8.01c0-.34-.33-.5-.83-1l-.83-1.17.16-1c.17-1 .34-1.17 1.17-1.83.67-.34 1-.5 1.67-.34 1 0 1.33.17 2 1.17.67 1.17.83 2.5.5 3.17l-1 .83-.83.5c0 .84 8 19.51 8.17 19.51.66 0 .83-.83 3-10.5l2.17-9.84-1-.67-.84-.5-.16-1.67-.17-1.66 1-1.34 1-1.33 1.33-.17c1.34 0 1.34 0 2.17.5.84.5 1 .67 1.17 1.83.33 1.34.33 2.5 0 3l-1.34 1-1 .67 1.34 5.67 1.33 5.67 1.34 13.51c1.16 13.34 1.16 13.5.83 13.5z" style="stroke-width:.16676"/></svg> 1 + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 64 64"><path fill="#fafafa" d="M52.76 53.1c-8.5-1-8.5-1-13.84-.84h-5.34l-10.5 1.17a236.63 236.63 0 0 0-15.34 2L5.9 37.42 4.23 19.58l-.5-.17c-1-.33-1.66-1.67-1.5-3.17 0-.83.17-1 1-1.5.84-.67.84-.67 1.84-.5.83 0 1.17.17 1.5.5.5.5.5.5.67 2 0 1.34 0 1.67-.34 2l-.33.34 2.5 3.16c3.67 4.5 9.67 11.18 9.84 11.01l.67-2.5a320.85 320.85 0 0 1 2.16-10.67l-.66-1.34c-.5-.5-1.17-1.83-1.5-2.67l-.5-1.66 1-1.17c1-1 1-1.17 2.16-1.33 1.5-.5 2.17-.17 3 .83.84 1.33.84 1.83.17 3.83l-.66 2 1.16 3.5c1.17 3.18 1.17 3.18 4.5 8.68 3.34 5.34 4.17 6.5 4.34 6l.5-2.33 2.34-10 1.66-8.01c0-.34-.33-.5-.83-1l-.83-1.17.16-1c.17-1 .34-1.17 1.17-1.83.67-.34 1-.5 1.67-.34 1 0 1.33.17 2 1.17.67 1.17.83 2.5.5 3.17l-1 .83-.83.5c0 .84 8 19.51 8.17 19.51.66 0 .83-.83 3-10.5l2.17-9.84-1-.67-.84-.5-.16-1.67-.17-1.66 1-1.34 1-1.33 1.33-.17c1.34 0 1.34 0 2.17.5.84.5 1 .67 1.17 1.83.33 1.34.33 2.5 0 3l-1.34 1-1 .67 1.34 5.67 1.33 5.67 1.34 13.51c1.16 13.34 1.16 13.5.83 13.5z" style="stroke-width:.16676"/></svg>