Commit graph

7147 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
0e305d6958 all: Use strings.Cut
Updates #9687
2022-03-21 09:32:35 +01:00
Luke de Waal
5adb81ce39 Support '-u=patch' in hugo mod get
The control-flow for running `hugo mod get` was adapted to allow for passing `-u=patch`
instead of only being able to pass `-u`.

Fixes #9127
2022-03-20 22:07:26 +01:00
Bjørn Erik Pedersen
1c0e7c1ae1 Make sure file mounts higher up wins
Fixes #9693
2022-03-20 20:23:03 +01:00
Joe Mooring
cad2d8cc70 resources/images: Require width and height for Crop, Fill, and Fit
Closes #9696
2022-03-20 19:44:41 +01:00
Bjørn Erik Pedersen
b80853de90
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
2022-03-17 22:03:27 +01:00
Bjørn Erik Pedersen
423594e03a dartsass: Enable deprecation, @warn and @debug logging
* @warn and Sass deprecations are printed as WARN
* @debug is currently logged as INFO (needs the `--verbose` flag). We may adjust this if it gets too chatty.

Fixes #9683
2022-03-17 21:45:43 +01:00
Bjørn Erik Pedersen
64afb7ca51 Use revision etc. from debug.BuildInfo
Fixes #9680
2022-03-17 17:14:38 +01:00
hugoreleaser
004bec2e9a releaser: Prepare repository for 0.96.0-DEV
[ci skip]
2022-03-16 15:00:05 +00:00
hugoreleaser
9f2e76af65 releaser: Bump versions for release of 0.95.0
[ci skip]
2022-03-16 14:20:17 +00:00
hugoreleaser
f1d1576822 releaser: Add release notes for 0.95.0
[ci skip]
2022-03-16 14:20:17 +00:00
Bjørn Erik Pedersen
5930173cd0
readme: Add note about Go 1.18 2022-03-16 13:20:30 +01:00
Bjørn Erik Pedersen
3476b53343
tpl: Pull in Go 1.18 patch that fixes the "no space in {{ continue }} and {{ break }}" bug 2022-03-16 13:14:23 +01:00
Bjørn Erik Pedersen
e792d27017
readme: Add a contribution note 2022-03-16 13:09:17 +01:00
Bjørn Erik Pedersen
9d6495d774
github: Make it build with Go 1.18
I also ran some benchmarks comparing it to Go 1.17.8:

```bash
name                                      old time/op    new time/op    delta
SiteNew/Regular_Bundle_with_image-10        5.13ms ± 7%    4.23ms ± 7%  -17.47%  (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10    5.12ms ± 1%    4.16ms ± 1%  -18.65%  (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-10      17.3ms ± 2%    15.1ms ± 1%  -12.53%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10             106ms ± 1%      90ms ± 0%  -15.86%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10        34.0ms ± 1%    30.0ms ± 2%  -11.72%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10        22.7ms ± 2%    20.2ms ± 1%  -10.93%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10      16.7ms ± 0%    14.6ms ± 1%  -12.89%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10         22.2ms ± 1%    19.5ms ± 1%  -12.07%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10               7.71ms ± 0%    6.59ms ± 1%  -14.52%  (p=0.029 n=4+4)

name                                      old alloc/op   new alloc/op   delta
SiteNew/Regular_Bundle_with_image-10        2.07MB ± 0%    2.04MB ± 0%   -1.40%  (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10    1.85MB ± 0%    1.83MB ± 0%   -1.54%  (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-10      11.8MB ± 0%    11.1MB ± 0%   -6.11%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10            95.8MB ± 0%    95.2MB ± 0%   -0.63%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10        27.4MB ± 0%    26.9MB ± 0%   -1.68%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10        15.2MB ± 0%    14.4MB ± 0%   -4.93%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10      8.45MB ± 0%    8.24MB ± 0%   -2.43%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10         16.5MB ± 0%    16.2MB ± 0%   -1.78%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10               3.73MB ± 0%    3.64MB ± 0%   -2.30%  (p=0.029 n=4+4)

name                                      old allocs/op  new allocs/op  delta
SiteNew/Regular_Bundle_with_image-10         25.0k ± 0%     24.1k ± 0%   -3.60%  (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10     25.1k ± 0%     24.1k ± 0%   -3.60%  (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-10        237k ± 0%      234k ± 0%   -1.29%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10              365k ± 0%      363k ± 0%   -0.47%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10          284k ± 0%      279k ± 0%   -1.98%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10          252k ± 0%      249k ± 0%   -1.48%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10        117k ± 0%      115k ± 0%   -1.68%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10           184k ± 0%      181k ± 0%   -1.74%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10                49.9k ± 0%     48.5k ± 0%   -2.79%  (p=0.029 n=4+4)
```
2022-03-16 11:32:39 +01:00
Bjørn Erik Pedersen
42cc5f88b6
tpl: Adjustments and an integration test for Go 1.18
Updates #9677
2022-03-16 10:36:46 +01:00
Bjørn Erik Pedersen
a6488e7bad
Remove Go 1.17 support
Go 1.18 had some breaking changes on source level meaning we cannot build on older Go versions anymore.

The improvements in Go 1.18 (e.g. `break` and `continue`)  were to good to pass on.

Note that you don't need Go (or Go 1.18) to run a pre-built binary.

Updates #9677
2022-03-16 08:57:58 +01:00
Bjørn Erik Pedersen
65a78cae1e
tpl: Sync go_templates for Go 1.18
Using Go tag go1.18 4aa1efed4853ea067d665a952eee77c52faac774

Updates #9677
2022-03-16 08:54:25 +01:00
Bjørn Erik Pedersen
4d6d1d08da
build: Bump to Go 1.18
Updates #9677
2022-03-16 08:43:18 +01:00
Bjørn Erik Pedersen
b60e1bbdfe dartsass: Improve error message when no read access
Fixes #9662
2022-03-15 16:34:54 +01:00
Cathrine Paulsen
61cf3c9f63 Fix and refactor typos 2022-03-14 19:39:07 +01:00
Bjørn Erik Pedersen
31fbc081c9 Improve server startup/shutdown
Closes #9671
2022-03-14 19:38:17 +01:00
Bjørn Erik Pedersen
cebd886ac1 commands: Improve server tests
Updates #9647
2022-03-14 09:16:33 +01:00
hugoreleaser
38f778cfcc releaser: Prepare repository for 0.95.0-DEV
[ci skip]
2022-03-12 11:02:38 +00:00
hugoreleaser
48fb9e4de3 releaser: Bump versions for release of 0.94.2
[ci skip]
2022-03-12 10:28:41 +00:00
hugoreleaser
0958167b38 releaser: Add release notes for 0.94.2
[ci skip]
2022-03-12 10:28:41 +00:00
Bjørn Erik Pedersen
b37183e48d deps: Update github.com/yuin/goldmark v1.4.9 => v1.4.10
Fixes #9658
2022-03-12 11:24:11 +01:00
hugoreleaser
04ccde3e94 releaser: Prepare repository for 0.95.0-DEV
[ci skip]
2022-03-11 14:30:03 +00:00
hugoreleaser
0fcd9a5d87 releaser: Bump versions for release of 0.94.1
[ci skip]
2022-03-11 13:53:32 +00:00
hugoreleaser
4146084367 releaser: Add release notes for 0.94.1
[ci skip]
2022-03-11 13:53:32 +00:00
Bjørn Erik Pedersen
3bc742bea0
docs: Regenerate CLI docs 2022-03-11 14:47:27 +01:00
Bjørn Erik Pedersen
1a796d723c deps: Fix Goldmark regression with HTML comments
Fixes #9650
2022-03-11 14:44:01 +01:00
Bjørn Erik Pedersen
64b7b7a897 Revert "Allow rendering static files to disk and dynamic to memory in server mode"
This reverts commit 7d8011ed63.

Updates #9647
2022-03-11 13:10:47 +01:00
Bjørn Erik Pedersen
5ef8a9f32c Revert "Some minor adjustments to the new static filesystem logic"
This reverts commit 63bb2a5b18.
2022-03-11 13:10:47 +01:00
hugoreleaser
3bc34666c8 releaser: Prepare repository for 0.95.0-DEV
[ci skip]
2022-03-10 10:25:00 +00:00
hugoreleaser
63b236603e releaser: Bump versions for release of 0.94.0
[ci skip]
2022-03-10 09:46:35 +00:00
hugoreleaser
b107b4b291 releaser: Add release notes for 0.94.0
[ci skip]
2022-03-10 09:46:35 +00:00
Bjørn Erik Pedersen
a4ac188c19
docs: Regenerate docshelper 2022-03-10 10:08:04 +01:00
Bjørn Erik Pedersen
b82d95575d
Revert "markup/highlight: Add hl_inline option"
This reverts commit a360cab75a.
2022-03-10 10:06:22 +01:00
Bjørn Erik Pedersen
4e14cf7607
Fail with error when double-rendering text in markdownify/RenderString
This commit prevents the most commons case of infinite recursion in link render hooks when the `linkify` option is enabled (see below). This is always a user error, but getting a `stack overflow` (the current stack limit in Go is 1 GB on 64-bit, 250 MB on 32-bit) error isn't very helpful. This fix will not prevent all such errors, though, but we may do better once #9570 is in place.

So, these will fail:

```
<a href="{{ .Destination | safeURL }}" >{{ .Text | markdownify }}</a>
<a href="{{ .Destination | safeURL }}" >{{ .Text | .Page.RenderString }}</a>
```

`.Text` is already rendered to `HTML`. The above needs to be rewritten to:

```
<a href="{{ .Destination | safeURL }}" >{{ .Text | safeHTML }}</a>
<a href="{{ .Destination | safeURL }}" >{{ .Text | safeHTML }}</a>
```

Fixes #8959
2022-03-10 08:19:03 +01:00
Bjørn Erik Pedersen
5697348e17 markup/goldmark: Default to https for linkify
Fixes #9639
2022-03-09 22:30:10 +01:00
Joe Mooring
f98e570b17 Add lang attribute to internal alias template
Closes #9586
2022-03-09 19:06:59 +01:00
Bjørn Erik Pedersen
cdb8b0842b
docs: Regenerate docshelper 2022-03-09 11:33:53 +01:00
Bjørn Erik Pedersen
a360cab75a markup/highlight: Add hl_inline option
If set to true, the highlighted code will not be wrapped in any div.

Closes #9442
2022-03-09 11:33:13 +01:00
Joe Mooring
c97fed08f9
minifiers: Make keepWhitespace = false default for HTML (note)
Closes #9456
2022-03-09 07:48:18 +01:00
Bjørn Erik Pedersen
53a6210d82 markup/goldmark/codeblocks: Fix slice bounds out of range
For the Position in code blocks we try to match the .Inner with the original source. This isn't always possible.

This commits avoids panics in these situations.

Fixes #9627
2022-03-08 21:50:21 +01:00
Bjørn Erik Pedersen
7182809d96
docs: Regenerate CLI docs 2022-03-08 19:40:50 +01:00
Bjørn Erik Pedersen
1f8cd2614d
docs: Regenerate docshelper 2022-03-08 19:40:07 +01:00
Bjørn Erik Pedersen
9d76b8fa34
Merge commit 'd706529720b3b2ccb99719ccd578062ca25a0cc2' 2022-03-08 19:39:33 +01:00
Bjørn Erik Pedersen
d706529720 Squashed 'docs/' changes from 3f95a2ace..a393f4cf4
a393f4cf4 Add a Spellcheck GitHub Action and config
8b6b1c381 netlify: Bump to Hugo 0.93.3
84515c183 Delete deployment-with-nanobox.md
dd45f9899 Fix typos in docs
e69de81a9 Update build-options.md
7745b7891 netlify: Hubo 0.93.2
037d63364 Clarify GitHub Pages Branches
94660c34b add missing %s
325de15e2 fix link to latest release note since the release notes were moved to GitHub: https://gohugo.io/news/no-more-releasenotes-here/
dbff41d01 Update introduction.md
0ecd627f7 netlify: Hugo 0.93.1
a74e16582 Update diagrams.md
33e310956 Add Goat example to test styling
fa0100a5b Update diagrams.md
64ac75367 Adjust diagram docs
f1d600044 Update theme
95bedff1a netlify: Bump to Hugo 0.93.0
849a8437f Merge commit 'c1398b91a9f4c67876b31feb67516b252e654d3c'
c0c60c43c docs: Regenerate docs helper
2c63fe518 cod: Regen CLI docs
f33ba4e5a CodeblockContext method renames
979b47968 Move the Goat template to the correct place
2df37e9e8 Add Markdown diagrams and render hooks for code blocks
bd8037d43 Allow images to be cropped without being resized
8b2af4b49 modules: Add modules.Workspace config for Go 1.18
46b99dea1 Add --printUnusedTemplates
1285302c9 commands: Rename --i18n-warnings to printI18nWarnings
dea2242c6 commands: Rename --path-warnings, --print-men to --printPathWarnings, --printMemoryUsage
db782ea46 deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0

git-subtree-dir: docs
git-subtree-split: a393f4cf43829011e96d109de2f039a9b05b2d16
2022-03-08 19:37:17 +01:00
Bjørn Erik Pedersen
4576c82ed4 Cache reflect.MethodByName
The isolated benchmark for the function is obviously much faster:

```bash
name                old time/op    new time/op    delta
GetMethodByName-10    1.21µs ± 7%    0.23µs ± 5%   -81.42%  (p=0.029 n=4+4)

name                old alloc/op   new alloc/op   delta
GetMethodByName-10      680B ± 0%        0B       -100.00%  (p=0.029 n=4+4)

name                old allocs/op  new allocs/op  delta
GetMethodByName-10      20.0 ± 0%       0.0       -100.00%  (p=0.029 n=4+4)
```

But more pleasing is the overall performance looking at the site benchmarks:

```bash
name                                      old time/op    new time/op    delta
SiteNew/Regular_Bundle_with_image-10        6.25ms ± 2%    6.10ms ± 2%     ~     (p=0.057 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10    6.30ms ± 2%    5.66ms ±11%     ~     (p=0.057 n=4+4)
SiteNew/Regular_Tags_and_categories-10      22.2ms ± 2%    17.4ms ± 1%  -21.88%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10             108ms ± 0%     107ms ± 0%   -1.20%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10        36.1ms ± 1%    33.8ms ± 1%   -6.44%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10        24.9ms ± 1%    22.6ms ± 1%   -9.30%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10      17.9ms ± 1%    16.7ms ± 1%   -6.43%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10         23.3ms ± 1%    22.0ms ± 0%   -5.58%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10               8.00ms ± 1%    7.63ms ± 0%   -4.62%  (p=0.029 n=4+4)

name                                      old alloc/op   new alloc/op   delta
SiteNew/Regular_Bundle_with_image-10        2.10MB ± 0%    2.07MB ± 0%   -1.46%  (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10    1.88MB ± 0%    1.85MB ± 0%   -1.76%  (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-10      13.5MB ± 0%    11.6MB ± 0%  -13.99%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10            96.1MB ± 0%    95.8MB ± 0%   -0.40%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10        28.4MB ± 0%    27.3MB ± 0%   -3.83%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10        16.9MB ± 0%    15.1MB ± 0%  -10.58%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10      8.98MB ± 0%    8.44MB ± 0%   -6.04%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10         17.1MB ± 0%    16.5MB ± 0%   -3.91%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10               3.92MB ± 0%    3.72MB ± 0%   -5.03%  (p=0.029 n=4+4)

name                                      old allocs/op  new allocs/op  delta
SiteNew/Regular_Bundle_with_image-10         25.8k ± 0%     24.9k ± 0%   -3.49%  (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-10     25.8k ± 0%     24.9k ± 0%   -3.49%  (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-10        288k ± 0%      233k ± 0%  -18.90%  (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-10              375k ± 0%      364k ± 0%   -2.80%  (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-10          314k ± 0%      283k ± 0%   -9.77%  (p=0.029 n=4+4)
SiteNew/Regular_TOML_front_matter-10          302k ± 0%      252k ± 0%  -16.55%  (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-10        133k ± 0%      117k ± 0%  -11.81%  (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-10           202k ± 0%      183k ± 0%   -9.55%  (p=0.029 n=4+4)
SiteNew/Regular_List_terms-10                55.6k ± 0%     49.8k ± 0%  -10.40%  (p=0.029 n=4+4)
```

Thanks to @quasilyte for the suggestion.

Fixes 9386
2022-03-08 19:36:55 +01:00