Commit graph

6859 commits

Author SHA1 Message Date
Bjørn Erik Pedersen f7109771a0 CodeblockContext method renames
Fixes #9577
2022-02-27 17:59:36 +01:00
dependabot[bot] e1f696911e build(deps): bump github.com/tdewolff/minify/v2 from 2.9.29 to 2.10.0
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.29 to 2.10.0.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.29...v2.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-27 14:04:08 +01:00
Bjørn Erik Pedersen 5f65c17a12 markup/goldmark: Adjust test for Windows 2022-02-26 21:54:36 +01:00
Bjørn Erik Pedersen 579ff9b652 markup/goldmark: Improve attributes vs options
Fixes #9571
2022-02-26 21:54:36 +01:00
Bjørn Erik Pedersen 928a896962 markup/goldmark: Add Position to CodeblockContext
But note that this is not particulary fast and the recommendad usage is error logging only.

Updates #9574
2022-02-26 21:54:36 +01:00
Bjørn Erik Pedersen 2e54c00933 markup/goldmark: Unify some code block tests 2022-02-26 21:54:36 +01:00
Bjørn Erik Pedersen 10928a4f78 Remove the trailing new line in .Code
Fixes #9572
2022-02-26 21:54:36 +01:00
Bjørn Erik Pedersen afd63bf7d5 markup/goldmark: Rename extension struct 2022-02-26 21:54:36 +01:00
dependabot[bot] 228126b7f5 build(deps): bump github.com/gobuffalo/flect from 0.2.3 to 0.2.4
Bumps [github.com/gobuffalo/flect](https://github.com/gobuffalo/flect) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/gobuffalo/flect/releases)
- [Commits](https://github.com/gobuffalo/flect/compare/v0.2.3...v0.2.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 10:24:59 +01:00
Bjørn Erik Pedersen 0f80be341f markup/goldmark: Use Ordinal to create default lineanchors
The `Ordinal` starts at 0, so with a `hl-` prefix, this gives `hl-0-1` as a starting point.

Fixes #9567
2022-02-25 17:22:43 +01:00
dependabot[bot] 78afdb88ab build(deps): bump github.com/gorilla/websocket from 1.4.2 to 1.5.0
Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/gorilla/websocket/releases)
- [Commits](https://github.com/gorilla/websocket/compare/v1.4.2...v1.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-25 08:18:20 +01:00
dependabot[bot] 3ed83227ba build(deps): bump github.com/sanity-io/litter from 1.5.1 to 1.5.2
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/sanity-io/litter/releases)
- [Changelog](https://github.com/sanity-io/litter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.5.1...v1.5.2)

---
updated-dependencies:
- dependency-name: github.com/sanity-io/litter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-25 08:17:48 +01:00
Bjørn Erik Pedersen 1a257bb2ba
Move the Goat template to the correct place
Updates #7765
2022-02-25 00:09:07 +01:00
dependabot[bot] 97514f17d6 build(deps): bump google.golang.org/api from 0.63.0 to 0.70.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.63.0 to 0.70.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.63.0...v0.70.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>
2022-02-24 23:05:09 +01:00
RheingoldRiver 0df096b868 Update error message about failed menus in config.toml 2022-02-24 23:04:06 +01:00
dependabot[bot] 308ad611b6 build(deps): bump github.com/getkin/kin-openapi from 0.85.0 to 0.90.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.85.0 to 0.90.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.85.0...v0.90.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-24 22:59:41 +01:00
Kaushal Modi 6bffcdbd26 Add test for line anchor attributes with code fences
Fixes https://github.com/gohugoio/hugo/issues/9385.
2022-02-24 22:54:49 +01:00
dependabot[bot] 7248f43188 build(deps): bump github.com/evanw/esbuild from 0.14.22 to 0.14.23
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.14.22 to 0.14.23.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.14.22...v0.14.23)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-24 21:30:30 +01:00
Bjørn Erik Pedersen 08fdca9d93 Add Markdown diagrams and render hooks for code blocks
You can now create custom hook templates for code blocks, either one for all (`render-codeblock.html`) or for a given code language (e.g. `render-codeblock-go.html`).

We also used this new hook to add support for diagrams in Hugo:

* Goat (Go ASCII Tool) is built-in and enabled by default; just create a fenced code block with the language `goat` and start draw your Ascii diagrams.
* Another popular alternative for diagrams in Markdown, Mermaid (supported by GitHub), can also be implemented with a simple template. See the Hugo documentation for more information.

Updates #7765
Closes #9538
Fixes #9553
Fixes #8520
Fixes #6702
Fixes #9558
2022-02-24 18:59:50 +01:00
dependabot[bot] 2c20f5bc00 build(deps): bump github.com/aws/aws-sdk-go from 1.41.14 to 1.43.5
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.41.14 to 1.43.5.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.41.14...v1.43.5)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-24 17:25:24 +01:00
dependabot[bot] 723b2c485b build(deps): bump github.com/google/go-cmp from 0.5.6 to 0.5.7
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.6 to 0.5.7.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.6...v0.5.7)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-24 17:24:46 +01:00
Marshall Cottrell 06bac57ab0 Add support for CODEOWNERS
Fixes #9474
2022-02-23 22:43:19 +01:00
Bjørn Erik Pedersen ec8b767fa6 Remove Viper as a dependency 2022-02-23 22:40:23 +01:00
Cameron Moore 6407b2cd01 helpers: Allow hyphens in UnicodeSanitize
Improve handling of existing hyphens in input to UnicodeSanitize.
This commit accomplishes three things:

1. Explicitly allow hyphens
2. Avoid appending a hyphen if a preceeding hyphen is found
3. Avoid prepending a hyphen if a trailing hyphen is found

Fixes #7288
2022-02-23 21:21:46 +01:00
Akimo 6ff39fd908 Change disqus_config to window.disqus_config 2022-02-23 21:19:30 +01:00
Anthony Fok 96c0bdf3aa deps: Update github.com/spf13/cobra v1.2.1 => v1.3.0 2022-02-23 20:53:51 +01:00
Bjørn Erik Pedersen e97d3c640f Add page.Store
Fixes #9546
2022-02-23 10:02:16 +01:00
John Elliott 7732da9f93 Allow images to be cropped without being resized
Introduces the Crop method for image processing which implements gift.CropToSize. Also allows a smartCrop without resizing, and updates the documentation.

Fixes #9499
2022-02-23 10:01:50 +01:00
Bjørn Erik Pedersen aebde49b88 commands: Fix server panic regression
And now with a proper server test.

Fixes #9518
Fixes #9530
Fixes #9539
2022-02-21 21:43:26 +01:00
Bjørn Erik Pedersen 4ada09415d
markup/goldmark: Add BenchmarkCodeblocks 2022-02-21 20:53:52 +01:00
Joe Mooring bddcfd911c deps: Update github.com/gohugoio/localescompressed v0.14.0 => v0.15.0
Fixes #9446
2022-02-19 11:34:00 +01:00
Bjørn Erik Pedersen d485f95431 deps: Update github.com/yuin/goldmark v1.4.4 => v1.4.7
Closes #9397
2022-02-19 11:30:16 +01:00
Bjørn Erik Pedersen a87be597af modules: Add modules.Workspace config for Go 1.18
Sets `GOWORK` env var for Go 1.18.

Fixes #9525
2022-02-18 15:06:58 +01:00
Bjørn Erik Pedersen b0eea00756
Update stale.yml
Updates #9522
2022-02-18 11:43:35 +01:00
Bjørn Erik Pedersen ef8b781b14
Update stale.yml
Updates #9522
2022-02-18 11:38:24 +01:00
Bjørn Erik Pedersen 3136ff67d8
github: Configure stale to be run manually
Updates #9522
2022-02-18 11:31:57 +01:00
Bjørn Erik Pedersen 929808190f tpl/partials: Fix recently introduced deadlock in partials cache
The change in lock logic for `partialCached` in  0927cf739f was naive as it didn't consider cached partials calling other cached partials.

This changeset may look on the large side for this particular issue, but it pulls in part of a working branch, introducing `context.Context` in the template execution.

Note that the context is only partially implemented in this PR, but the upcoming use cases will, as one example, include having access to the top "dot" (e.g. `Page`) all the way down into partials and shortcodes etc.

The earlier benchmarks rerun against master:

```bash
name              old time/op    new time/op    delta
IncludeCached-10    13.6ms ± 2%    13.8ms ± 1%    ~     (p=0.343 n=4+4)

name              old alloc/op   new alloc/op   delta
IncludeCached-10    5.30MB ± 0%    5.35MB ± 0%  +0.96%  (p=0.029 n=4+4)

name              old allocs/op  new allocs/op  delta
IncludeCached-10     74.7k ± 0%     75.3k ± 0%  +0.77%  (p=0.029 n=4+4)
```

Fixes #9519
2022-02-17 18:47:36 +01:00
Bjørn Erik Pedersen 667f3a4ba8
tpl/partials: Add some more partials to BenchmarkIncludeCached 2022-02-17 16:45:59 +01:00
Bjørn Erik Pedersen c061b253a4 deps: Update github.com/evanw/esbuild v0.14.11 => v0.14.22 2022-02-17 12:34:13 +01:00
Bjørn Erik Pedersen 0927cf739f tpl/partials: Make sure a cached partial is invoked only once
This commit revises the locking strategy for `partialCached`. We have added a benchmark that may be a little artificial, but it should at least show that we're not losing any performance over this:

```bash
name              old time/op    new time/op    delta
IncludeCached-10    12.2ms ± 2%    11.3ms ± 1%   -7.36%  (p=0.029 n=4+4)

name              old alloc/op   new alloc/op   delta
IncludeCached-10    7.17MB ± 0%    5.09MB ± 0%  -29.00%  (p=0.029 n=4+4)

name              old allocs/op  new allocs/op  delta
IncludeCached-10      128k ± 1%       70k ± 0%  -45.42%  (p=0.029 n=4+4)
```

This commit also revises the template metrics hints logic a little, and add a test for it, which output is currently this:

```bash
 cumulative       average       maximum      cache  percent  cached  total
       duration      duration      duration  potential   cached   count  count  template
     ----------      --------      --------  ---------  -------  ------  -----  --------
      163.334µs     163.334µs     163.334µs          0        0       0      1  index.html
       23.749µs       5.937µs      19.916µs         25       50       2      4  partials/dynamic1.html
        9.625µs       4.812µs        6.75µs        100       50       1      2  partials/static1.html
        7.625µs       7.625µs       7.625µs        100        0       0      1  partials/static2.html
```

Some notes:

* The duration now includes the cached invocations (which should be very short)
* A cached template gets executed once before it gets cached, so the "percent cached" will never be 100.

Fixes #4086
Fixes #9506
2022-02-17 11:53:24 +01:00
dependabot[bot] 26a5e89faa build(deps): bump github.com/rogpeppe/go-internal from 1.8.0 to 1.8.1
Bumps [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/rogpeppe/go-internal/releases)
- [Commits](https://github.com/rogpeppe/go-internal/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/rogpeppe/go-internal
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 09:55:06 +01:00
dependabot[bot] e9fa7e81b3 build(deps): bump github.com/magefile/mage from 1.11.0 to 1.12.1
Bumps [github.com/magefile/mage](https://github.com/magefile/mage) from 1.11.0 to 1.12.1.
- [Release notes](https://github.com/magefile/mage/releases)
- [Changelog](https://github.com/magefile/mage/blob/master/.goreleaser.yml)
- [Commits](https://github.com/magefile/mage/compare/v1.11.0...v1.12.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 09:54:29 +01:00
Joe Mooring ff545f4276
markup/goldmark: Exclude event attributes from markdown render hook
Fixes #9511
2022-02-16 19:56:23 +01:00
Bjørn Erik Pedersen b2a827c52c markup/goldmark: Fix mangling of headers/links in render hooks
```bash

name                    old time/op    new time/op    delta
SiteWithRenderHooks-10    11.9ms ± 1%    11.9ms ± 1%    ~     (p=0.486 n=4+4)

name                    old alloc/op   new alloc/op   delta
SiteWithRenderHooks-10    11.2MB ± 0%    11.3MB ± 0%  +0.16%  (p=0.029 n=4+4)

name                    old allocs/op  new allocs/op  delta
SiteWithRenderHooks-10      145k ± 0%      145k ± 0%  +0.14%  (p=0.029 n=4+4)
```

Fixes #9504
2022-02-16 17:46:30 +01:00
Bjørn Erik Pedersen 77c7059ff8
markup/goldmark: Add a render hook benchmark
Updates #9504
2022-02-16 13:30:53 +01:00
Bjørn Erik Pedersen f4c90bd6ba
Fix BenchmarkCascadeTarget 2022-02-16 13:23:43 +01:00
Cameron Moore d16228334d metrics: Add cached count tracking
Track cached partial executions and display more useful info when
showing the hints output. Also group cache hints and counters together
to the right of the timing measurements.

Sample output:

     cumulative       average       maximum      cache  percent  cached  total
       duration      duration      duration  potential   cached   count  count  template
     ----------      --------      --------  ---------  -------  ------  -----  --------
       2.6973ms     674.325µs       857.3µs          0        0       0      4  _internal/_default/rss.xml
       2.6295ms     657.375µs       861.3µs          0        0       0      4  _default/single.html
       1.2563ms     314.075µs       381.5µs          0        0       0      4  news/single.html
        799.2µs       399.6µs       573.3µs          0        0       0      2  _internal/_default/sitemap.xml
        667.3µs       66.73µs       238.6µs         84        0       0     10  partials/header.html
        656.7µs      328.35µs       459.4µs          0        0       0      2  _default/list.html
        479.7µs       47.97µs         158µs         92        0       0     10  partials/head.html
        323.3µs       323.3µs       323.3µs          0        0       0      1  _internal/alias.html
        200.7µs       200.7µs       200.7µs          0        0       0      1  _internal/_default/sitemapindex.xml
         36.1µs       6.016µs        32.6µs        100       33       2      6  partials/footer.html
         27.4µs        13.7µs        26.7µs          0        0       0      2  index.html

Fixes #8375
2022-02-16 10:05:17 +01:00
Bjørn Erik Pedersen ea6bcd6944
tpl: Remove TODO comment 2022-02-15 23:39:54 +01:00
Bjørn Erik Pedersen f2e7b49acf Add --printUnusedTemplates
Fixes #9502
2022-02-15 20:01:57 +01:00
Joe Mooring 923419d7fd deps: Update github.com/tdewolff/minify/v2 v2.9.22 => v2.9.29
Fixes #9244
Fixes #9132
Fixes https://discourse.gohugo.io/t/36523
2022-02-15 17:36:29 +01:00