Commit graph

1871 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
f7109771a0 CodeblockContext method renames
Fixes #9577
2022-02-27 17:59:36 +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
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
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
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
f2e7b49acf Add --printUnusedTemplates
Fixes #9502
2022-02-15 20:01:57 +01:00
Bjørn Erik Pedersen
837fdfdf45
commands: Rename --i18n-warnings to printI18nWarnings
To get it in line with the others.
2022-02-15 13:03:36 +01:00
Bjørn Erik Pedersen
6819feab6c
commands: Rename --path-warnings, --print-men to --printPathWarnings, --printMemoryUsage
To get it in line with the others.
2022-02-15 13:00:06 +01:00
Bjørn Erik Pedersen
ea54a99ca5 deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0 2022-02-15 10:37:14 +01:00
Bjørn Erik Pedersen
c707b71cdf
Merge commit '230a495941b191af0bdaa7e2fc8c61607cb38207' 2022-02-14 12:58:42 +01:00
Joe Mooring
d1109f590a Fix validation of Page Kind in cascade target map
Fixes #8888
2022-02-10 20:42:31 +01:00
Joe Mooring
54f8d8a70a Remove the "check" command
Closes #9454
2022-02-10 16:25:23 +01:00
Joe Mooring
3336762939 Remove hugo gen autocomplete
Closes #8862
2022-02-01 23:23:30 +01:00
Bjørn Erik Pedersen
f2bc13dd9e
docs: Regenerate docshelper 2022-01-12 08:17:03 +01:00
Bjørn Erik Pedersen
098254f175
Merge commit 'a8e9fc699a6ff7d578f97a7c553ce844efad8fdb' 2022-01-12 08:16:35 +01:00
Bjørn Erik Pedersen
fbb3c181cb
docs: Add dependency table to maintainance page
See #8949
2022-01-11 21:57:37 +01:00
Bjørn Erik Pedersen
7396aa945a Add hugo.Deps
Fixes #8949
2022-01-11 18:06:23 +01:00
Bjørn Erik Pedersen
74f0777c5f
docs. Regen CLI docs
Closes #9363
2022-01-07 12:37:07 +01:00
Bjørn Erik Pedersen
965760835d
docs: Regenerate CLI docs 2022-01-04 17:12:09 +01:00
Bjørn Erik Pedersen
4a0b55330c
docs: Regenerate docshelper 2022-01-04 17:11:17 +01:00
Bjørn Erik Pedersen
623dda7174 Revert "config/security: Add HOME to default exec env var whitelist"
There have been one report in the wild suggesting that this needs to be tested better before doing:

https://discourse.gohugo.io/t/hugo-mod-failing-in-v0-91-1-but-works-in-v0-91-0/36180/5

This reverts commit fca266ebbb.
2021-12-23 16:23:15 +01:00
Bjørn Erik Pedersen
fca266ebbb config/security: Add HOME to default exec env var whitelist
See #9309
2021-12-22 11:33:59 +01:00
Bjørn Erik Pedersen
6df2f080c9
docs: Regen docs helper 2021-12-17 10:31:08 +01:00
Bjørn Erik Pedersen
f4389e48ce
Add some basic security policies with sensible defaults
This ommmit contains some security hardening measures for the Hugo build runtime.

There are some rarely used features in Hugo that would be good to have disabled by default. One example would be the "external helpers".

For `asciidoctor` and some others we use Go's `os/exec` package to start a new process.

These are a predefined set of binary names, all loaded from `PATH` and with a predefined set of arguments. Still, if you don't use `asciidoctor` in your project, you might as well have it turned off.

You can configure your own in the new `security` configuration section, but the defaults are configured to create a minimal amount of site breakage. And if that do happen, you will get clear instructions in the loa about what to do.

The default configuration is listed below. Note that almost all of these options are regular expression _whitelists_ (a string or a slice); the value `none` will block all.

```toml
[security]
  enableInlineShortcodes = false
  [security.exec]
    allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']
    osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$']

  [security.funcs]
    getenv = ['^HUGO_']

  [security.http]
    methods = ['(?i)GET|POST']
    urls = ['.*']
```
2021-12-16 09:40:22 +01:00
Bjørn Erik Pedersen
6183184b96
Merge commit '45e6fdb315d113ba13e20a633ed0c67e3f25170d' 2021-12-13 21:05:10 +01:00
Bjørn Erik Pedersen
e86b331138
docs: Regenerate docs helper 2021-12-08 08:56:16 +01:00
Bjørn Erik Pedersen
6c841a691e
Merge commit '8d9511a08f14260cbfb73119e4afae50e5a9966d' 2021-12-08 08:54:25 +01:00
Bjørn Erik Pedersen
e71d715b9b Add custom font support to images.Text
Fixes #9253
2021-12-07 16:53:02 +01:00
Paul van Brouwershaven
283394a4fd
images: Text filter that draws text with the given options (#9239)
Fixes #9238
2021-12-07 11:29:55 +01:00
Joe Mooring
5538507e90 tpl/transform: Optional options for highlight func
Closes #9249
Fixes gohugoio/hugoDocs#63
2021-12-07 11:26:56 +01:00
Paul van Brouwershaven
0eaaa8fee3
Implement XML data support
Example:

```
{{ with resources.Get "https://example.com/rss.xml" | transform.Unmarshal }}
    {{ range .channel.item }}
        <strong>{{ .title | plainify | htmlUnescape }}</strong><br />
        <p>{{ .description | plainify | htmlUnescape }}</p>
        {{ $link := .link | plainify | htmlUnescape }}
        <a href="{{ $link }}">{{ $link }}</a><br />
        <hr>
    {{ end }}
{{ end }}
```

Closes #4470
2021-12-02 17:30:36 +01:00
Paul van Brouwershaven
66753416b5
Make resources.Get use a file cache for remote resources
Closes #9228
2021-12-02 12:56:25 +01:00
Paul van Brouwershaven
8aa7257f65
Add remote support to resources.Get
Closes #5255
Supports #9044
2021-11-30 11:49:51 +01:00
hugoreleaser
ab01ba6e7e releaser: Add release notes to /docs for release of 0.89.4
[ci skip]
2021-11-17 08:24:08 +00:00
hugoreleaser
c88cdb5610 releaser: Add release notes to /docs for release of 0.89.3
[ci skip]
2021-11-15 12:17:45 +00:00
hugoreleaser
63e3a5ebb2 releaser: Add release notes to /docs for release of 0.89.2
[ci skip]
2021-11-08 15:22:23 +00:00
hugoreleaser
b6a4ae4ad5 releaser: Add release notes to /docs for release of 0.89.1
[ci skip]
2021-11-05 15:44:32 +00:00
hugoreleaser
ade966b84b releaser: Add release notes to /docs for release of 0.89.0
[ci skip]
2021-11-02 10:00:17 +00:00
Bjørn Erik Pedersen
f503b63957
docs: Regen CLI docs 2021-11-02 09:01:26 +01:00
Joe Mooring
04a3b45db4 Fix description of lang.FormatNumberCustom
It currently refers to itself as a simple alternative, when it should
refer to lang.FormatNumber.
2021-11-01 18:54:43 +01:00
Joe Mooring
0cc39af682 Update Twitter shortcode oEmbed endpoint
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes #8130
2021-11-01 15:51:00 +01:00
Bjørn Erik Pedersen
4b36498a85
Merge commit 'aa5ac36a3eb68b86c803caec703869efefc8447e' 2021-10-31 13:53:55 +01:00
Bjørn Erik Pedersen
471ed91c60 hugofs: Add includeFiles and excludeFiles to mount configuration
Fixes #9042
2021-10-20 05:00:17 +02:00
Joe Mooring
64abc83fc4 Allow multiple plugins in the PostCSS options map
Usage:
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
{{ $style := resources.Get "main.css" | resources.PostCSS $options }}

Fixes #9015
2021-10-10 11:11:43 +02:00
Joe Mooring
f8d132d731
docs: Create path.Clean documentation
Related to #9005
2021-10-09 20:36:57 +02:00
hugoreleaser
5bc547389a releaser: Add release notes to /docs for release of 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
hugoreleaser
acc5eb5b51 releaser: Add release notes to /docs for release of 0.88.0
[ci skip]
2021-09-02 09:27:27 +00:00
Helder Pereira
d966f5d08d highlight: Remove some pygments references 2021-08-21 15:50:49 +02:00
hugoreleaser
b0c541e496 releaser: Add release notes to /docs for release of 0.87.0
[ci skip]
2021-08-03 10:57:26 +00:00
Bjørn Erik Pedersen
494f284be3
docs: Adjust config docs 2021-08-03 12:22:02 +02:00