mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-19 04:16:02 +00:00
content: Consolidate configuration documentation
This commit is contained in:
1 parent
727ef6f665
commit
b6cae5cbc6
911 files changed
+10902
-11171
No files matched your search
@@ -3,13 +3,14 @@ title: transform.CanHighlight
|
||||
description: Reports whether the given code language is supported by the Chroma highlighter.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/transform/Highlight
|
||||
- functions/transform/HighlightCodeBlock
|
||||
returnType: bool
|
||||
signatures: [transform.CanHighlight LANGUAGE]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/transform/Highlight
|
||||
- functions/transform/HighlightCodeBlock
|
||||
returnType: bool
|
||||
signatures: [transform.CanHighlight LANGUAGE]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
|
||||
@@ -3,11 +3,12 @@ title: transform.Emojify
|
||||
description: Runs a string through the Emoji emoticons processor.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [emojify]
|
||||
related: []
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Emojify INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [emojify]
|
||||
related: []
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Emojify INPUT]
|
||||
aliases: [/functions/emojify]
|
||||
---
|
||||
|
||||
@@ -15,7 +16,9 @@ aliases: [/functions/emojify]
|
||||
|
||||
See the list of [emoji shortcodes] for available emoticons.
|
||||
|
||||
The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set `enableEmoji` to `true` in your site's [configuration]. Then you can write emoji shorthand directly into your content files;
|
||||
The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set [`enableEmoji`] to `true` in your site's configuration. Then you can write emoji shorthand directly into your content files;
|
||||
|
||||
[`enableEmoji`] :/configuration/all/#enableEmoji
|
||||
|
||||
```text
|
||||
I :heart: Hugo!
|
||||
@@ -23,7 +26,6 @@ I :heart: Hugo!
|
||||
|
||||
I :heart: Hugo!
|
||||
|
||||
[configuration]: /getting-started/configuration/
|
||||
[emoji shortcodes]: /quick-reference/emojis/
|
||||
[sc]: /templates/shortcode/
|
||||
[scsource]: https://github.com/gohugoio/hugo/tree/master/docs/layouts/shortcodes
|
||||
@@ -3,12 +3,13 @@ title: transform.HTMLEscape
|
||||
description: Returns the given string, escaping special characters by replacing them with HTML entities.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [htmlEscape]
|
||||
related:
|
||||
- functions/transform/HTMLUnescape
|
||||
returnType: string
|
||||
signatures: [transform.HTMLEscape INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [htmlEscape]
|
||||
related:
|
||||
- functions/transform/HTMLUnescape
|
||||
returnType: string
|
||||
signatures: [transform.HTMLEscape INPUT]
|
||||
aliases: [/functions/htmlescape]
|
||||
---
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ title: transform.HTMLUnescape
|
||||
description: Returns the given string, replacing each HTML entity with its corresponding character.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [htmlUnescape]
|
||||
related:
|
||||
- functions/transform/HTMLEscape
|
||||
returnType: string
|
||||
signatures: [transform.HTMLUnescape INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [htmlUnescape]
|
||||
related:
|
||||
- functions/transform/HTMLEscape
|
||||
returnType: string
|
||||
signatures: [transform.HTMLUnescape INPUT]
|
||||
aliases: [/functions/htmlunescape]
|
||||
---
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@ title: transform.Highlight
|
||||
description: Renders code with a syntax highlighter.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [highlight]
|
||||
related:
|
||||
- functions/transform/CanHighlight
|
||||
- functions/transform/HighlightCodeBlock
|
||||
returnType: template.HTML
|
||||
signatures: ['transform.Highlight CODE LANG [OPTIONS]']
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [highlight]
|
||||
related:
|
||||
- functions/transform/CanHighlight
|
||||
- functions/transform/HighlightCodeBlock
|
||||
returnType: template.HTML
|
||||
signatures: ['transform.Highlight CODE LANG [OPTIONS]']
|
||||
aliases: [/functions/highlight]
|
||||
toc: true
|
||||
---
|
||||
|
||||
The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 [available styles].
|
||||
The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 [highlighting styles].
|
||||
|
||||
[chroma]: https://github.com/alecthomas/chroma
|
||||
[available styles]: https://xyproto.github.io/splash/docs/
|
||||
[highlighting styles]: /quick-reference/syntax-highlighting-styles/
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -30,10 +30,10 @@ LANG
|
||||
: (`string`) The language of the code to highlight. Choose from one of the [supported languages]. This value is case-insensitive.
|
||||
|
||||
OPTIONS
|
||||
: (`map or string`) A map or space-separate key-value pairs wrapped in quotation marks. Set default values for each option in your [site configuration]. The key names are case-insensitive.
|
||||
: (`map or string`) A map or comma-separated key-value pairs wrapped in quotation marks. Set default values for each option in your [site configuration]. The key names are case-insensitive.
|
||||
|
||||
[site configuration]: /getting-started/configuration-markup#highlight
|
||||
[supported languages]: /content-management/syntax-highlighting#list-of-chroma-highlighting-languages
|
||||
[site configuration]: /configuration/markup#highlight
|
||||
[supported languages]: /content-management/syntax-highlighting#languages
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -53,4 +53,4 @@ OPTIONS
|
||||
|
||||
## Options
|
||||
|
||||
{{% include "functions/_common/highlighting-options" %}}
|
||||
{{% include "_common/syntax-highlighting-options.md" %}}
|
||||
@@ -3,13 +3,14 @@ title: transform.HighlightCodeBlock
|
||||
description: Highlights code received in context within a code block render hook.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/transform/CanHighlight
|
||||
- functions/transform/Highlight
|
||||
returnType: highlight.HighlightResult
|
||||
signatures: ['transform.HighlightCodeBlock CONTEXT [OPTIONS]']
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/transform/CanHighlight
|
||||
- functions/transform/Highlight
|
||||
returnType: highlight.HighlightResult
|
||||
signatures: ['transform.HighlightCodeBlock CONTEXT [OPTIONS]']
|
||||
---
|
||||
|
||||
This function is only useful within a code block render hook.
|
||||
|
||||
@@ -3,13 +3,14 @@ title: transform.Markdownify
|
||||
description: Renders Markdown to HTML.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [markdownify]
|
||||
related:
|
||||
- methods/page/RenderString
|
||||
- methods/page/RenderShortcodes
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Markdownify INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [markdownify]
|
||||
related:
|
||||
- methods/page/RenderString
|
||||
- methods/page/RenderShortcodes
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Markdownify INPUT]
|
||||
aliases: [/functions/markdownify]
|
||||
---
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ title: transform.Plainify
|
||||
description: Returns a string with all HTML tags removed.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [plainify]
|
||||
related: []
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Plainify INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [plainify]
|
||||
related: []
|
||||
returnType: template.HTML
|
||||
signatures: [transform.Plainify INPUT]
|
||||
aliases: [/functions/plainify]
|
||||
---
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ title: transform.PortableText
|
||||
description: Converts Portable Text to Markdown.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/RenderString
|
||||
- methods/page/RenderShortcodes
|
||||
returnType: string
|
||||
signatures: [transform.PortableText MAP]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/page/RenderString
|
||||
- methods/page/RenderShortcodes
|
||||
returnType: string
|
||||
signatures: [transform.PortableText MAP]
|
||||
---
|
||||
|
||||
{{< new-in "0.145.0" />}}
|
||||
@@ -17,9 +18,9 @@ action:
|
||||
|
||||
## Types supported
|
||||
|
||||
* `block` and `span`
|
||||
* `image`. Note that the image handling is currently very simple; we link to the `asset.url` using `asset.altText` as the image alt text and `asset.title` as the title. For more fine grained control you may want to process the images in a [image render hook](/render-hooks/images/).
|
||||
* `code` (see the [code-input](https://www.sanity.io/plugins/code-input) plugin). Code will be rendered as [fenced code blocks](/contribute/documentation/#fenced-code-blocks) with any filename provided passed on as a markdown attribute.
|
||||
- `block` and `span`
|
||||
- `image`. Note that the image handling is currently very simple; we link to the `asset.url` using `asset.altText` as the image alt text and `asset.title` as the title. For more fine grained control you may want to process the images in a [image render hook](/render-hooks/images/).
|
||||
- `code` (see the [code-input](https://www.sanity.io/plugins/code-input) plugin). Code will be rendered as [fenced code blocks](/contribute/documentation/#fenced-code-blocks) with any file name provided passed on as a markdown attribute.
|
||||
|
||||
{{< note >}}
|
||||
Since the Portable Text gets converted to Markdown before it gets passed to Hugo, rendering of links, headings, images and code blocks can be controlled with [Render Hooks](https://gohugo.io/render-hooks/).
|
||||
|
||||
@@ -3,13 +3,14 @@ title: transform.Remarshal
|
||||
description: Marshals a string of serialized data, or a map, into a string of serialized data in the specified format.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/encoding/Jsonify
|
||||
- functions/transform/Unmarshal
|
||||
returnType: string
|
||||
signatures: [transform.Remarshal FORMAT INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/encoding/Jsonify
|
||||
- functions/transform/Unmarshal
|
||||
returnType: string
|
||||
signatures: [transform.Remarshal FORMAT INPUT]
|
||||
aliases: [/functions/transform.remarshal]
|
||||
---
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
title: transform.ToMath
|
||||
description: Renders mathematical equations and expressions written in the LaTeX markup language.
|
||||
categories: []
|
||||
keywords: [katex,latex,math,typesetting]
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- content-management/mathematics
|
||||
returnType: types.Result[template.HTML]
|
||||
signatures: ['transform.ToMath INPUT [OPTIONS]']
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
related:
|
||||
- content-management/mathematics
|
||||
returnType: types.Result[template.HTML]
|
||||
signatures: ['transform.ToMath INPUT [OPTIONS]']
|
||||
aliases: [/functions/tomath]
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.132.0 />}}
|
||||
@@ -44,7 +44,7 @@ Pass a map of options as the second argument to the `transform.ToMath` function.
|
||||
[rendering options]: https://katex.org/docs/options.html
|
||||
|
||||
displayMode
|
||||
: (`bool`) If `true` render in display mode, else render in inline mode. Default is `false`.
|
||||
: (`bool`) Whether to render in display mode instead of inline mode. Default is `false`.
|
||||
|
||||
errorColor
|
||||
: (`string`) The color of the error messages expressed as an RGB [hexadecimal color]. Default is `#cc0000`.
|
||||
@@ -52,7 +52,7 @@ errorColor
|
||||
[hexadecimal color]: https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
|
||||
|
||||
fleqn
|
||||
: (`bool`) If `true` render flush left with a 2em left margin. Default is `false`.
|
||||
: (`bool`) Whether to render flush left with a 2em left margin. Default is `false`.
|
||||
|
||||
macros
|
||||
: (`map`) A map of macros to be used in the math expression. Default is `{}`.
|
||||
@@ -78,7 +78,7 @@ output
|
||||
<link href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css" rel="stylesheet">
|
||||
|
||||
throwOnError
|
||||
: (`bool`) If `true` throw a `ParseError` when KaTeX encounters an unsupported command or invalid LaTeX. Default is `true`.
|
||||
: (`bool`) Whether to throw a `ParseError` when KaTeX encounters an unsupported command or invalid LaTeX. Default is `true`.
|
||||
|
||||
## Error handling
|
||||
|
||||
@@ -94,11 +94,11 @@ The example below demonstrates error handing within a template.
|
||||
|
||||
Instead of client-side JavaScript rendering of mathematical markup using MathJax or KaTeX, create a passthrough render hook which calls the `transform.ToMath` function.
|
||||
|
||||
###### Step 1
|
||||
### Step 1
|
||||
|
||||
Enable and configure the Goldmark [passthrough extension] in your site configuration. The passthrough extension preserves raw Markdown within delimited snippets of text, including the delimiters themselves.
|
||||
|
||||
[passthrough extension]: /getting-started/configuration-markup/#passthrough
|
||||
[passthrough extension]: /configuration/markup/#passthrough
|
||||
|
||||
{{< code-toggle file=hugo copy=true >}}
|
||||
[markup.goldmark.extensions.passthrough]
|
||||
@@ -113,7 +113,7 @@ inline = [['\(', '\)']]
|
||||
The configuration above precludes the use of the `$...$` delimiter pair for inline equations. Although you can add this delimiter pair to the configuration, you will need to double-escape the `$` symbol when used outside of math contexts to avoid unintended formatting.
|
||||
{{< /note >}}
|
||||
|
||||
###### Step 2
|
||||
### Step 2
|
||||
|
||||
Create a [passthrough render hook] to capture and render the LaTeX markup.
|
||||
|
||||
@@ -131,7 +131,7 @@ Create a [passthrough render hook] to capture and render the LaTeX markup.
|
||||
{{- end -}}
|
||||
{{< /code >}}
|
||||
|
||||
###### Step 3
|
||||
### Step 3
|
||||
|
||||
In your base template, conditionally include the KaTeX CSS within the head element.
|
||||
|
||||
@@ -146,7 +146,7 @@ In your base template, conditionally include the KaTeX CSS within the head eleme
|
||||
|
||||
In the above, note the use of a [noop](g) statement to force content rendering before we check the value of `hasMath` with the `Store.Get` method.
|
||||
|
||||
###### Step 4
|
||||
### Step 4
|
||||
|
||||
Add some mathematical markup to your content, then test.
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ title: transform.Unmarshal
|
||||
description: Parses serialized data and returns a map or an array. Supports CSV, JSON, TOML, YAML, and XML.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [unmarshal]
|
||||
related:
|
||||
- functions/transform/Remarshal
|
||||
- functions/resources/Get
|
||||
- functions/resources/GetRemote
|
||||
- functions/encoding/Jsonify
|
||||
returnType: any
|
||||
signatures: ['transform.Unmarshal [OPTIONS] INPUT']
|
||||
toc: true
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [unmarshal]
|
||||
related:
|
||||
- functions/transform/Remarshal
|
||||
- functions/resources/Get
|
||||
- functions/resources/GetRemote
|
||||
- functions/encoding/Jsonify
|
||||
returnType: any
|
||||
signatures: ['transform.Unmarshal [OPTIONS] INPUT']
|
||||
aliases: [/functions/transform.unmarshal]
|
||||
---
|
||||
|
||||
@@ -133,7 +133,7 @@ comment
|
||||
: (`string`) The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.
|
||||
|
||||
lazyQuotes {{< new-in 0.122.0 />}}
|
||||
: (`bool`) If true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field. Default is `false`.
|
||||
: (`bool`) Whether to allow a quote in an unquoted field, or to allow a non-doubled quote in a quoted field. Default is `false`.
|
||||
|
||||
```go-html-template
|
||||
{{ $csv := "a;b;c" | transform.Unmarshal (dict "delimiter" ";") }}
|
||||
|
||||
@@ -3,11 +3,12 @@ title: transform.XMLEscape
|
||||
description: Returns the given string, removing disallowed characters then escaping the result to its XML equivalent.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [transform.XMLEscape INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [transform.XMLEscape INPUT]
|
||||
---
|
||||
|
||||
{{< new-in 0.121.0 />}}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
---
|
||||
title: Transform functions
|
||||
linkTitle: transform
|
||||
description: Template functions to transform values from one format to another.
|
||||
description: Use these functions to transform values from one format to another.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
---
|
||||
|
||||
Use these functions to transform values from one format to another.
|
||||
Reference in new issue
Block a user