summaryrefslogtreecommitdiffstats
path: root/hugolib
AgeCommit message (Collapse)Author
2022-03-17dartsass: Enable deprecation, @warn and @debug loggingBjørn Erik Pedersen
* @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-14Fix and refactor typosCathrine Paulsen
2022-03-11deps: Fix Goldmark regression with HTML commentsBjørn Erik Pedersen
Fixes #9650
2022-03-11Revert "Allow rendering static files to disk and dynamic to memory in server ↵Bjørn Erik Pedersen
mode" This reverts commit 7d8011ed63d587b87a7c182748914fe146590093. Updates #9647
2022-03-10Fail with error when double-rendering text in markdownify/RenderStringBjørn Erik Pedersen
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-09Add lang attribute to internal alias templateJoe Mooring
Closes #9586
2022-03-08markup/goldmark/codeblocks: Fix slice bounds out of rangeBjørn Erik Pedersen
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-08Allow rendering static files to disk and dynamic to memory in server modeSatowTakeshi
Updates #9625
2022-03-08Remove the decorator from the fs used in ReadDirBjørn Erik Pedersen
There have been a site breakage reported in the wild after 0.93.1. With this commit we shoudl be back to how it behaved in 0.92.2. Closes #9609
2022-03-04tpl/os: Revert readDir in theme behaviourBjørn Erik Pedersen
Fixes #9599
2022-02-27Rename Codeowners() to CodeOwners()Bjørn Erik Pedersen
2022-02-27CodeblockContext method renamesBjørn Erik Pedersen
Fixes #9577
2022-02-26markup/goldmark: Improve attributes vs optionsBjørn Erik Pedersen
Fixes #9571
2022-02-26markup/goldmark: Add Position to CodeblockContextBjørn Erik Pedersen
But note that this is not particulary fast and the recommendad usage is error logging only. Updates #9574
2022-02-26Remove the trailing new line in .CodeBjørn Erik Pedersen
Fixes #9572
2022-02-24Update error message about failed menus in config.tomlRheingoldRiver
2022-02-24Add Markdown diagrams and render hooks for code blocksBjørn Erik Pedersen
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-23Add support for CODEOWNERSMarshall Cottrell
Fixes #9474
2022-02-23Add page.StoreBjørn Erik Pedersen
Fixes #9546
2022-02-21commands: Fix server panic regressionBjørn Erik Pedersen
And now with a proper server test. Fixes #9518 Fixes #9530 Fixes #9539
2022-02-16Fix BenchmarkCascadeTargetBjørn Erik Pedersen
2022-02-15deps: Update github.com/tdewolff/minify/v2 v2.9.22 => v2.9.29Joe Mooring
Fixes #9244 Fixes #9132 Fixes https://discourse.gohugo.io/t/36523
2022-02-15deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0Bjørn Erik Pedersen
2022-02-14Finally remove deprecated Page methodsBjørn Erik Pedersen
They have been deprecated for a very long time, first with a warning, then with an ERROR. Now they are removed. Closes #4117
2022-02-10Add another cascade benchmarkBjørn Erik Pedersen
2022-02-09Add a migration test helperBjørn Erik Pedersen
2022-02-09babel: Port integration tests to their own packageBjørn Erik Pedersen
2022-02-09js: Port integration tests to its own packageBjørn Erik Pedersen
2022-02-09postcss: Move integration test to its own packageBjørn Erik Pedersen
2022-02-09minifier: Port integration tests to its packageBjørn Erik Pedersen
2022-02-09templates: Port integration test to its packageBjørn Erik Pedersen
2022-02-09tocss: Port integration tests to their packageBjørn Erik Pedersen
2022-02-09openapi3: Port integration test into correct packageBjørn Erik Pedersen
2022-02-09Add a new integration test frameworkBjørn Erik Pedersen
I have had this living in a separate branch for now, but we need this in the main branch sooner rather than later. One big advantage of this is that integration tests can live in any package, not just hugolib.
2022-01-28Fix erroneous warning with .Page.RenderString on a page without a backing fileBjørn Erik Pedersen
Fixes #9433
2022-01-27Make the RenderString content provider fix more generalBjørn Erik Pedersen
Updates #9383
2022-01-27Fix .RenderString issue in .TranslationsPaul Gottschling
Fixes #9383
2022-01-26Fix duplicate mount sourcesBjørn Erik Pedersen
Fixes #9426
2022-01-17tpl/collections: Fix apply with namespaced template funcsBjørn Erik Pedersen
We changed the signature to `func(...interface{}) (interface{}, error)` some time ago, but sadly we had no test for this for `apply`. Now we do. Fixes #9393
2022-01-13Fix typo in warning messageAndreas Deininger
2022-01-12Only create LazyContentProvider for the non-rendering SiteBjørn Erik Pedersen
Which saves a fair amound of allocations: ``` gobench --package ./hugolib --bench "SiteNew/Regular_D" --base master ``` Before: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-10 40.7ms ± 3% 41.2ms ± 1% ~ (p=0.343 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-10 27.7MB ± 0% 28.8MB ± 0% +3.76% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-10 304k ± 0% 329k ± 0% +8.07% (p=0.029 n=4+4) ``` After: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-10 34.2ms ± 1% 34.7ms ± 1% ~ (p=0.114 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-10 27.7MB ± 0% 28.1MB ± 0% +1.38% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-10 304k ± 0% 314k ± 0% +3.03% (p=0.029 n=4+4) ``` Updates #8919
2022-01-12Fix missing page data for alternative formatsPaul Gottschling
When a template calls the .Translations function and a Hugo environment is using multiple output formats, a template that calls methods like .Summary and .Len on each translation will unexpectedly show empty return values for these methods. This is because each pageOutput's ContentProvider is assigned to a page.NopPage in newPageOutput. When *HugoSites.render assigns pageContentOutputs to pageOutputs in *pageState.shiftToOutputFormat, it reuses pageContentOutputs from other pageOutputs, leaving some pageContentOutputs as NopPages. While this approach conserves resources, sometimes it means that a template will unexpectedly call a method on a pageContentOutput that is actually a NopPage. In the case of ContentProvider methods called on translations for alternative output formats, the methods were called on NopPages. This change introduces LazyContentProvider, which performs late initialization when one of its methods is called. This way, we can reuse content in "normal" cases but ensure that ContentProvider methods work as expected when a pageOutput is not assigned a pageContentOutput during the initial pre-render phase. Fixes #8919
2022-01-11Add hugo.DepsBjørn Erik Pedersen
Fixes #8949
2022-01-08hugolib: Fix livereload problem with files including NFC characters in MacOsroointan
Fixes #8429
2022-01-04Remove mmarkBjørn Erik Pedersen
Closes #9350
2022-01-04Misc depreation updatesBjørn Erik Pedersen
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
2022-01-04Fix surprise OutputFormat.Rel overwritingPaul Gottschling
In page.NewOutputFormat, we take an output.Format f and use it to create a page.OutputFormat. If the format is canonical, we assign the final OutputFormat's Rel to "canonical" rather than using f.Rel. However, this leads to unexpected behavior for custom output formats, where a user can define a "rel" for a format via the config file. For example, the standard for "humans.txt" files requires using rel="author" in HTML "link" elements. Meanwhile, humans.txt is usually the only format used for its content. As a result, for Hugo configurations that define a humans.txt custom output format, Hugo will render "link" elements to content in this format with rel="canonical," rather than "author" as required by the standard. This commit changes page.NewOutputFormat to check whether a given format is user defined and, if so, skips assigning Rel to "canonical," even if isCanonical is true. Fixes #8030
2022-01-01hugolib: Make an RST test optionalBjørn Erik Pedersen
If no RST installed.
2021-12-23Make sure we always create the /public folderBjørn Erik Pedersen
* Before this commit, when you had static files in the root of /content and no /public folder, that folder would not be created unless the /static syncer had already run. * So, with a common pattern doing `rm -rf public && hugo` would the fail now and then because /static and /content are processed in parallel (unless you have cleanDestinationDir=true) * This was even worse before commit 0b918e131fe523188b820d1e3fa0b08251abde69 – a frozen build. Closes #8166
2021-12-23Fix "stuck on build" in error situations in content processingBjørn Erik Pedersen
Updates #8166