* refactor: pattern to separate file
causes a lot of lag and also probably isn't the best to inline since we
have scss preprocessing
* fix: escape quotes properly
* feat: improve header styles
Trying to deploy with the current asdf command gives me this error:
```
23:47:45.659 Executing user command: zola build
23:47:45.899 Building site...
23:47:45.904 Error: Failed to build the site
23:47:45.904 Error: Error parsing templates from the /templates directory
23:47:45.904 Error: Reason: Io error while writing rendered value to output: NotFound
23:47:45.904 Error: Reason: No such file or directory (os error 2)
23:47:45.906 Failed: Error while executing user command. Exited with error code: 1
23:47:45.915 Failed: build command exited with code: 1
23:47:46.837 Failed: error occurred while running build command
```
Changing the command to use the latest version, 0.18.0 fixed this.
The `authors` variable so far has only been documented as something you can define in the front matter for use of feeds, but it also works in templates to define the authors of a page. (For practical use see: 6c293fa1a4 (diff-672b08946ef5cbc8db5c086bf50651b69b29e9d7be0708a1de7ded170b440e99))
This PR adds it to the documentation so that folks don't have to dig in commit histories to figure out it also works in templates.
* Introduce option to force directory when running the serve command
* Update documentation about the force flag on the serve command
* Resolve cargo fmt issue
* Reword new serve flag documentation
* Add optional decoding="async" loading="lazy" for img
In theory, they can make the page load faster and show content faster.
There’s one problem: CommonMark allows arbitrary inline elements in alt text.
If I want to get the correct alt text, I need to match every inline event.
I think most people will only use plain text, so I only match Event::Text.
* Add very basic test for img
This is the reason why we should use plain text when lazy_async_image is enabled.
* Explain lazy_async_image in documentation
* Add test with empty alt and special characters
I totaly forgot one can leave the alt text empty.
I thought I need to eliminate the alt attribute in that case,
but actually empty alt text is better than not having an alt attribute at all:
https://www.w3.org/TR/WCAG20-TECHS/H67.htmlhttps://www.boia.org/blog/images-that-dont-need-alternative-text-still-need-alt-attributes
Thus I will leave the empty alt text.
Another test is added to ensure alt text is properly escaped.
I will remove the redundant escaping code after this commit.
* Remove manually escaping alt text
After removing the if-else inside the arm of Event::Text(text),
the alt text is still escaped.
Indeed they are redundant.
* Use insta for snapshot testing
`cargo insta review` looks cool!
I wanted to dedup the cases variable,
but my Rust skill is not good enough to declare a global vector.