30f32a624 Update scss-sass.md 503130186 Update scss-sass.md cbfaa6704 Remove references to outdated Blackfriday markdown processor (#1748) e43948d26 netlify: Hugo 0.100.2 aaabe0ee9 Merge branch 'tempv0.100.2' bc615f257 tpl/path: Add path.BaseName function 5dddbf95e Add Chinese translation for _documentation and _index.md b1e4f3200 Add translation for search tools 23281633a Update introduction.md 3abb5fb5d netlify: Hugo 0.100.1 644ed3b01 Update faq.md 54f377051 Add some lines about resources.Copy 82cf08355 Remove most Blackfriday references bfbe5aaf3 netlify: Update to Hugo 0.100.0 8b6f8577f docs: Regen CLI docs 858a5d39c docs: Regen docs helper 5037d504f Merge commit 'e4bfe59c4e043c92d3992587d8c64d264b262a22' 03ca7be5b Fix indentation in highlight shortcode git-subtree-dir: docs git-subtree-split: 30f32a62433a6d62b680a2dd874c72bb8fb0b728
3.9 KiB
title | description | date | categories | keywords | weight | sections_weight | slug | toc | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Configure Markup | How to handle Markdown and other markup related configuration. | 2019-11-15 |
|
|
65 | 65 | configuration-markup | true |
Configure Markup
{{< new-in "0.60.0" >}}
See Goldmark for settings related to the default Markdown handler in Hugo.
Below are all markup related configuration in Hugo with their default settings:
{{< code-toggle config="markup" />}}
See each section below for details.
Goldmark
Goldmark is from Hugo 0.60 the default library used for Markdown. It's fast, it's CommonMark compliant and it's very flexible.
This is the default configuration:
{{< code-toggle config="markup.goldmark" />}}
For details on the extensions, refer to this section of the Goldmark documentation
Some settings explained:
- unsafe
- 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.
- typographer
- This extension substitutes punctuations with typographic entities like smartypants.
- attribute
- 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.
{{< 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.
A blockquote with a CSS class:
> 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}
Note that attributes in code fences must come after the opening tag, with any other highlighting processing instruction, e.g.:
```go {.myclass linenos=table,hl_lines=[8,"15-17"],linenostart=199}
// ... code
```
- autoHeadingIDType ("github") {{< new-in "0.62.2" >}}
- The strategy used for creating auto IDs (anchor names). Available types are
github
,github-ascii
andblackfriday
.github
produces GitHub-compatible IDs,github-ascii
will drop any non-Ascii characters after accent normalization, andblackfriday
will make the IDs compatible with 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 template func.
Highlight
This is the default highlight
configuration. Note that some of these settings can be set per code block, see Syntax Highlighting.
{{< code-toggle config="markup.highlight" />}}
For style
, see these galleries:
For CSS, see Generate Syntax Highlighter CSS.
Table Of Contents
{{< code-toggle config="markup.tableOfContents" />}}
These settings only works for the Goldmark renderer:
- startLevel
- The heading level, values starting at 1 (
h1
), to start render the table of contents. - endLevel
- The heading level, inclusive, to stop render the table of contents.
- ordered
- Whether or not to generate an ordered list instead of an unordered list.