Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-06 22:10:47 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-23 16:12:24 +0300
commitbfb9613a14ab2d93a4474e5486d22e52a9d5e2b3 (patch)
tree81c4dbd10505e952489e1dbcf1d7bafc88b57c28 /docs/content
parenta3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f (diff)
Add Goldmark as the new default markdown handler
This commit adds the fast and CommonMark compliant Goldmark as the new default markdown handler in Hugo. If you want to continue using BlackFriday as the default for md/markdown extensions, you can use this configuration: ```toml [markup] defaultMarkdownHandler="blackfriday" ``` Fixes #5963 Fixes #1778 Fixes #6355
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/en/about/features.md2
-rw-r--r--docs/content/en/content-management/formats.md198
-rw-r--r--docs/content/en/content-management/syntax-highlighting.md181
-rw-r--r--docs/content/en/contribute/documentation.md1
-rw-r--r--docs/content/en/functions/highlight.md6
-rw-r--r--docs/content/en/getting-started/configuration-markup.md73
-rw-r--r--docs/content/en/getting-started/configuration.md48
-rw-r--r--docs/content/en/getting-started/installing.md6
-rw-r--r--docs/content/en/readfiles/bfconfig.md197
-rw-r--r--docs/content/en/templates/shortcode-templates.md4
10 files changed, 170 insertions, 546 deletions
diff --git a/docs/content/en/about/features.md b/docs/content/en/about/features.md
index cadcc6b0f..a1e741ac0 100644
--- a/docs/content/en/about/features.md
+++ b/docs/content/en/about/features.md
@@ -52,7 +52,7 @@ toc: true
* Integrated [Google Analytics][] support
* Automatic [RSS][] creation
* Support for [Go][], [Amber], and [Ace][] HTML templates
-* [Syntax highlighting][] powered by [Chroma][] (partly compatible with Pygments)
+* [Syntax highlighting][] powered by [Chroma][]
[Ace]: /templates/alternatives/
diff --git a/docs/content/en/content-management/formats.md b/docs/content/en/content-management/formats.md
index a0ed992f2..ea0568616 100644
--- a/docs/content/en/content-management/formats.md
+++ b/docs/content/en/content-management/formats.md
@@ -1,6 +1,6 @@
---
-title: Supported Content Formats
-linktitle: Supported Content Formats
+title: Content Formats
+linktitle: Content Formats
description: Both HTML and Markdown are supported content formats.
date: 2017-01-10
publishdate: 2017-01-10
@@ -13,191 +13,37 @@ menu:
weight: 20
weight: 20 #rem
draft: false
-aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/,/tutorials/mathjax/]
+aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
toc: true
---
-**Markdown is the main content format** and comes in two flavours: The excellent [Blackfriday project][blackfriday] (name your files `*.md` or set `markup = "markdown"` in front matter) or its fork [Mmark][mmark] (name your files `*.mmark` or set `markup = "mmark"` in front matter), both very fast markdown engines written in Go.
+You can put any file type into your `/content` directories, but Hugo uses the `markup` front matter value if set or the file extension (see `Markup identifiers` in the table below) to determine if the markup needs to be processed, e.g.:
-For Emacs users, [go-org](https://github.com/niklasfasching/go-org) provides built-in native support for Org-mode (name your files `*.org` or set `markup = "org"` in front matter)
+* Markdown converted to HTML
+* [Shortcodes](/content-management/shortcodes/) processed
+* Layout applied
-But in many situations, plain HTML is what you want. Just name your files with `.html` or `.htm` extension inside your content folder. Note that if you want your HTML files to have a layout, they need front matter. It can be empty, but it has to be there:
+## List of content formats
-```html
----
-title: "This is a content file in HTML"
----
-
-<div>
- <h1>Hello, Hugo!</h1>
-</div>
-```
-
-{{% note "Deeply Nested Lists" %}}
-Before you begin writing your content in markdown, Blackfriday has a known issue [(#329)](https://github.com/russross/blackfriday/issues/329) with handling deeply nested lists. Luckily, there is an easy workaround. Use 4-spaces (i.e., <kbd>tab</kbd>) rather than 2-space indentations.
-{{% /note %}}
-
-## Configure BlackFriday Markdown Rendering
-
-You can configure multiple aspects of Blackfriday as shown in the following list. See the docs on [Configuration][config] for the full list of explicit directions you can give to Hugo when rendering your site.
-
-{{< readfile file="/content/en/readfiles/bfconfig.md" markdown="true" >}}
-
-## Extend Markdown
-
-Hugo provides some convenient methods for extending markdown.
-
-### Task Lists
-
-Hugo supports [GitHub-styled task lists (i.e., TODO lists)][gfmtasks] for the Blackfriday markdown renderer. If you do not want to use this feature, you can disable it in your configuration.
-
-#### Example Task List Input
-
-{{< code file="content/my-to-do-list.md" >}}
-- [ ] a task list item
-- [ ] list syntax required
-- [ ] incomplete
-- [x] completed
-{{< /code >}}
-
-#### Example Task List Output
-
-The preceding markdown produces the following HTML in your rendered website:
-
-```
-<ul class="task-list">
- <li><input type="checkbox" disabled="" class="task-list-item"> a task list item</li>
- <li><input type="checkbox" disabled="" class="task-list-item"> list syntax required</li>
- <li><input type="checkbox" disabled="" class="task-list-item"> incomplete</li>
- <li><input type="checkbox" checked="" disabled="" class="task-list-item"> completed</li>
-</ul>
-```
-
-#### Example Task List Display
-
-The following shows how the example task list will look to the end users of your website. Note that visual styling of lists is up to you. This list has been styled according to [the Hugo Docs stylesheet][hugocss].
-
-- [ ] a task list item
-- [ ] list syntax required
-- [ ] incomplete
-- [x] completed
-
-### Emojis
-
-To add emojis directly to content, set `enableEmoji` to `true` in your [site configuration][config]. To use emojis in templates or shortcodes, see [`emojify` function][].
-
-For a full list of emojis, see the [Emoji cheat sheet][emojis].
-
-### Shortcodes
-
-If you write in Markdown and find yourself frequently embedding your content with raw HTML, Hugo provides built-in shortcodes functionality. This is one of the most powerful features in Hugo and allows you to create your own Markdown extensions very quickly.
-
-See [Shortcodes][sc] for usage, particularly for the built-in shortcodes that ship with Hugo, and [Shortcode Templating][sct] to learn how to build your own.
-
-### Code Blocks
-
-Hugo supports GitHub-flavored markdown's use of triple back ticks, as well as provides a special [`highlight` shortcode][hlsc], and syntax highlights those code blocks natively using *Chroma*. Users also have an option to use *Pygments* instead. See the [Syntax Highlighting][hl] section for details.
-
-## Mmark
-
-Mmark is a [fork of BlackFriday][mmark] and markdown superset that is well suited for writing [IETF documentation][ietf]. You can see examples of the syntax in the [Mmark GitHub repository][mmark] or the full syntax on [Miek Gieben's website][].
-
-### Use Mmark
-
-As Hugo ships with Mmark, using the syntax is as easy as changing the extension of your content files from `.md` to `.mmark`.
-
-In the event that you want to only use Mmark in specific files, you can also define the Mmark syntax in your content's front matter:
-
-```
----
-title: My Post
-date: 2017-04-01
-markup: mmark
----
-```
-
-{{% warning %}}
-Thare are some features not available in Mmark; one example being that shortcodes are not translated when used in an included `.mmark` file ([#3131](https://github.com/gohugoio/hugo/issues/3137)), and `EXTENSION_ABBREVIATION` ([#1970](https://github.com/gohugoio/hugo/issues/1970)) and the aforementioned GFM todo lists ([#2270](https://github.com/gohugoio/hugo/issues/2270)) are not fully supported. Contributions are welcome.
-{{% /warning %}}
-
-## MathJax with Hugo
-
-[MathJax](https://www.mathjax.org/) is a JavaScript library that allows the display of mathematical expressions described via a LaTeX-style syntax in the HTML (or Markdown) source of a web page. As it is a pure a JavaScript library, getting it to work within Hugo is fairly straightforward, but does have some oddities that will be discussed here.
-
-This is not an introduction into actually using MathJax to render typeset mathematics on your website. Instead, this page is a collection of tips and hints for one way to get MathJax working on a website built with Hugo.
-
-### Enable MathJax
-
-The first step is to enable MathJax on pages that you would like to have typeset math. There are multiple ways to do this (adventurous readers can consult the [Loading and Configuring](https://docs.mathjax.org/en/latest/web/configuration.html) section of the MathJax documentation for additional methods of including MathJax), but the easiest way is to use the secure MathJax CDN by include a `<script>` tag for the officially recommended secure CDN ([cdn.js.com](https://cdnjs.com)):
-
-{{< code file="add-mathjax-to-page.html" >}}
-<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
-</script>
-{{< /code >}}
-
-One way to ensure that this code is included in all pages is to put it in one of the templates that live in the `layouts/partials/` directory. For example, I have included this in the bottom of my template `footer.html` because I know that the footer will be included in every page of my website.
-
-### Options and Features
-
-MathJax is a stable open-source library with many features. I encourage the interested reader to view the [MathJax Documentation](https://docs.mathjax.org/en/latest/index.html), specifically the sections on [Basic Usage](http://docs.mathjax.org/en/latest/index.html#basic-usage) and [MathJax Configuration Options](http://docs.mathjax.org/en/latest/index.html#mathjax-configuration-options).
-
-### Issues with Markdown
-
-{{% note %}}
-The following issues with Markdown assume you are using `.md` for content and BlackFriday for parsing. Using [Mmark](#mmark) as your content format will obviate the need for the following workarounds.
-
-When using Mmark with MathJax, use `displayMath: [['$$','$$'], ['\\[','\\]']]`. See the [Mmark `README.md`](https://github.com/miekg/mmark/wiki/Syntax#math-blocks) for more information. In addition to MathJax, Mmark has been shown to work well with [KaTeX](https://github.com/Khan/KaTeX). See this [related blog post from a Hugo user](http://nosubstance.me/post/a-great-toolset-for-static-blogging/).
-{{% /note %}}
-
-After enabling MathJax, any math entered between proper markers (see the [MathJax documentation][mathjaxdocs]) will be processed and typeset in the web page. One issue that comes up, however, with Markdown is that the underscore character (`_`) is interpreted by Markdown as a way to wrap text in `emph` blocks while LaTeX (MathJax) interprets the underscore as a way to create a subscript. This "double speak" of the underscore can result in some unexpected and unwanted behavior.
-
-### Solution
-
-There are multiple ways to remedy this problem. One solution is to simply escape each underscore in your math code by entering `\_` instead of `_`. This can become quite tedious if the equations you are entering are full of subscripts.
-
-Another option is to tell Markdown to treat the MathJax code as verbatim code and not process it. One way to do this is to wrap the math expression inside a `<div>` `</div>` block. Markdown would ignore these sections and they would get passed directly on to MathJax and processed correctly. This works great for display style mathematics, but for inline math expressions the line break induced by the `<div>` is not acceptable. The syntax for instructing Markdown to treat inline text as verbatim is by wrapping it in backticks (`` ` ``). You might have noticed, however, that the text included in between backticks is rendered differently than standard text (on this site these are items highlighted in red). To get around this problem, we could create a new CSS entry that would apply standard styling to all inline verbatim text that includes MathJax code. Below I will show the HTML and CSS source that would accomplish this (note this solution was adapted from [this blog post](http://doswa.com/2011/07/20/mathjax-in-markdown.html)---all credit goes to the original author).
-
-{{< code file="mathjax-markdown-solution.html" >}}
-<script type="text/x-mathjax-config">
-MathJax.Hub.Config({
- tex2jax: {
- inlineMath: [['$','$'], ['\\(','\\)']],
- displayMath: [['$$','$$'], ['\[','\]']],
- processEscapes: true,
- processEnvironments: true,
- skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
- TeX: { equationNumbers: { autoNumber: "AMS" },
- extensions: ["AMSmath.js", "AMSsymbols.js"] }
- }
-});
-</script>
-{{< /code >}}
-
-As before, this content should be included in the HTML source of each page that will be using MathJax. The next code snippet contains the CSS that is used to have verbatim MathJax blocks render with the same font style as the body of the page.
-
-{{< code file="mathjax-style.css" >}}
-code.has-jax {
- font: inherit;
- font-size: 100%;
- background: inherit;
- border: inherit;
- color: #515151;
-}
-{{< /code >}}
-
-In the CSS snippet, notice the line `color: #515151;`. `#515151` is the value assigned to the `color` attribute of the `body` class in my CSS. In order for the equations to fit in with the body of a web page, this value should be the same as the color of the body.
-
-### Usage
+The current list of content formats in Hugo:
-With this setup, everything is in place for a natural usage of MathJax on pages generated using Hugo. In order to include inline mathematics, just put LaTeX code in between `` `$ TeX Code $` `` or `` `\( TeX Code \)` ``. To include display style mathematics, just put LaTeX code in between `<div>$$TeX Code$$</div>`. All the math will be properly typeset and displayed within your Hugo generated web page!
+| Name | Markup identifiers | Comment |
+| ------------- | ------------- |-------------|
+| Goldmark | md, markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).{{< new-in "0.60.0" >}} |
+| Blackfriday | blackfriday |Blackfriday will eventually be deprecated.|
+|MMark|mmark|Mmark is deprecated and will be removed in a future release.|
+|Emacs Org-Mode|org|See [go-org](https://github.com/niklasfasching/go-org).|
+|Asciidoc|asciidoc, adoc, ad|Needs Asciidoc or [Asciidoctor][ascii] installed.|
+|RST|rst|Needs [RST](http://docutils.sourceforge.net/rst.html) installed.|
+|Pandoc|pandoc, pdc|Needs [Pandoc](https://www.pandoc.org/) installed.|
+|HTML|html, htm|To be treated as a content file, with layout, shortcodes etc., it must have front matter. If not, it will be copied as-is.|
-## Additional Formats Through External Helpers
+The `markup identifier` is fetched from either the `markup` variable in front matter or from the file extension. For markup-related configuration, see [Configure Markup](/getting-started/configuration-markup/).
-Hugo has a new concept called _external helpers_. It means that you can write your content using [Asciidoc][ascii], [reStructuredText][rest], or [pandoc]. If you have files with associated extensions, Hugo will call external commands to generate the content. ([See the Hugo source code for external helpers][helperssource].)
-For example, for Asciidoc files, Hugo will try to call the `asciidoctor` or `asciidoc` command. This means that you will have to install the associated tool on your machine to be able to use these formats. ([See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/)).
+## External Helpers
-To use these formats, just use the standard extension and the front matter exactly as you would do with natively supported `.md` files.
+Some of the formats in the table above needs external helpers installed on your PC. For example, for Asciidoc files, Hugo will try to call the `asciidoctor` or `asciidoc` command. This means that you will have to install the associated tool on your machine to be able to use these formats. ([See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/)).
Hugo passes reasonable default arguments to these external helpers by default:
diff --git a/docs/content/en/content-management/syntax-highlighting.md b/docs/content/en/content-management/syntax-highlighting.md
index 6b277365f..a4359e05d 100644
--- a/docs/content/en/content-management/syntax-highlighting.md
+++ b/docs/content/en/content-management/syntax-highlighting.md
@@ -3,7 +3,7 @@ title: Syntax Highlighting
description: Hugo comes with really fast syntax highlighting from Chroma.
date: 2017-02-01
publishdate: 2017-02-01
-keywords: [highlighting,pygments,chroma,code blocks,syntax]
+keywords: [highlighting,chroma,code blocks,syntax]
categories: [content management]
menu:
docs:
@@ -16,17 +16,39 @@ aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/]
toc: true
---
-From Hugo 0.28, the default syntax highlighter in Hugo is [Chroma](https://github.com/alecthomas/chroma); it is built in Go and is really, really fast -- and for the most important parts compatible with Pygments.
-If you want to continue to use Pygments (see below), set `pygmentsUseClassic=true` in your site config.
+Hugo uses [Chroma](https://github.com/alecthomas/chroma) as its code highlighter; it is built in Go and is really, really fast -- and for the most important parts compatible with Pygments we used before.
-The example below shows a simple code snippet from the Hugo source highlighted with the `highlight` shortcode. Note that the gohugo.io site is generated with `pygmentsUseClasses=true` (see [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css)).
+## Configure Syntax Highlighter
+
+See [Configure Highlight](/getting-started/configuration-markup#highlight).
+
+
+## Generate Syntax Highlighter CSS
+
+If you run with `pygmentsUseClasses=true` in your site config, you need a style sheet.
+
+You can generate one with Hugo:
+
+```bash
+hugo gen chromastyles --style=monokai > syntax.css
+```
+
+Run `hugo gen chromastyles -h` for more options. See https://xyproto.github.io/splash/docs/ for a gallery of available styles.
+
+
+## Highlight Shortcode
-* `linenos=inline` or `linenos=table` (`table` will give copy-and-paste friendly code blocks) turns on line numbers.
-* `hl_lines` lists a set of line numbers or line number ranges to be highlighted. Note that the hyphen range syntax is only supported for Chroma.
+Highlighting is carried out via the [built-in shortcode](/content-management/shortcodes/) `highlight`. `highlight` takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
+
+Options:
+
+* `linenos`: Valid values are `true`, `false`, `table`, `inline`. `table` will give copy-and-paste friendly code blocks) turns on line numbers.
+* Setting `linenos` to `false` will turn off linenumbers if it's configured to be on in site config.{{< new-in "0.60.0" >}}
+* `hl_lines` lists a set of line numbers or line number ranges to be highlighted.
* `linenostart=199` starts the line number count from 199.
-With that, this:
+### Example: Highlight Shortcode
```
{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
@@ -62,133 +84,62 @@ func GetTitleFunc(style string) func(s string) string {
{{< / highlight >}}
-## Configure Syntax Highlighter
-To make the transition from Pygments to Chroma seamless, they share a common set of configuration options:
-
-pygmentsOptions
-: A comma separated list of options. See below for a full list.
-
-pygmentsCodeFences
-: Set to true to enable syntax highlighting in code fences with a language tag in markdown (see below for an example).
-
-pygmentsStyle
-: The style of code highlighting. Note that this option is not
- relevant when `pygmentsUseClasses` is set.
-
- Syntax highlighting galleries:
- **Chroma** ([short snippets](https://xyproto.github.io/splash/docs/all.html),
- [long snippets](https://xyproto.github.io/splash/docs/longer/all.html)),
- [Pygments](https://help.farbox.com/pygments.html)
-
-pygmentsUseClasses
-: Set to `true` to use CSS classes to format your highlighted code. See [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css).
-
-pygmentsCodeFencesGuessSyntax
-: Set to `true` to try to do syntax highlighting on code fenced blocks in markdown without a language tag.
-
-pygmentsUseClassic
-: Set to true to use Pygments instead of the much faster Chroma.
-
-### Options
-
-`pygmentsOptions` can be set either in site config or overridden per code block in the Highlight shortcode or template func.
-
-noclasses
-: Use inline style.
-
-linenos
-: For Chroma, any value in this setting will print line numbers. Pygments has some more fine grained control.
-
-linenostart
-: Start the line numbers from this value (default is 1).
-
-
-hl_lines
-: Highlight a space separated list of line numbers. For Chroma, you can provide a list of ranges, i.e. "3-8 10-20".
-
-
-The full set of supported options for Pygments is: `encoding`, `outencoding`, `nowrap`, `full`, `title`, `style`, `noclasses`, `classprefix`, `cssclass`, `cssstyles`, `prestyles`, `linenos`, `hl_lines`, `linenostart`, `linenostep`, `linenospecial`, `nobackground`, `lineseparator`, `lineanchors`, `linespans`, `anchorlinenos`, `startinline`. See the [Pygments HTML Formatter Documentation](http://pygments.org/docs/formatters/#HtmlFormatter) for details.
-
-
-## Generate Syntax Highlighter CSS
-
-If you run with `pygmentsUseClasses=true` in your site config, you need a style sheet.
-
-You can generate one with Hugo:
-
-```bash
-hugo gen chromastyles --style=monokai > syntax.css
-```
-
-Run `hugo gen chromastyles -h` for more options. See https://xyproto.github.io/splash/docs/ for a gallery of available styles.
-
-
-## Highlight Shortcode
-
-Highlighting is carried out via the [built-in shortcode](/content-management/shortcodes/) `highlight`. `highlight` takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
-
-### Example `highlight` Shortcode
-
-{{< code file="example-highlight-shortcode-input.md" >}}
-{{</* highlight html */>}}
-<section id="main">
- <div>
- <h1 id="title">{{ .Title }}</h1>
- {{ range .Pages }}
- {{ .Render "summary"}}
- {{ end }}
- </div>
-</section>
-{{</* /highlight */>}}
-{{< /code >}}
-
-
## Highlight Template Func
See [Highlight](/functions/highlight/).
-## Highlight in Code Fences
+## Highlighting in Code Fences
-It is also possible to add syntax highlighting with GitHub flavored code fences. To enable this, set the `pygmentsCodeFences` to `true` in Hugo's [configuration file](/getting-started/configuration/);
+Highlighting in code fences is enabled by default.{{< new-in "0.60.0" >}}
````
-```go-html-template
-<section id="main">
- <div>
- <h1 id="title">{{ .Title }}</h1>
- {{ range .Pages }}
- {{ .Render "summary"}}
- {{ end }}
- </div>
-</section>
+```go-html-template{hl_lines=[3,"5-6"],linenos=true}
```
````
-## List of Chroma Highlighting Languages
-
-The full list of Chroma lexers and their aliases (which is the identifier used in the `highlight` template func or when doing highlighting in code fences):
-
-{{< chroma-lexers >}}
+````
+```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
+// ... code
+````
-## Highlight with Pygments Classic
-If you for some reason don't want to use the built-in Chroma highlighter, you can set `pygmentsUseClassic=true` in your config and add Pygments to your path.
+Gives this:
-{{% note "Disclaimers on Pygments" %}}
-* Pygments is relatively slow and _causes a performance hit when building your site_, but Hugo has been designed to cache the results to disk.
-* The caching can be turned off by setting the `--ignoreCache` flag to `true`.
-* The languages available for highlighting depend on your Pygments installation.
-{{% /note %}}
+```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
+// GetTitleFunc returns a func that can be used to transform a string to
+// title case.
+//
+// The supported styles are
+//
+// - "Go" (strings.Title)
+// - "AP" (see https://www.apstylebook.com/)
+// - "Chicago" (see https://www.chicagomanualofstyle.org/home.html)
+//
+// If an unknown or empty style is provided, AP style is what you get.
+func GetTitleFunc(style string) func(s string) string {
+ switch strings.ToLower(style) {
+ case "go":
+ return strings.Title
+ case "chicago":
+ tc := transform.NewTitleConverter(transform.ChicagoStyle)
+ return tc.Title
+ default:
+ tc := transform.NewTitleConverter(transform.APStyle)
+ return tc.Title
+ }
+}
+```
-If you have never worked with Pygments before, here is a brief primer:
+{{< new-in "0.60.0" >}}Note that only Goldmark supports passing attributes such as `hl_lines`, and it's important that it does not contain any spaces. See [goldmark-highlighting](https://github.com/yuin/goldmark-highlighting) for more information.
-+ Install Python from [python.org](https://www.python.org/downloads/). Version 2.7.x is already sufficient.
-+ Run `pip install Pygments` in order to install Pygments. Once installed, Pygments gives you a command `pygmentize`. Make sure it sits in your PATH; otherwise, Hugo will not be able to find and use it.
+The options are the same as in the [highlighting shortcode](/content-management/syntax-highlighting/#highlight-shortcode),including `linenos=false`, but note the slightly different Markdown attribute syntax.
-On Debian and Ubuntu systems, you may also install Pygments by running `sudo apt-get install python3-pygments`.
+## List of Chroma Highlighting Languages
+The full list of Chroma lexers and their aliases (which is the identifier used in the `highlight` template func or when doing highlighting in code fences):
+{{< chroma-lexers >}}
[Prism]: https://prismjs.com
[prismdownload]: https://prismjs.com/download.html
diff --git a/docs/content/en/contribute/documentation.md b/docs/content/en/contribute/documentation.md
index a85245b06..c4bbbd8bb 100644
--- a/docs/content/en/contribute/documentation.md
+++ b/docs/content/en/contribute/documentation.md
@@ -104,6 +104,7 @@ Your options for languages are `xml`/`html`, `go`/`golang`, `md`/`markdown`/`mkd
```
````
+
### Code Block Shortcode
The Hugo documentation comes with a very robust shortcode for adding interactive code blocks.
diff --git a/docs/content/en/functions/highlight.md b/docs/content/en/functions/highlight.md
index f0845227d..1740742ce 100644
--- a/docs/content/en/functions/highlight.md
+++ b/docs/content/en/functions/highlight.md
@@ -1,7 +1,7 @@
---
title: highlight
linktitle: highlight
-description: Takes a string of code and language declaration and uses Pygments to return syntax-highlighted HTML with inline-styles.
+description: Takes a string of code and language declaration and uses Chroma to return syntax-highlighted HTML.
godocref:
date: 2017-02-01
publishdate: 2017-02-01
@@ -10,7 +10,7 @@ categories: [functions]
menu:
docs:
parent: "functions"
-keywords: [highlighting,pygments,code blocks,syntax]
+keywords: [highlighting,code blocks,syntax]
signature: ["highlight INPUT LANG OPTIONS"]
workson: []
hugoversion:
@@ -20,8 +20,6 @@ deprecated: false
[`highlight` is used in Hugo's built-in `highlight` shortcode][highlight].
-See [Installing Hugo][installpygments] for more information on Pygments or [Syntax Highlighting][syntax] for more options on how to add syntax highlighting to your code blocks with Hugo.
-
[highlight]: /content-management/shortcodes/#highlight
[installpygments]: /getting-started/installing/#installing-pygments-optional
diff --git a/docs/content/en/getting-started/configuration-markup.md b/docs/content/en/getting-started/configuration-markup.md
new file mode 100644
index 000000000..2a24fcdd0
--- /dev/null
+++ b/docs/content/en/getting-started/configuration-markup.md
@@ -0,0 +1,73 @@
+---
+title: Configure Markup
+description: How to handle Markdown and other markup related configuration.
+date: 2019-11-15
+categories: [getting started,fundamentals]
+keywords: [configuration,highlighting]
+weight: 65
+sections_weight: 65
+slug: configuration-markup
+toc: true
+---
+
+## Configure Markup
+
+{{< new-in "0.60.0" >}}
+
+See [Goldmark](#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](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. Note that the feature set of Goldmark vs Blackfriday isn't the same; you gain a lot but also lose some, but we will work to bridge any gap in the upcoming Hugo versions.
+
+This is the default configuration:
+
+{{< code-toggle config="markup.goldmark" />}}
+
+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](https://daringfireball.net/projects/smartypants/).
+
+### Blackfriday
+
+
+[Blackfriday](https://github.com/russross/blackfriday) was Hugo's default Markdown rendering engine, now replaced with Goldmark. But you can still use it: Just set `defaultMarkdownHandler` to `blackfriday` in your top level `markup` config.
+
+This is the default config:
+
+{{< code-toggle config="markup.blackFriday" />}}
+
+### Highlight
+
+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/).
+
+{{< code-toggle config="markup.highlight" />}}
+
+For `style`, see these galleries:
+
+* [Short snippets](https://xyproto.github.io/splash/docs/all.html)
+* [Long snippets](https://xyproto.github.io/splash/docs/longer/all.html)
+
+For CSS, see [Generate Syntax Highlighter CSS](/content-management/syntax-highlighting/#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. \ No newline at end of file
diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md
index 4fea87723..a653c0e0b 100644
--- a/docs/content/en/getting-started/configuration.md
+++ b/docs/content/en/getting-started/configuration.md
@@ -184,11 +184,14 @@ log (false)
logFile ("")
: Log File path (if set, logging enabled automatically).
+markup
+: See [Configure Markup](/getting-started/configuration-markup).{{< new-in "0.60.0" >}}
+
menu
: See [Add Non-content Entries to a Menu](/content-management/menus/#add-non-content-entries-to-a-menu).
module
-: Module config see [Module Config](/hugo-modules/configuration/).
+: Module config see [Module Config](/hugo-modules/configuration/).{{< new-in "0.56.0" >}}
newContentEditor ("")
: The editor to use when creating new content.
@@ -214,26 +217,8 @@ pluralizeListTitles (true)
publishDir ("public")
: The directory to where Hugo will write the final static site (the HTML files etc.).
-pygmentsOptions ("")
-: A comma separated list of options for syntax highlighting. See the [Syntax Highlighting Options](/content-management/syntax-highlighting/#options) for the full list of available options.
-
-pygmentsCodeFences (false)
-: Enables syntax highlighting in [code fences with a language tag](/content-management/syntax-highlighting/#highlight-in-code-fences) in markdown.
-
-pygmentsCodeFencesGuessSyntax (false)
-: Enable syntax guessing for code fences without specified language.
-
-pygmentsStyle ("monokai")
-: Color-theme or style for syntax highlighting. See [Pygments Color Themes](https://help.farbox.com/pygments.html).
-
-pygmentsUseClasses (false)
-: Enable using external CSS for syntax highlighting.
-
-pygmentsUseClassic (false)
-: Enable using Pygments instead of the much faster Chroma for syntax highlighting.
-
related
-: See [Related Content](/content-management/related/#configure-related-content).
+: See [Related Content](/content-management/related/#configure-related-content).{{< new-in "0.27" >}}
relativeURLs (false)
: Enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
@@ -436,29 +421,6 @@ The above will try first to extract the value for `.Date` from the filename, the
`:git`
: This is the Git author date for the last revision of this content file. This will only be set if `--enableGitInfo` is set or `enableGitInfo = true` is set in site config.
-## Configure Blackfriday
-
-[Blackfriday](https://github.com/russross/blackfriday) is Hugo's built-in Markdown rendering engine.
-
-Hugo typically configures Blackfriday with sane default values that should fit most use cases reasonably well.
-
-However, if you have specific needs with respect to Markdown, Hugo exposes some of its Blackfriday behavior options for you to alter. The following table lists these Hugo options, paired with the corresponding flags from Blackfriday's source code ( [html.go](https://github.com/russross/blackfriday/blob/master/html.go) and [markdown.go](https://github.com/russross/blackfriday/blob/master/markdown.go)).
-
-{{< readfile file="/content/en/readfiles/bfconfig.md" markdown="true" >}}
-
-{{% note %}}
-1. Blackfriday flags are *case sensitive* as of Hugo v0.15.
-2. Blackfriday flags must be grouped under the `blackfriday` key and can be set on both the site level *and* the page level. Any setting on a page will override its respective site setting.
-{{% /note %}}
-
-{{< code-toggle file="config" >}}
-[blackfriday]
- angledQuotes = true
- fractions = false
- plainIDAnchors = true
- extensions = ["hardLineBreak"]
-{{< /code-toggle >}}
-
## Configure Additional Output Formats
Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See [Output Formats][] for information on how to add these values to your Hugo project's configuration file.
diff --git a/docs/content/en/getting-started/installing.md b/docs/content/en/getting-started/installing.md
index bffbb777e..f388188b2 100644
--- a/docs/content/en/getting-started/installing.md
+++ b/docs/content/en/getting-started/installing.md
@@ -502,12 +502,6 @@ OpenBSD provides a package for Hugo via `pkg_add`:
Upgrading Hugo is as easy as downloading and replacing the executable you’ve placed in your `PATH` or run `brew upgrade hugo` if using Homebrew.
-## Install Pygments (Optional)
-
-The Hugo executable has one *optional* external dependency for source code highlighting ([Pygments][pygments]).
-
-If you want to have source code highlighting using the [highlight shortcode][], you need to install the Python-based Pygments program. The procedure is outlined on the [Pygments homepage][pygments].
-
## Next Steps
Now that you've installed Hugo, read the [Quick Start guide][quickstart] and explore the rest of the documentation. If you have questions, ask the Hugo community directly by visiting the [Hugo Discussion Forum][forum].
diff --git a/docs/content/en/readfiles/bfconfig.md b/docs/content/en/readfiles/bfconfig.md
deleted file mode 100644
index 95941234d..000000000
--- a/docs/content/en/readfiles/bfconfig.md
+++ /dev/null
@@ -1,197 +0,0 @@
-## Blackfriday Options
-
-`taskLists`
-: default: **`true`**<br>
- Blackfriday flag: <br>
- Purpose: `false` turns off GitHub-style automatic task/TODO list generation.
-
-`smartypants`
-: default: **`true`** <br>
- Blackfriday flag: **`HTML_USE_SMARTYPANTS`** <br>
- Purpose: `false` disables smart punctuation substitutions, including smart quotes, smart dashes, smart fractions, etc. If `true`, it may be fine-tuned with the `angledQuotes`, `fractions`, `smartDashes`, and `latexDashes` flags (see below).
-
-`smartypantsQuotesNBSP`
-: default: **`false`** <br>
- Blackfriday flag: **`HTML_SMARTYPANTS_QUOTES_NBSP`** <br>
- Purpose: `true` enables French style Guillemets with non-breaking space inside the quotes.
-
-`angledQuotes`
-: default: **`false`**<br>
- Blackfriday flag: **`HTML_SMARTYPANTS_ANGLED_QUOTES`**<br>
- Purpose: `true` enables smart, angled double quotes. Example: "Hugo" renders to «Hugo» instead of “Hugo”.
-
-`fractions`
-: default: **`true`**<br>
- Blackfriday flag: **`HTML_SMARTYPANTS_FRACTIONS`** <br>
- Purpose: <code>false</code> disables smart fractions.<br>
- Example: `5/12` renders to <sup>5</sup>&frasl;<sub>12</sub>(<code>&lt;sup&gt;5&lt;/sup&gt;&amp;frasl;&lt;sub&gt;12&lt;/sub&gt;</code>).<br> <small><strong>Caveat:</strong> Even with <code>fractions = false</code>, Blackfriday still converts `1/2`, `1/4`, and `3/4` respectively to ½ (<code>&amp;frac12;</code>), ¼ (<code>&amp;frac14;</code>) and ¾ (<code>&amp;frac34;</code>), but only these three.</small>
-
-`smartDashes`
-: default: **`true`** <br>
- Blackfriday flag: **`HTML_SMARTY_DASHES`** <br>
- Purpose: `false` disables smart dashes; i.e., the conversion of multiple hyphens into an en-dash or em-dash. If `true`, its behavior can be modified with the `latexDashes` flag below.
-
-`latexDashes`
-: default: **`true`** <br>
- Blackfriday flag: **`HTML_SMARTYPANTS_LATEX_DASHES`** <br>
- Purpose: `false` disables LaTeX-style smart dashes and selects conventional smart dashes. Assuming `smartDashes`: <br>
- If `true`, `--` is translated into &ndash; (`&ndash;`), whereas `---` is translated into &mdash; (`&mdash;`). <br>
- However, *spaced* single hyphen between two words is translated into an en&nbsp;dash&mdash; e.g., "`12 June - 3 July`" becomes `12 June &ndash; 3 July` upon rendering.
-
-`hrefTargetBlank`
-: default: **`false`** <br>
- Blackfriday flag: **`HTML_HREF_TARGET_BLANK`** <br>
- Purpose: `true` opens <s>external links</s> **absolute** links in a new window or tab. While the `target="_blank"` attribute is typically used for external links, Blackfriday does that for _all_ absolute links ([ref](https://discourse.gohugo.io/t/internal-links-in-same-tab-external-links-in-new-tab/11048/8)). One needs to make note of this if they use absolute links throughout, for internal links too (for example, by setting `canonifyURLs` to `true` or via `absURL`).
-
-`nofollowLinks`
-: default: **`false`** <br>
- Blackfriday flag: **`HTML_NOFOLLOW_LINKS`** <br>
- Purpose: `true` creates <s>external links</s> **absolute** links with `nofollow` being added to their `rel` attribute. Thereby crawlers are advised to not follow the link. While the `rel="nofollow"` attribute is typically used for external links, Blackfriday does that for _all_ absolute links. One needs to make note of this if they use absolute links throughout, for internal links too (for example, by setting `canonifyURLs` to `true` or via `absURL`).
-
-`noreferrerLinks`
-: default: **`false`** <br>
- Blackfriday flag: **`HTML_NOREFERRER_LINKS`** <br>
- Purpose: `true` creates <s>external links</s> **absolute** links with `noreferrer` being added to their `rel` attribute. Thus when following the link no referrer information will be leaked. While the `rel="noreferrer"` attribute is typically used for external links, Blackfriday does that for _all_ absolute links. One needs to make note of this if they use absolute links throughout, for internal links too (for example, by setting `canonifyURLs` to `true` or via `absURL`).
-
-`plainIDAnchors`
-: default **`true`** <br>
- Blackfriday flag: **`FootnoteAnchorPrefix` and `HeaderIDSuffix`** <br>
- Purpose: `true` renders any heading and footnote IDs without the document ID. <br>
- Example: renders `#my-heading` instead of `#my-heading:bec3ed8ba720b970`
-
-`extensions`
-: default: **`[]`** <br>
- Purpose: Enable one or more Blackfriday's Markdown extensions (**`EXTENSION_*`**). <br>
- Example: Include `hardLineBreak` in the list to enable Blackfriday's `EXTENSION_HARD_LINE_BREAK`. <br>
- *See [Blackfriday extensions](#blackfriday-extensions) section for information on all extensions.*
-
-`extensionsmask`
-: default: **`[]`** <br>
- Purpose: Disable one or more of Blackfriday's Markdown extensions (**`EXTENSION_*`**). <br>
- Example: Include `autoHeaderIds` as `false` in the list to disable Blackfriday's `EXTENSION_AUTO_HEADER_IDS`. <br>
- *See [Blackfriday extensions](#blackfriday-extensions) section for information on all extensions.*
-
-`skipHTML`
-: default: **`false`** <br>
- Blackfriday flag: **`HTML_SKIP_HTML`** <br>
- Purpose: `true` causes any HTML in the markdown files to be skipped.
-
-## Blackfriday extensions
-
-`noIntraEmphasis`
-: default: *enabled* <br>
- Purpose: The "\_" character is commonly used inside words when discussing
- code, so having Markdown interpret it as an emphasis command is usually the
- wrong thing. When enabled, Blackfriday lets you treat all emphasis markers
- as normal characters when they occur inside a word.
-
-`tables`
-: default: *enabled* <br>
- Purpose: When enabled, tables can be created by drawing them in the input
- using the below syntax:
- Example:
-
- Name | Age
- --------|------
- Bob | 27
- Alice | 23
-
-`fencedCode`
-: default: *enabled* <br>
- Purpose: When enabled, in addition to the normal 4-space indentation to mark
- code blocks, you can explicitly mark them and supply a language (to make
- syntax highlighting simple).
-
- You can use 3 or more backticks to mark the beginning of the block, and the
- same number to mark the end of the block.
-
- Example:
-
- ```md
- # Heading Level 1
- Some test
- ## Heading Level 2
- Some more test
- ```
-
-`autolink`
-: default: *enabled* <br>
- Purpose: When enabled, URLs that have not been explicitly marked as links
- will be converted into links.
-
-`strikethrough`
-: default: *enabled* <br>
- Purpose: When enabled, text wrapped with two tildes will be crossed out. <br>
- Example: `~~crossed-out~~`
-
-`laxHtmlBlocks`
-: default: *disabled* <br>
- Purpose: When enabled, loosen up HTML block parsing rules.
-
-`spaceHeaders`
-: default: *enabled* <br>
- Purpose: When enabled, be strict about prefix header rules.
-
-`hardLineBreak`
-: default: *disabled* <br>
- Purpose: When enabled, newlines in the input translate into line breaks in
- the output.
-
-
-`tabSizeEight`
-: default: *disabled* <br>
- Purpose: When enabled, expand tabs to eight spaces instead of four.
-
-`footnotes`
-: default: *enabled* <br>
- Purpose: When enabled, Pandoc-style footnotes will be supported. The
- footnote marker in the text that will become a superscript text; the
- footnote definition will be placed in a list of footnotes at the end of the
- document. <br>
- Example:
-
- This is a footnote.[^1]
-
- [^1]: the footnote text.
-
-`noEmptyLineBeforeBlock`
-: default: *disabled* <br>
- Purpose: When enabled, no need to insert an empty line to start a (code,
- quote, ordered list, unordered list) block.
-
-
-`headerIds`
-: default: *enabled* <br>
- Purpose: When enabled, allow specifying header IDs with `{#id}`.
-
-`titleblock`
-: default: *disabled* <br>
- Purpose: When enabled, support [Pandoc-style title blocks][1].
-
-`autoHeaderIds`
-: default: *enabled* <br>
- Purpose: When enabled, auto-create the header ID's from the headline text.
-
-`backslashLineBreak`
-: default: *enabled* <br>
- Purpose: When enabled, translate trailing backslashes into line breaks.
-
-`definitionLists`
-: default: *enabled* <br>
- Purpose: When enabled, a simple definition list is made of a single-line
- term followed by a colon and the definition for that term. <br>
- Example:
-
- Cat
- : Fluffy animal everyone likes
-
- Internet
- : Vector of transmission for pictures of cats
-
- Terms must be separated from the previous definition by a blank line.
-
-`joinLines`
-: default: *enabled* <br>
- Purpose: When enabled, delete newlines and join the lines.
-
-[1]: http://pandoc.org/MANUAL.html#extension-pandoc_title_block
diff --git a/docs/content/en/templates/shortcode-templates.md b/docs/content/en/templates/shortcode-templates.md
index cf34feedc..898296f2b 100644
--- a/docs/content/en/templates/shortcode-templates.md
+++ b/docs/content/en/templates/shortcode-templates.md
@@ -299,10 +299,6 @@ The rendered output of the HTML example code block will be as follows:
</pre></div>
{{< /code >}}
-{{% note %}}
-The preceding shortcode makes use of a Hugo-specific template function called `highlight`, which uses [Pygments](http://pygments.org) to add syntax highlighting to the example HTML code block. See the [developer tools page on syntax highlighting](/tools/syntax-highlighting/) for more information.
-{{% /note %}}
-
### Nested Shortcode: Image Gallery
Hugo's [`.Parent` shortcode variable][parent] returns a boolean value depending on whether the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters.