configuration-markup.md (4006B)
1 --- 2 title: Configure Markup 3 description: How to handle Markdown and other markup related configuration. 4 date: 2019-11-15 5 categories: [getting started,fundamentals] 6 keywords: [configuration,highlighting] 7 weight: 65 8 sections_weight: 65 9 slug: configuration-markup 10 toc: true 11 --- 12 13 ## Configure Markup 14 15 {{< new-in "0.60.0" >}} 16 17 See [Goldmark](#goldmark) for settings related to the default Markdown handler in Hugo. 18 19 Below are all markup related configuration in Hugo with their default settings: 20 21 {{< code-toggle config="markup" />}} 22 23 **See each section below for details.** 24 25 ### Goldmark 26 27 [Goldmark](https://github.com/yuin/goldmark/) is from Hugo 0.60 the default library used for Markdown. It's fast, it's [CommonMark](https://spec.commonmark.org/0.29/) compliant and it's very flexible. 28 29 This is the default configuration: 30 31 {{< code-toggle config="markup.goldmark" />}} 32 33 For details on the extensions, refer to [this section](https://github.com/yuin/goldmark/#built-in-extensions) of the Goldmark documentation 34 35 Some settings explained: 36 37 unsafe 38 : By default, Goldmark does not render raw HTMLs and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on. 39 40 typographer 41 : This extension substitutes punctuations with typographic entities like [smartypants](https://daringfireball.net/projects/smartypants/). 42 43 attribute 44 : Enable custom attribute support for titles and blocks by adding attribute lists inside single curly brackets (`{.myclass class="class1 class2" }`) and placing it _after the Markdown element it decorates_, on the same line for titles and on a new line directly below for blocks. 45 46 {{< new-in "0.81.0" >}} In Hugo 0.81.0 we added support for adding attributes (e.g. CSS classes) to Markdown blocks, e.g. tables, lists, paragraphs etc. 47 48 A blockquote with a CSS class: 49 50 ```md 51 > foo 52 > bar 53 {.myclass} 54 ``` 55 56 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.: 57 58 ```md 59 * Fruit 60 * Apple 61 * Orange 62 * Banana 63 {.fruits} 64 * Dairy 65 * Milk 66 * Cheese 67 {.dairies} 68 {.list} 69 ``` 70 71 Note that attributes in [code fences](/content-management/syntax-highlighting/#highlighting-in-code-fences) must come after the opening tag, with any other highlighting processing instruction, e.g.: 72 73 ```` 74 ```go {.myclass linenos=table,hl_lines=[8,"15-17"],linenostart=199} 75 // ... code 76 ``` 77 ```` 78 79 autoHeadingIDType ("github") {{< new-in "0.62.2" >}} 80 : The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with [Blackfriday](#blackfriday), the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/anchorize/) template func. 81 82 83 ### Highlight 84 85 This is the default `highlight` configuration. Note that some of these settings can be set per code block, see [Syntax Highlighting](/content-management/syntax-highlighting/). 86 87 {{< code-toggle config="markup.highlight" />}} 88 89 For `style`, see these galleries: 90 91 * [Short snippets](https://xyproto.github.io/splash/docs/all.html) 92 * [Long snippets](https://xyproto.github.io/splash/docs/longer/all.html) 93 94 For CSS, see [Generate Syntax Highlighter CSS](/content-management/syntax-highlighting/#generate-syntax-highlighter-css). 95 96 ### Table Of Contents 97 98 {{< code-toggle config="markup.tableOfContents" />}} 99 100 These settings only works for the Goldmark renderer: 101 102 startLevel 103 : The heading level, values starting at 1 (`h1`), to start render the table of contents. 104 105 endLevel 106 : The heading level, inclusive, to stop render the table of contents. 107 108 ordered 109 : Whether or not to generate an ordered list instead of an unordered list. 110 111 112 ## Markdown Render Hooks 113 114 See [Markdown Render Hooks](/templates/render-hooks/). 115