Commit graph

8491 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
e1e1baa1bd Improve Katex error handling and fix handling of large expressions
* Make throwOnError=true the new default
* Handle JS errors as part of the RPC request/response flow
* Return a new Result type with .Err on it

This enables constructs on the form:

```handlebars
{{ with transform.ToMath "c = \\foo{a^2 + b^2}" }}
	{{ with .Err }}
	 	{{ warnf "error: %s" . }}
	{{ else }}
		{{ . }}
	{{ end }}
{{ end }}
```

Note that the new `Result` type behaves like `template.HTML` (or a string if needed) when printed, but it will panic if in a error state.

Closes #12748
2024-08-12 13:50:18 +02:00
Bjørn Erik Pedersen
e42263529c
Add katex option ThrowOnError
As an internal option for now. Katex misbehaves in error situations without a value set.
2024-08-11 20:57:15 +02:00
Bjørn Erik Pedersen
891aa00fe1 Add some more KaTeX options
And fix the options handling.

Closes #12745
Fixes #12746
2024-08-11 19:03:27 +02:00
Bjørn Erik Pedersen
946e6af0bb tpl/transform: Make Plainify and ToMath return template.HTML
None of these are useful as plain strings in the templates, which forces the users to do `transform.Plainify "foo" | safeHTML`.

If people have trust issues with the output of these functions, they need to just stop using them.

Closes #8732
2024-08-11 15:16:16 +02:00
Bjørn Erik Pedersen
5d84f64759 deps: Upgrade github.com/bep/imagemeta v0.7.6 => v0.8.0
Fixes #12741
2024-08-10 14:00:43 +02:00
Bjørn Erik Pedersen
fbfccb394b Fix compare of uints and ints in eq, gt etc.
Fixes #12733
2024-08-10 14:00:21 +02:00
Bjørn Erik Pedersen
ef2e30eca3
docs: Regen docshelper 2024-08-09 19:34:13 +02:00
Bjørn Erik Pedersen
33c0938cd5 Add build time math rendering
While very useful on its own (and combined with the passthrough render hooks), this also serves as a proof of concept of using WASI (WebAssembly System Interface) modules in Hugo.

This will be marked _experimental_ in the documentation. Not because it will be removed or changed in a dramatic way, but we need to think a little more how to best set up/configure similar services, define where these WASM files gets stored, maybe we can allow user provided WASM files plugins via Hugo Modules mounts etc.

See these issues for more context:

* https://github.com/gohugoio/hugo/issues/12736
* https://github.com/gohugoio/hugo/issues/12737

See #11927
2024-08-09 17:18:37 +02:00
Bjørn Erik Pedersen
0c3a1c7288
github: Turn off the image workflow for pull request
We need to fix it so it does not publish anything to the remote repo before we can enable that.
2024-08-09 16:47:17 +02:00
Bjørn Erik Pedersen
ceed812458 github: Update image actions versions and some adjustments
Co-authored-by: morre <morre@mor.re>
2024-08-09 16:26:22 +02:00
Morre
b08de70cca github: Build and publish Docker image on release
Fixes #10760
2024-08-09 16:26:22 +02:00
Bjørn Erik Pedersen
e99eba39e7
Merge commit 'a6e635ca7d905d9ec3ffd708db2694f680b03aae' 2024-08-09 15:17:43 +02:00
Bjørn Erik Pedersen
a6e635ca7d Squashed 'docs/' changes from 9b06f951e..fcc3ed651
fcc3ed651 Remove some expired new-in
a9c5981f5 Fix cascade example
82bb250fa Add some lines about permalinks tokens in front matter
328fe564e Remove some outdated new-in
fb140b153 Hide showcase menu entry
42d9d1c79 Update image formats from which EXIF data can be extracted
09ad56b6e netlify: Hugo 0.130.0
1d503f846 Merge branch 'tempv0.130.0'
e2458074d math: Add trigonometric functions and some angle helper functions
392afc8f9 Disable the showcase section for now
0300750f2 Improve example of image render hook
60a9306af Improve description of the .Site.RegularPages method
8d759175d Fix typos
55daa4554 Update XxHash.md
397c81cb7 Add namespace for hash functions
70fe8d2f0 netlify: Bump Hugo 0.129.0
5a9771aff Merge branch 'tempv0.129.0'
f9146575b Fix typo
e6e1fea49 Fix typo in Hugo docs | functions | partial
732d10ec4 source: Expose GitInfo Body
34c97e639 netlify: Hugo 0.128.2
3270587e9 Fix typo
727c5396e netlify: Hugo 0.128.1
80b6ae99c Update GitHub Pages workflow file example
027134102 Update GitHub Pages workflow file example
2600a8a2e Miscellaneous edits
3fdd5819b Update Build.md
7764005c3 Improve example of render hook directory structure
5e3941d82 Fix typos
748bf065f Restructure templates section
fafbf6566 Update Defer.md
012162e0d Document changes to template functions in v0.128.0
0990ce35b quick-reference: Update emojis
6677a30ef Update Goldmark configuration documentation
4449d530d Document new pagination config
0af8be439 Update Defer.md
56348196d netlify: Hugo 0.128.0
d67b6d82e Update content/en/functions/templates/Defer.md
23d996b3d Update content/en/functions/templates/Defer.md
7f7fb2f27 Document templates.Defer
5ada1e9d5 Fix docs merge (remove shortcode)
d27ee6156 Merge branch 'tempv0.128.0'
5d7317c84 Fix typo
7c18ee546 Update theme
83bfea63b Update theme
b274b3238 Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'
ff34a035a deploy: Add stripIndexHtml target option
d9e964bdb markup/goldmark: Add the Hugo Goldmark Extras "delete" extension
ac5bd16d2 deps: Upgrade github.com/alecthomas/chroma v2.13.0 => v2.14.0
25377171b config: Remove extraneous BuildConfig setting
0d2044f6d docs: Regen docshelper
a2548dac9 markup/goldmark: Support extras extension
9d0c86ee8 commands: Add gen chromastyles --lineNumbersTableStyle flag

git-subtree-dir: docs
git-subtree-split: fcc3ed651a1b6431303c2f88f20fa38531c52b3d
2024-08-09 15:17:43 +02:00
Bjørn Erik Pedersen
dbff48e6c3 github: Update GitHub actions versions 2024-08-09 11:17:24 +02:00
Bjørn Erik Pedersen
665ac949bd markup: Add blockquote render hooks
Closes #12590
2024-08-07 18:28:23 +02:00
Bjørn Erik Pedersen
4c162deb03 markup/goldmark/codeblocks: Simplify codeblcok hook code 2024-08-07 18:28:23 +02:00
Bjørn Erik Pedersen
c6227f1d85 Add render hooks for inline and block passthrough snippets
Fixes #11927
2024-08-07 18:28:23 +02:00
dependabot[bot]
1781b18427 build(deps): bump golang.org/x/net from 0.27.0 to 0.28.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/net/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-07 12:26:01 +02:00
dependabot[bot]
d6d9dddff3 build(deps): bump golang.org/x/image from 0.18.0 to 0.19.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/image/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-07 11:14:31 +02:00
Bjørn Erik Pedersen
10891f305e tpl/cast: Improve float
Make it support the new upstream rational number type in Exif.

See #12718
2024-08-06 22:26:43 +02:00
Bjørn Erik Pedersen
c07e94fa6d
Skip TestEchoParam
Is deprecated, will be remvoved soon.
2024-08-06 19:13:35 +02:00
dependabot[bot]
8f8d12ab2f
build(deps): bump github.com/bep/imagemeta from 0.7.5 to 0.7.6 (#12720)
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.7.5 to 0.7.6.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.7.5...v0.7.6)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Closes #12718
2024-08-06 12:05:52 +02:00
Bjørn Erik Pedersen
69455fa422
Fix deprecation errors 2024-08-05 19:23:53 +02:00
hugoreleaser
2fcc53780f releaser: Prepare repository for 0.132.0-DEV
[ci skip]
2024-08-02 09:18:21 +00:00
hugoreleaser
bfbee17932 releaser: Bump versions for release of 0.131.0
[ci skip]
2024-08-02 09:03:48 +00:00
Bjørn Erik Pedersen
944fcc216f Fix images.AutoOrient regression
Broken in v0.130.0. Added a integration test to avoid future breakage.

Fixes #12712
2024-08-02 10:36:06 +02:00
n1xx1
914fa13efd revamp pagegroup tests with quicktest 2024-08-02 10:03:20 +02:00
n1xx1
51f09b17fd allow nested params when using Pages.GroupByParam and Pages.GroupByParamDate 2024-08-02 10:03:20 +02:00
dependabot[bot]
be643580dd build(deps): bump github.com/bep/godartsass/v2 from 2.0.0 to 2.1.0
Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/bep/godartsass/releases)
- [Commits](https://github.com/bep/godartsass/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: github.com/bep/godartsass/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-02 00:36:13 +02:00
dependabot[bot]
20e4dd2ee3 build(deps): bump google.golang.org/api from 0.152.0 to 0.189.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.152.0 to 0.189.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.152.0...v0.189.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 19:57:38 +02:00
dependabot[bot]
f41149979a build(deps): bump github.com/spf13/cobra from 1.8.0 to 1.8.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:34:22 +02:00
dependabot[bot]
47fee839f6 build(deps): bump gocloud.dev from 0.36.0 to 0.38.0
Bumps [gocloud.dev](https://github.com/google/go-cloud) from 0.36.0 to 0.38.0.
- [Release notes](https://github.com/google/go-cloud/releases)
- [Commits](https://github.com/google/go-cloud/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: gocloud.dev
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:33:35 +02:00
dependabot[bot]
99665ef227 build(deps): bump github.com/gorilla/websocket from 1.5.1 to 1.5.3
Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/gorilla/websocket/releases)
- [Commits](https://github.com/gorilla/websocket/compare/v1.5.1...v1.5.3)

---
updated-dependencies:
- dependency-name: github.com/gorilla/websocket
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:32:47 +02:00
dependabot[bot]
eb2eeee687 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.12 to 2.2.13
Bumps [github.com/kyokomi/emoji/v2](https://github.com/kyokomi/emoji) from 2.2.12 to 2.2.13.
- [Release notes](https://github.com/kyokomi/emoji/releases)
- [Commits](https://github.com/kyokomi/emoji/compare/v2.2.12...v2.2.13)

---
updated-dependencies:
- dependency-name: github.com/kyokomi/emoji/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:31:38 +02:00
Bjørn Erik Pedersen
bea5a46de4 deps: Upgrade github.com/hairyhenderson/go-codeowners v0.4.0 => v0.5.0 2024-08-01 14:46:54 +02:00
dependabot[bot]
f1a7f3d01a build(deps): bump github.com/fatih/color from 1.16.0 to 1.17.0
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 14:46:13 +02:00
dependabot[bot]
08243be1d2 build(deps): bump github.com/evanw/esbuild from 0.21.4 to 0.23.0
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.21.4 to 0.23.0.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.4...v0.23.0)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 13:43:28 +02:00
dependabot[bot]
0490a8a162 build(deps): bump github.com/tdewolff/minify/v2 from 2.20.36 to 2.20.37
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.36 to 2.20.37.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.20.36...v2.20.37)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 13:14:38 +02:00
Bjørn Erik Pedersen
d795cacd71
Revert "deps: Set toolchain go1.21.0 in go.mod"
This reverts commit 78c9a18b0c.
2024-08-01 13:04:29 +02:00
Bjørn Erik Pedersen
a5db76fe62
Run go mod tidy 2024-08-01 12:22:27 +02:00
n1xx1
566fe7ba12
resources/page: Expand parmalinks tokens in url
This change allows to use permalink tokens in url front matter fields. This should be useful to target more specific pages instead of using a global permalink configuration. It's expected to be used with cascade.

Fixes #9714
2024-08-01 12:14:29 +02:00
Bjørn Erik Pedersen
92573012e8 Bump to go 1.21 in go.mod 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
071f8b4466 tpl: Sync Go template packages with the Go 1.22.5 source 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
ae9d5e7d83 Upgrade to Go 1.22.5 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
78c9a18b0c deps: Set toolchain go1.21.0 in go.mod
To hopefully resolve dependabot issues.
2024-07-31 19:47:41 +02:00
Bjørn Erik Pedersen
79aa2ab618 deps: Upgrade golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d => v0.23.0
Main motivation is to try to get dependabot running again.
2024-07-31 18:52:13 +02:00
Bjørn Erik Pedersen
216a69a1ef Shorten processed image filenames
Fixes #12688
Fixes #12656
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
e67886c038 Consolidate all hashing to the common/hashing package
And remove now unsued hashing funcs.
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
d5eda13cb2 Replace the MD5 hashing of images with xxHash
Note that we only use this for change detection.

The previous implementation invoked `MD5FromReaderFast` that created a MD5 has from 8 64 bytes chunks in the file, which is obviously very fast. The new implementation creates the hash from the entire file and ... seems to be even more effective:

```
name          old time/op    new time/op    delta
HashImage-10    9.45µs ±21%   10.89µs ± 1%     ~     (p=0.343 n=4+4)

name          old alloc/op   new alloc/op   delta
HashImage-10      144B ± 0%        8B ± 0%  -94.44%  (p=0.029 n=4+4)

name          old allocs/op  new allocs/op  delta
HashImage-10      4.00 ± 0%      1.00 ± 0%  -75.00%  (p=0.029 n=4+4)
```
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
8b5d796989 resources: Add BenchmarkHashImage 2024-07-31 16:44:06 +02:00