Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: gohugoio/hugo
base: v0.87.0
head repository: gohugoio/hugo
compare: v0.88.0
Commits on Aug 04, 2021
Commits on Aug 09, 2021
Commits on Aug 14, 2021
Commits on Aug 17, 2021
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.68.0 to 0.74.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](getkin/kin-openapi@v0.68.0...v0.74.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>
Commits on Aug 22, 2021
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.9 to 1.5.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](fsnotify/fsnotify@v1.4.9...v1.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.3.6...v0.3.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
Unless the merge strategy is set up to do so.

For `disableKinds` the current workaround is to make sure the project config has an entry, even if is empty:

```
disableKinds = []
```

Note that this issue only touches root, non-map config-values that either is not set in project config or in Hugo's defaults.

Fixes #8866
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.17 to 0.12.22.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.12.17...v0.12.22)

---
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>
Commits on Aug 25, 2021
Pygments support was removed in Hugo v0.60.0
Commits on Aug 31, 2021
Go 1.17 now lazy-loads dependencies when `go.mod` is version `go17`. This does not work for us for new projects started with `hugo mod init`.

Before this commit, starting a project with Go 1.17 with `hugo mod init` and then start adding dependencies with transitive dependenies to `config.toml` would treat the transitive dependencies as new, and you would potentially get a too recent version of those.

Note that this does not effect existing projects, where all dependencies are already recorded in `go.mod`.

Fixes #8930
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.22 to 0.12.24.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.12.22...v0.12.24)

---
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>
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](frankban/quicktest@v1.13.0...v1.13.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.74.0 to 0.75.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](getkin/kin-openapi@v0.74.0...v0.75.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>
Commits on Sep 01, 2021
…exists

This is in line with how both Node and ESBuild's native import resolver does it.

The ambiguous situations above were discovered trying to build AlpineJS v3.

Note that the above was never an issue if you used `./foo.js` and similar to import the component.

Fixes #8945
Showing with 592 additions and 308 deletions.
  1. +1 −1 .circleci/config.yml
  2. +1 −1 .github/workflows/test.yml
  3. +30 −10 commands/commandeer.go
  4. +1 −1 commands/commands.go
  5. +2 −2 commands/config.go
  6. +1 −1 commands/convert.go
  7. +1 −1 commands/deploy.go
  8. +3 −3 commands/genchromastyles.go
  9. +5 −5 commands/hugo.go
  10. +7 −1 commands/hugo_windows.go
  11. +1 −1 commands/list.go
  12. +1 −1 commands/mod.go
  13. +1 −1 commands/new.go
  14. +1 −1 commands/new_theme.go
  15. +1 −1 commands/server.go
  16. +1 −1 common/hugo/version_current.go
  17. +8 −0 common/maps/params.go
  18. +1 −1 config/defaultConfigProvider.go
  19. +0 −1 config/defaultConfigProvider_test.go
  20. +0 −1 docs/content/en/content-management/formats.md
  21. +0 −1 docs/content/en/content-management/shortcodes.md
  22. +1 −1 docs/content/en/content-management/syntax-highlighting.md
  23. +0 −2 docs/content/en/functions/highlight.md
  24. +0 −1 docs/content/en/getting-started/installing.md
  25. +67 −0 docs/content/en/news/0.88.0-relnotes/index.md
  26. +5 −5 go.mod
  27. +16 −10 go.sum
  28. +27 −0 htesting/test_helpers.go
  29. +31 −0 htesting/test_helpers_test.go
  30. +5 −2 hugolib/config.go
  31. +6 −0 hugolib/config_test.go
  32. +2 −2 hugolib/embedded_shortcodes_test.go
  33. +5 −2 hugolib/hugo_sites.go
  34. +7 −0 hugolib/resource_chain_test.go
  35. +2 −2 hugolib/shortcode_test.go
  36. +1 −1 markup/blackfriday/renderer.go
  37. +37 −34 markup/goldmark/convert.go
  38. +3 −3 markup/goldmark/convert_test.go
  39. +11 −5 markup/highlight/highlight.go
  40. +81 −17 modules/client.go
  41. +8 −1 modules/collect.go
  42. +3 −1 parser/frontmatter.go
  43. +5 −1 resources/postpub/postpub.go
  44. +19 −4 resources/resource_transformers/js/options.go
  45. +50 −0 resources/resource_transformers/js/options_test.go
  46. +1 −21 snap/snapcraft.yaml
  47. +0 −82 temp/0.87.0-relnotes-ready.md
  48. +59 −0 temp/0.88.0-relnotes-ready.md
  49. +1 −1 tpl/lang/lang.go
  50. +72 −74 tpl/transform/remarshal_test.go
@@ -1,6 +1,6 @@
defaults: &defaults
docker:
- image: bepsays/ci-goreleaser:1.16.5-2
- image: bepsays/ci-goreleaser:1.17.0
environment:
CGO_ENABLED: "0"

@@ -7,7 +7,7 @@ jobs:
GO111MODULE: on
strategy:
matrix:
go-version: [1.16.x]
go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
@@ -61,6 +61,11 @@ type commandeer struct {
logger loggers.Logger
serverConfig *config.Server

// Loading state
mustHaveConfigFile bool
failOnInitErr bool
running bool

// Currently only set when in "fast render mode". But it seems to
// be fast enough that we could maybe just add it for all server modes.
changeDetector *fileChangeDetector
@@ -153,7 +158,7 @@ func (c *commandeer) initFs(fs *hugofs.Fs) error {
return nil
}

func newCommandeer(mustHaveConfigFile, running bool, h *hugoBuilderCommon, f flagsToConfigHandler, cfgInit func(c *commandeer) error, subCmdVs ...*cobra.Command) (*commandeer, error) {
func newCommandeer(mustHaveConfigFile, failOnInitErr, running bool, h *hugoBuilderCommon, f flagsToConfigHandler, cfgInit func(c *commandeer) error, subCmdVs ...*cobra.Command) (*commandeer, error) {
var rebuildDebouncer func(f func())
if running {
// The time value used is tested with mass content replacements in a fairly big Hugo site.
@@ -175,11 +180,17 @@ func newCommandeer(mustHaveConfigFile, running bool, h *hugoBuilderCommon, f fla
visitedURLs: types.NewEvictingStringQueue(10),
debounce: rebuildDebouncer,
fullRebuildSem: semaphore.NewWeighted(1),

// Init state
mustHaveConfigFile: mustHaveConfigFile,
failOnInitErr: failOnInitErr,
running: running,

// This will be replaced later, but we need something to log to before the configuration is read.
logger: loggers.NewLogger(jww.LevelWarn, jww.LevelError, out, ioutil.Discard, running),
}

return c, c.loadConfig(mustHaveConfigFile, running)
return c, c.loadConfig()
}

type fileChangeDetector struct {
@@ -244,7 +255,7 @@ func (f *fileChangeDetector) PrepareNew() {
f.current = make(map[string]string)
}

func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
func (c *commandeer) loadConfig() error {
if c.DepsCfg == nil {
c.DepsCfg = &deps.DepsCfg{}
}
@@ -256,7 +267,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {

cfg := c.DepsCfg
c.configured = false
cfg.Running = running
cfg.Running = c.running

var dir string
if c.h.source != "" {
@@ -270,7 +281,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
sourceFs = c.DepsCfg.Fs.Source
}

environment := c.h.getEnvironment(running)
environment := c.h.getEnvironment(c.running)

doWithConfig := func(cfg config.Provider) error {
if c.ftch != nil {
@@ -309,8 +320,13 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
doWithConfig)

if err != nil {
return err
} else if mustHaveConfigFile && len(configFiles) == 0 {
// We should improve the error handling here,
// but with hugo mod init and similar there is a chicken and egg situation
// with modules already configured in config.toml, so ignore those errors.
if c.mustHaveConfigFile || !moduleNotFoundRe.MatchString(err.Error()) {
return err
}
} else if c.mustHaveConfigFile && len(configFiles) == 0 {
return hugolib.ErrNoConfigFile
}

@@ -322,7 +338,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
}

// Set some commonly used flags
c.doLiveReload = running && !c.Cfg.GetBool("disableLiveReload")
c.doLiveReload = c.running && !c.Cfg.GetBool("disableLiveReload")
c.fastRenderMode = c.doLiveReload && !c.Cfg.GetBool("disableFastRender")
c.showErrorInBrowser = c.doLiveReload && !c.Cfg.GetBool("disableBrowserError")

@@ -334,7 +350,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
}
}

logger, err := c.createLogger(config, running)
logger, err := c.createLogger(config)
if err != nil {
return err
}
@@ -394,7 +410,11 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {

var h *hugolib.HugoSites

h, err = hugolib.NewHugoSites(*c.DepsCfg)
var createErr error
h, createErr = hugolib.NewHugoSites(*c.DepsCfg)
if h == nil || c.failOnInitErr {
err = createErr
}
c.hugoSites = h
close(c.created)
})
@@ -165,7 +165,7 @@ Complete documentation is available at http://gohugo.io/.`,
// prevent cobra printing error so it can be handled here (before the timeTrack prints)
cmd.SilenceErrors = true

c, err := initializeConfig(true, cc.buildWatch, &cc.hugoBuilderCommon, cc, cfgInit)
c, err := initializeConfig(true, true, cc.buildWatch, &cc.hugoBuilderCommon, cc, cfgInit)
if err != nil {
cmd.PrintErrln("Error:", err.Error())
return err
@@ -62,7 +62,7 @@ func (b *commandsBuilder) newConfigCmd() *configCmd {
}

func (c *configCmd) printMounts(cmd *cobra.Command, args []string) error {
cfg, err := initializeConfig(true, false, &c.hugoBuilderCommon, c, nil)
cfg, err := initializeConfig(true, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return err
}
@@ -78,7 +78,7 @@ func (c *configCmd) printMounts(cmd *cobra.Command, args []string) error {
}

func (c *configCmd) printConfig(cmd *cobra.Command, args []string) error {
cfg, err := initializeConfig(true, false, &c.hugoBuilderCommon, c, nil)
cfg, err := initializeConfig(true, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return err
}
@@ -102,7 +102,7 @@ func (cc *convertCmd) convertContents(format metadecoders.Format) error {
return newUserError("Unsafe operation not allowed, use --unsafe or set a different output path")
}

c, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, nil)
c, err := initializeConfig(true, false, false, &cc.hugoBuilderCommon, cc, nil)
if err != nil {
return err
}
@@ -60,7 +60,7 @@ documentation.
c.Set("maxDeletes", cc.maxDeletes)
return nil
}
comm, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, cfgInit)
comm, err := initializeConfig(true, true, false, &cc.hugoBuilderCommon, cc, cfgInit)
if err != nil {
return err
}
@@ -37,17 +37,17 @@ func createGenChromaStyles() *genChromaStyles {
baseCmd: newBaseCmd(&cobra.Command{
Use: "chromastyles",
Short: "Generate CSS stylesheet for the Chroma code highlighter",
Long: `Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if pygmentsUseClasses is enabled in config.
Long: `Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if markup.highlight.noClasses is disabled in config.
See https://help.farbox.com/pygments.html for preview of available styles`,
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles`,
}),
}

g.cmd.RunE = func(cmd *cobra.Command, args []string) error {
return g.generate()
}

g.cmd.PersistentFlags().StringVar(&g.style, "style", "friendly", "highlighter style (see https://help.farbox.com/pygments.html)")
g.cmd.PersistentFlags().StringVar(&g.style, "style", "friendly", "highlighter style (see https://xyproto.github.io/splash/docs/)")
g.cmd.PersistentFlags().StringVar(&g.highlightStyle, "highlightStyle", "bg:#ffffcc", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
g.cmd.PersistentFlags().StringVar(&g.linesStyle, "linesStyle", "", "style used for line numbers (see https://github.com/alecthomas/chroma)")

@@ -116,19 +116,19 @@ func Execute(args []string) Response {
}

// InitializeConfig initializes a config file with sensible default configuration flags.
func initializeConfig(mustHaveConfigFile, running bool,
func initializeConfig(mustHaveConfigFile, failOnInitErr, running bool,
h *hugoBuilderCommon,
f flagsToConfigHandler,
cfgInit func(c *commandeer) error) (*commandeer, error) {
c, err := newCommandeer(mustHaveConfigFile, running, h, f, cfgInit)
c, err := newCommandeer(mustHaveConfigFile, failOnInitErr, running, h, f, cfgInit)
if err != nil {
return nil, err
}

return c, nil
}

func (c *commandeer) createLogger(cfg config.Provider, running bool) (loggers.Logger, error) {
func (c *commandeer) createLogger(cfg config.Provider) (loggers.Logger, error) {
var (
logHandle = ioutil.Discard
logThreshold = jww.LevelWarn
@@ -172,7 +172,7 @@ func (c *commandeer) createLogger(cfg config.Provider, running bool) (loggers.Lo
loggers.InitGlobalLogger(stdoutThreshold, logThreshold, outHandle, logHandle)
helpers.InitLoggers()

return loggers.NewLogger(stdoutThreshold, logThreshold, outHandle, logHandle, running), nil
return loggers.NewLogger(stdoutThreshold, logThreshold, outHandle, logHandle, c.running), nil
}

func initializeFlags(cmd *cobra.Command, cfg config.Provider) {
@@ -792,7 +792,7 @@ func (c *commandeer) fullRebuild(changeType string) {
defer c.timeTrack(time.Now(), "Rebuilt")

c.commandeerHugoState = newCommandeerHugoState()
err := c.loadConfig(true, true)
err := c.loadConfig()
if err != nil {
// Set the processing on pause until the state is recovered.
c.paused = true
@@ -13,7 +13,13 @@

package commands

import "github.com/spf13/cobra"
import (
// For time zone lookups on Windows without Go installed.
// See #8892
_ "time/tzdata"

"github.com/spf13/cobra"
)

func init() {
// This message to show to Windows users if Hugo is opened from explorer.exe
@@ -40,7 +40,7 @@ func (lc *listCmd) buildSites(config map[string]interface{}) (*hugolib.HugoSites
return nil
}

c, err := initializeConfig(true, false, &lc.hugoBuilderCommon, lc, cfgInit)
c, err := initializeConfig(true, true, false, &lc.hugoBuilderCommon, lc, cfgInit)
if err != nil {
return nil, err
}
@@ -284,7 +284,7 @@ func (c *modCmd) withHugo(f func(*hugolib.HugoSites) error) error {
}

func (c *modCmd) initConfig(failOnNoConfig bool) (*commandeer, error) {
com, err := initializeConfig(failOnNoConfig, false, &c.hugoBuilderCommon, c, nil)
com, err := initializeConfig(failOnNoConfig, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return nil, err
}
@@ -71,7 +71,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error {
return nil
}

c, err := initializeConfig(true, false, &n.hugoBuilderCommon, n, cfgInit)
c, err := initializeConfig(true, true, false, &n.hugoBuilderCommon, n, cfgInit)
if err != nil {
return err
}
@@ -52,7 +52,7 @@ as you see fit.`,

// newTheme creates a new Hugo theme template
func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
c, err := initializeConfig(false, false, &n.hugoBuilderCommon, n, nil)
c, err := initializeConfig(false, false, false, &n.hugoBuilderCommon, n, nil)
if err != nil {
return err
}
@@ -239,7 +239,7 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
// silence errors in cobra so we can handle them here
cmd.SilenceErrors = true

c, err := initializeConfig(true, true, &sc.hugoBuilderCommon, sc, cfgInit)
c, err := initializeConfig(true, true, true, &sc.hugoBuilderCommon, sc, cfgInit)
if err != nil {
cmd.PrintErrln("Error:", err.Error())
return err
@@ -16,7 +16,7 @@ package hugo
// CurrentVersion represents the current build version.
// This should be the only one.
var CurrentVersion = Version{
Number: 0.87,
Number: 0.88,
PatchLevel: 0,
Suffix: "",
}
@@ -76,6 +76,14 @@ func (p Params) Merge(pp Params) {
p.merge("", pp)
}

// MergeRoot transfers values from pp to p for new keys where p is the
// root of the tree.
// This is done recursively.
func (p Params) MergeRoot(pp Params) {
ms, _ := p.GetMergeStrategy()
p.merge(ms, pp)
}

func (p Params) merge(ps ParamsMergeStrategy, pp Params) {
ns, found := p.GetMergeStrategy()

@@ -275,7 +275,7 @@ func (c *defaultConfigProvider) Merge(k string, v interface{}) {
}
}
// Merge the rest.
c.root.Merge(p)
c.root.MergeRoot(p)
for _, k := range keysToDelete {
delete(c.root, k)
}
@@ -172,7 +172,6 @@ func TestDefaultConfigProvider(t *testing.T) {

c.Assert(cfg.Get(""), qt.DeepEquals, maps.Params{
"a": "av",
"b": "bv2",
})
})

@@ -152,7 +152,6 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
[mmark]: https://github.com/mmarkdown/mmark
[org]: https://orgmode.org/
[pandoc]: https://www.pandoc.org/
[Pygments]: https://pygments.org/
[rest]: https://docutils.sourceforge.io/rst.html
[sc]: /content-management/shortcodes/
[sct]: /templates/shortcode-templates/
@@ -435,7 +435,6 @@ To learn more about creating custom shortcodes, see the [shortcode template docu
[Instagram]: https://www.instagram.com/
[pagevariables]: /variables/page/
[partials]: /templates/partials/
[Pygments]: https://pygments.org/
[quickstart]: /getting-started/quick-start/
[sctemps]: /templates/shortcode-templates/
[scvars]: /variables/shortcodes/
@@ -24,7 +24,7 @@ See [Configure Highlight](/getting-started/configuration-markup#highlight).

## Generate Syntax Highlighter CSS

If you run with `pygmentsUseClasses=true` in your site config, you need a style sheet.
If you run with `markup.highlight.noClasses=false` in your site config, you need a style sheet.

You can generate one with Hugo:

@@ -22,5 +22,3 @@ deprecated: false


[highlight]: /content-management/shortcodes/#highlight
[installpygments]: /getting-started/installing/#installing-pygments-optional
[syntax]: /content-management/syntax-highlighting/
@@ -552,7 +552,6 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
[installgo]: https://golang.org/dl/
[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
[Path Editor]: https://patheditor2.codeplex.com/
[pygments]: https://pygments.org
[quickstart]: /getting-started/quick-start/
[redhatforum]: https://discourse.gohugo.io/t/solved-fedora-copr-repository-out-of-service/2491
[releases]: https://github.com/gohugoio/hugo/releases

No commit comments for this range