Age | Commit message (Collapse) | Author |
|
Updates #10691
|
|
The main topic of this commit is that you can now index fragments (content heading identifiers) when calling `.Related`.
You can do this by:
* Configure one or more indices with type `fragments`
* The name of those index configurations maps to an (optional) front matter slice with fragment references. This allows you to link
page<->fragment and page<->page.
* This also will index all the fragments (heading identifiers) of the pages.
It's also possible to use type `fragments` indices in shortcode, e.g.:
```
{{ $related := site.RegularPages.Related .Page }}
```
But, and this is important, you need to include the shortcode using the `{{<` delimiter. Not doing so will create infinite loops and timeouts.
This commit also:
* Adds two new methods to Page: Fragments (can also be used to build ToC) and HeadingsFiltered (this is only used in Related Content with
index type `fragments` and `enableFilter` set to true.
* Consolidates all `.Related*` methods into one, which takes either a `Page` or an options map as its only argument.
* Add `context.Context` to all of the content related Page API. Turns out it wasn't strictly needed for this particular feature, but it will
soon become usefil, e.g. in #9339.
Closes #10711
Updates #9339
Updates #10725
|
|
* Removes any surrounding paragraph nodes
* And transfers any attributes from the surrounding paragraph down to the image node
* Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks
IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and the image's parent node has only one child.
Closes #8362
Fixes #10492
Fixes #10494
Fixes #10501
|
|
```
name old time/op new time/op delta
Codeblocks/Default-10 152ms ±11% 12ms ± 1% -92.44% (p=0.029 n=4+4)
Codeblocks/Hook_no_higlight-10 142ms ± 0% 7ms ± 0% -95.36% (p=0.029 n=4+4)
name old alloc/op new alloc/op delta
Codeblocks/Default-10 11.9MB ± 0% 11.7MB ± 0% -1.59% (p=0.029 n=4+4)
Codeblocks/Hook_no_higlight-10 4.62MB ± 1% 4.43MB ± 0% -4.08% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
Codeblocks/Default-10 209k ± 0% 209k ± 0% -0.03% (p=0.029 n=4+4)
Codeblocks/Hook_no_higlight-10 68.4k ± 0% 68.3k ± 0% -0.06% (p=0.029 n=4+4)
```
|
|
|
|
|
|
CodeBlock
Fixes #10118
|
|
Fixes #9932
Fixes #9931
|
|
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import.
You can work around this by either:
* Use url imports or imports with media queries.
* Set `skipInlineImportsNotFound=true` in the options
Also get the argument order in the different NewFileError* funcs in line.
Fixes #9895
|
|
* Redo the server error template
* Always add the content file context if relevant
* Remove some now superflous error string matching
* Move the server error template to _server/error.html
* Add file context (with position) to codeblock render blocks
* Improve JS build errors
Fixes #9892
Fixes #9891
Fixes #9893
|
|
Fixes 9819
|
|
Fixes #9054
Fixes #9756
Fixes #9757
|
|
See #9626
|
|
Signed-off-by: cuishuang <imcusg@gmail.com>
[foka@debian.org: Resolve merge conflict and squash 2 commits]
Signed-off-by: Anthony Fok <foka@debian.org>
|
|
Updates #9687
|
|
Fixes #9658
|
|
Fixes #9650
|
|
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
|
|
Fixes #9639
|
|
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
|
|
Fixes #9594
|
|
Not perfect, but it gets it in line with the other .Inner/.Wrapped combos.
|
|
To make it possible to render it with a custom HTML ("<div>") wrapper.
Updates #9573
|
|
Fixes #9577
|
|
|
|
Fixes #9571
|
|
But note that this is not particulary fast and the recommendad usage is error logging only.
Updates #9574
|
|
|
|
Fixes #9572
|
|
|
|
The `Ordinal` starts at 0, so with a `hl-` prefix, this gives `hl-0-1` as a starting point.
Fixes #9567
|
|
Fixes https://github.com/gohugoio/hugo/issues/9385.
|
|
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
|
|
|
|
Fixes #9511
|
|
```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
|
|
Updates #9504
|
|
|
|
Closes #9463
|
|
Fixes #9390
|
|
|
|
Currently the generated `<pre>` element isn't fully accessible as it can't be focused by keyboard users.
To make this fully accessible, the attribute `tabindex="0"` should be added to the `<pre>` tag.
Closes #7194
|
|
To make them easier to follow.
See #8755
|
|
Fixes #8755
|
|
Because that is what it is.
|
|
Fixes #8313
|
|
Fixes #8176
|
|
Fixes #8278
|
|
Fixes #8270
|
|
E.g.:
```
> foo
> bar
{.myclass}
```
There are some current limitations: For tables you can currently only apply it to the full table, and for lists the ul/ol-nodes only, e.g.:
```
* Fruit
* Apple
* Orange
* Banana
{.fruits}
* Dairy
* Milk
* Cheese
{.dairies}
{.list}
```
Fixes #7548
|