Merge commit 'dec8cd4ada29218971743333f8ac662a9c06aad8'

This commit is contained in:
Bjørn Erik Pedersen
2024-09-01 14:51:15 +02:00
43 changed files with 906 additions and 436 deletions

View File

@@ -238,7 +238,7 @@ This is the default configuration for the AsciiDoc renderer:
###### attributes
(`map`) A map of key-value pairs, each a document attributes,See Asciidoctors [attributes].
(`map`) A map of key-value pairs, each a document attributes. See Asciidoctors [attributes].
[attributes]: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions
@@ -302,6 +302,51 @@ To mitigate security risks, entries in the extension array may not contain forwa
my-attribute-name = "my value"
{{< /code-toggle >}}
### AsciiDoc syntax highlighting
Follow the steps below to enable syntax highlighting.
Step 1
: Set the `source-highlighter` attribute in your site configuration. For example:
{{< code-toggle file=hugo >}}
[markup.asciidocExt.attributes]
source-highlighter = 'rouge'
{{< /code-toggle >}}
Step 2
: Generate the highlighter CSS. For example:
```text
rougify style monokai.sublime > assets/css/syntax.css
```
Step 3
: In your base template add a link to the CSS file:
{{< code file=layouts/_default/baseof.html >}}
<head>
...
{{ with resources.Get "css/syntax.css" }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
...
</head>
{{< /code >}}
Then add the code to be highlighted to your markup:
```text
[#hello,ruby]
----
require 'sinatra'
get '/hi' do
"Hello World!"
end
----
```
### AsciiDoc troubleshooting
Run `hugo --logLevel debug` to examine Hugo's call to the Asciidoctor executable:

View File

@@ -378,6 +378,10 @@ Module configuration see [module configuration](/hugo-modules/configuration/).
See [custom output formats].
###### page
See [configure page](#configure-page).
###### pagination
See [configure pagination](/templates/pagination/#configuration).
@@ -496,6 +500,50 @@ enableemoji: true
```
{{% /note %}}
## Configure page
{{< new-in 0.133.0 >}}
These methods on a `Page` object navigate to the next or previous page within a page collection, relative to the current page:
- [Next](/methods/page/next/)
- [NextInSection](/methods/page/nextinsection/)
- [Prev](/methods/page/prev/)
- [PrevInSection](/methods/page/previnsection/)
Hugo determines the _next_ and _previous_ page by sorting a page collection according to this sorting hierarchy:
Field|Precedence|Sort direction
:--|:--|:--
[`weight`]|1|descending
[`date`]|2|descending
[`linkTitle`]|3|descending
[`path`]|4|descending
[`date`]: /methods/page/date/
[`weight`]: /methods/page/weight/
[`linkTitle`]: /methods/page/linktitle/
[`path`]: /methods/page/path/
The sort direction in the table above corresponds to these default site configuration values:
{{< code-toggle config=page />}}
To sort all fields in ascending order:
{{< code-toggle file=hugo >}}
[page]
nextPrevInSectionSortOrder = 'asc'
nextPrevSortOrder = 'asc'
{{< /code-toggle >}}
{{% note %}}
These settings do not apply to the [`Next`] or [`Prev`] methods on a `Pages` object.
[`Next`]: /methods/pages/next
[`Prev`]: /methods/pages/next
{{% /note %}}
## Configure build
The `build` configuration section contains global build-related configuration options.
@@ -609,8 +657,6 @@ Setting `force=true` will make a redirect even if there is existing content in t
## 404 server error page {#_404-server-error-page}
{{< new-in 0.103.0 >}}
Hugo will, by default, render all 404 errors when running `hugo server` with the `404.html` template. Note that if you have already added one or more redirects to your [server configuration](#configure-server), you need to add the 404 redirect explicitly, e.g:
{{< code-toggle file=config/development/server >}}
@@ -924,7 +970,6 @@ output
It is recommended to put coarse grained filters (e.g. for language and output format) in the excludes section, e.g.:
{{< code-toggle file=hugo >}}
[segments.segment1]
[[segments.segment1.excludes]]