aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/content/en/functions/urls/Anchorize.md
blob: 72b3d54a9eb777c2b1dbab7901c575f834cb9e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
title: urls.Anchorize
description: Returns the given string, sanitized for usage in an HTML id attribute.
categories: []
keywords: []
action:
  aliases: [anchorize]
  related:
    - functions/urls/URLize
  returnType: string
  signatures: [urls.Anchorize INPUT]
aliases: [/functions/anchorize]
---

{{% include "/functions/urls/_common/anchorize-vs-urlize.md" %}}

## Sanitizing logic

With the default markdown renderer, Goldmark, the sanitizing logic is controlled by your site configuration:

{{< code-toggle file=hugo >}}
[markup.goldmark.parser]
autoHeadingIDType = 'github'
{{< /code-toggle >}}

This controls the behavior of the `anchorize` function and the generation of heading IDs when rendering markdown to HTML.

Set `autoHeadingIDType` to one of:

github
: Compatible with GitHub. This is the default, and strongly recommended.

github-ascii
: Similar to the "github" setting, but removes non-ASCII characters. 

blackfriday
: Provided for backwards compatibility with Hugo v0.59.1 and earlier. This option will be removed in a future release.