Commit graph

854 commits

Author SHA1 Message Date
Vincent Prouillet
b97f8a1fe2 Update changelog + add back config.generate_feed in templates for now 2024-06-24 23:03:21 +02:00
Vincent Prouillet
233e1cdcbd Closes #2537 2024-06-24 23:03:21 +02:00
LunarEclipse363
c054ed1b10 Added support for multiple feeds (i.e. generating both Atom and RSS) (#2477)
* Added support for multiple feeds

* Implemented backwards-compatibility for feed config

* Added a test for feed config backwards-compat, fixed bugs

- Fixed language config merge bug found by a test
- Adjusted two existing tests to fully check stuff related to multiple feeds
- Added a new test for backwards-compatibility of the changes
- Fixed bugs found by the newly added test

* Renamed MightBeSingle to SingleOrVec

* Made the multiple feeds config changes "loudly" backwards-incompatible

* added #[serde(deny_unknown_fields)] to front-matter, fixed problems this found in tests
2024-06-20 23:15:24 +02:00
Vincent Prouillet
f60bda42f0 Update deps 2024-06-20 23:15:24 +02:00
Andrew Langmeier
ff9622f132 Add support for yaml datetimes (#2208)
* Add support for yaml datetimes

* cargo fmt

* Wire things up; Add more tests

* cargo fmt
2024-06-20 23:15:24 +02:00
Vincent Prouillet
9c1b004b13 Fix tests 2024-06-20 23:15:24 +02:00
endesigner
cb2a4b0ee8 Prevent generating folder & index.html for a specific page 2024-06-20 23:15:24 +02:00
Tanishq
c5991fc814 fix ignore links to #top when checking anchors (#2519)
* fix ignore links to #top when checking anchors

* move logic to check internal links

---------

Co-authored-by: Tanishq <tanishq@levels.fyi>
2024-06-20 23:15:24 +02:00
Connor K
26f6677bfb Add support for Fuse.js search format (#2507)
* inital "just barely works" Fuse.js support

* implement FuseJavascript; refactor index_for_lang

* support search config

* move fuse index building to it's own file

* update doc of Search.index_format

* update config docs

* update search documentation

* use &str where possible

* use libs::serde_json

remmeber to commit Cargo.lock

* move extension logic to IndexFormat

* move the entire filename logic inside IndexFormat

* move elasticlunr to it's own module

* only create elasticlunr.min.js if we're actually using elasticlunr

* move ELASTICLUNR_JS to elasticlunr.js

* hide the details of search's submodules

* optionally include path

* explain include_path better

* remove references to stork

* replace if with match

* support include_description

* specify "permalink"

* move body cleaning and truncation to a function

* update truncate_content_length docs to specify *code points*
2024-06-20 23:15:24 +02:00
orphen
5b3a57b1ac feat: move from notify v4 to notify-debouncer-full (#2503) 2024-06-20 23:15:24 +02:00
Vincent Prouillet
f480867912 cargo fmt 2024-06-20 23:15:24 +02:00
Vincent Prouillet
f4959bfd7e update tests 2024-06-20 23:15:24 +02:00
Vincent Prouillet
81db65def8 Update deps 2024-06-20 23:15:24 +02:00
Eugene Lomov
6a2b890545 Implemented bottom footnotes with backreferences (#2480)
* Implemented bottom footnotes with backreferences

Fixes #1285

* Added bottom_footnotes option to configuration.md

* Renamed fix_github_style_footnotes()

* Added tests for convert_footnotes_to_github_style()

* Changed test to plain html instead of Vec<Event>

* Added integration test for footnotes

* Applied suggested changes
2024-06-20 23:15:24 +02:00
Clar Fon
96a9dc1a28 Refactor: remove even more unnecessary create_directory (#2428) 2024-06-20 23:15:24 +02:00
Tanishq
9413d943f1 Fix link check report inconsistency (#2472)
* Fix link check report inconsistency

* Fix formatting issue

---------

Co-authored-by: Tanishq <tanishq@levels.fyi>
2024-06-20 23:15:24 +02:00
Tanishq
6a25b62d43 Fix resizing for images with EXIF orientation (#2468)
* Fix resizing for images with EXIF orientation

* Added test for asymmetric resize for exif images

---------

Co-authored-by: Tanishq <tanishq@levels.fyi>
2024-06-20 23:15:24 +02:00
William Ouwehand
954f1ce533 Fix section transparency serialization (#2462)
Fixes passing section.transparency for
https://github.com/getzola/zola/issues/1840
2024-06-20 23:15:24 +02:00
Clar Fon
aa81986580 Add MIME type to get_image_metadata (#2409) 2024-06-20 23:15:24 +02:00
Timon Van Overveldt
13682e1342 Update pulldown_cmark dep to v0.10, and add pulldown_cmark_escape dep. (#2432)
The pulldown_cmark escaping functionality is now shipped in a separate
pulldown_cmark_escape crate
(https://crates.io/crates/pulldown-cmark-escape), starting with v0.10.0.

The markdown.rs module has to be adapted to a few API changes in
pulldown_cmark, and we have to introduce explicit handling of <img> alt
text to ensure it continues to be properly escaped.

There are also a few other behavior changes that are caught by the
tests, but these actually seem to be desired, so I've updated the insta
snapshot files for those tests to incorporate those changes.
Specifically, one footnote-parsing case seems to be handled better now,
and pulldown-cmark's `push_html` now doesn't escape quotes in text nodes
anymore (see https://github.com/pulldown-cmark/pulldown-cmark/pull/836).
2024-06-20 23:15:24 +02:00
SumDonkuS
80bcc51fd2 Issue 2359 get section by lang (#2410)
* adding optional `lang` arugment to `get_section` global function

* Add handling of default language passed in `lang` argument of `get_section`

* Remove clones for path.  Change "?" to an explicit check for error

* lint changes

* Clean up error handling for add_lang_to_path call

* fix format

* Add optional parameter "lang" to get_page template function.  Add check for language available in config.

* Modify helper function name from calculate_path to get_path_with_lang.  Modify documentation for get_section and get_page to include equivalent calls without using lang argument to demostrate how lang argument effects pathing.
2024-06-20 23:15:24 +02:00
Andrew Langmeier
7d18ddfde2 Allow ignoring files when link checking (#2264)
* Allow ignoring files when link checking

* cargo fmt

* Fix tests

* Remove mystery duplicate function..?

* Add in some mysterious missing code..?

* Simple tests for link checker file globs in config

* cargo fmt

* Remove comment

* convert expect to error propagation

* Address comments

* cargo fmt
2024-06-20 23:15:24 +02:00
Clar Fon
bdb18657b6 Refactor: copy_assets instead of copy_asset (#2418) 2024-06-20 23:15:24 +02:00
Clar Fon
7fb0a70477 Refactor: create_directory responsibly (#2407)
* Remove ensure_directory_exists since it's identical to create_directory, and misleading

* Don't create directories unless needed; rely on create_dir_all instead of manually iterating over components
2024-06-20 23:15:24 +02:00
Clar Fon
a01e36bd86 Match <!--more--> in addition to <!-- more --> (#2397)
* Match <!-- more --> without spaces

* Add tests for new <!-- more --> handling, with a note on pulldown-cmark bug
2024-06-20 23:15:24 +02:00
Morgan Creekmore
a9ab3592c8 Add option to include date in search index (#2401) 2024-06-20 23:15:24 +02:00
Sergei Gureev
8ba73749b6 fix: taxonomies missing lang in sitemap (#2373) 2023-12-18 23:24:06 +01:00
Vincent Prouillet
74b06d704d Actually remove code blocks from search index
Closes #2065
2023-12-18 23:24:06 +01:00
Sandor Apati
4e0f9413f6 elasticlunr-rs 3.0.2, hu language support (#2151)
Co-authored-by: Sandor Apati <s.apati@mito.hu>
2023-12-18 23:24:06 +01:00
lauren n. liberda
1349947ed3 ignore kate-swp files (#2353) 2023-12-18 23:24:06 +01:00
Vincent Prouillet
b1f1e64da3 Update deps 2023-12-18 23:24:06 +01:00
Eldred Habert
8fe219a716 Update grass to 0.13 (#2321)
This allows benefitting from some bugfixes (potentially breaking but
better compatibility with the reference Sass impl)
2023-12-18 23:24:06 +01:00
Vincent Prouillet
24304fa9c6 Clippy 2023-12-18 23:24:06 +01:00
Alexander Borsuk
6b0585cf01 Avoid unnecessary checking for already checked links (#2305)
* Fixed "unnecessary mut" warning

* Fixed minor typo

* Use more than 8 threads for links checking if hardware supports it

* Fixed failing azure Linux check

* Avoid unnecessary HTTP requests to the same, already checked links
2023-12-18 23:24:06 +01:00
Óscar
670b88263c fix: suppress highlight language warnings if highlight_code is false (#2287)
The warning about unknown highlight languages was displayed even when
code highlighting was disabled via `markdown.highlight_code = false`.
This commit adds a condition to check this setting before issuing the
warning, effectively suppressing it when code highlighting is disabled.

Issue: #2280
2023-12-18 23:24:06 +01:00
Andrew Langmeier
4430515a02 Add ignored_static to config (#2209)
* Add ignored_static to config

* Make  handle ignored static files correctly

* cargo fmt

* Match on relative path rather than incorrect target path

* path -> partial path for serve static ignore

* remove debug println

* copy static directory if there is no ignored globset

* Update docs

* Deduplicate code with additional Option argument

* cargo fmt
2023-12-18 23:24:06 +01:00
Vincent Prouillet
35aab566f9 Update deps 2023-12-18 23:24:06 +01:00
Sergio A. Vargas
1de1dd56de Add attributes to base_url link in atom template (#2261)
The `rel` and `type` HTML attributes are needed in the `base_url` (or
`section.permalink`) link so feed aggregators know that's the HTML page
that corresponds to the atom feed.

Note: The RSS template doesn't have this issue.
2023-12-18 23:24:06 +01:00
Heitor
a1ac81681b Atom template authors (#2259)
* templates:atom: add support for multiple authors

Atom 1.0 [0] support multiple `<author>` entries in the feed. This commit
modified the template to generate as many `<author>` as the page's
metadata contains.

[0] https://validator.w3.org/feed/docs/atom.html#recommendedEntryElements

* Test we can have multiple authors in ATOM feeds
2023-12-18 23:24:06 +01:00
William Ouwehand
c18a0c8031 always sort assets by filename (Windows/Linux difference) (#2236)
* sort page.assets by filename

Uses .to_str() to sort files and subfolders.

The .unwrap() may need work or be replaced by unwrap_or_default(). Given
earlier checks in the function it should work however.

* add tests for assets sorting

* fix rustfmt

* use existing loop instead of windows

* also check the non-recursive test

* use .zip() and add assert msg
2023-12-18 23:24:06 +01:00
TheOnlyMrCat
2532198acb Prevent spans crossing line boundaries in class-based code block formatter (#2237)
* Prevent spans crossing line boundaries in class formatter

* Add snapshot tests for classed highlighting
2023-12-18 23:24:06 +01:00
sinofp
22dc32a589 Add support for lazy loading images (#2211)
* 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.html
https://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.
2023-12-18 23:24:06 +01:00
Andrew Langmeier
0a9bfa16c2 Hard link serve panic fix (#2210)
* Fix hard link panic and add better error info to std:fs errors

* cargo fmt

* Remove erroneously committed config change

* Remove console import; Use with context to provide additional error info

* improve error wording
2023-12-18 23:24:06 +01:00
Vincent Prouillet
448a941f93 Fix typo in error message 2023-12-18 23:24:06 +01:00
Andrew Langmeier
8e37025729 Add search.index_format into the serialized config (#2165) (#2196)
* Add search into the serialized config (#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
2023-12-18 23:24:06 +01:00
Jake G
d72ebb1bdb Fix multi-lingual json index (#2197)
* Fix multi-ligual json index

* multi-lingual search Fix cargo fmt
2023-12-18 23:24:06 +01:00
Jeremy Kerr
63054a96d2 templates: add base URL for feed content (#2190)
Relative links in the entry content do not currently have a base URI, so
will be resolved relative to the feed URI:

Given an entry with the content:

    <a href="some-resource.bin">

And URIS of:

 * entry: https://example.org/blog/some-entry/
 * feed:  https://example.org/atom.xml

The link URI will end up as:

    https://example.org/some-resource.bin

rather than the URI that ends up resolved in the rendered page:

   https://example.org/blog/some-entry/some-resource.bin

The atom and RSS formats allow for an xml:base attribute (itself
specified in [1]) to provide a base URI of a subset of a document. This
change adds xml:base attributes to each entry, using the page permalink.

This gives us something equivalent to:

    <entry>
     <content xml:base="https://example.org/blog/some-entry/">
      <![CDATA[
       <a href="some-resource.bin">
      ]]>
     </content>
    </entry>

[1]: https://www.w3.org/TR/xmlbase/

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2023-12-18 23:24:06 +01:00
‏‏Dave
c61e925073 Implement replace_re filter (#2163)
* Implement replace_re filter

* Cargo fmt

* add regex caching

* cargo fmt

* update docs, update unit test

* rename replace_re -> regex_replace
2023-12-18 23:24:06 +01:00
Marcel
c0dd38b234 Speedup "zola check" command by reusing the Client (#2171)
* Reuse Client when checking urls and add timeout for requests
2023-12-18 23:24:06 +01:00
Justin Tennant
d52a071c05 Implement Default for LanguageOptions (#2145)
Closes #2137
2023-03-19 20:36:25 +01:00