Squashed 'docs/' changes from 51c4f3184..af4b7ac5b

af4b7ac5b Remove mention of Amber and Ace
c841e9207 Exif docs corrections (#978)
0f82420b8 Change cache assets default example to 1 year
676dc6e12 Release 0.61.0
a1d9fb18a Merge commit '79c5d7053486f540b6219e693d5590f2c4c3937a'
1b9e675cd releaser: Add release notes to /docs for release of 0.61.0
5b95cbc8a Fixed suffixIsRemoved error in code samples (#975)
59b2c245b Fix Usage section in toc.md to consider Goldmark TOC settings
fd3828673 Add link on how to configure TOC w/ Goldmark
ea339f2d6 Added external learning resources including Hugo In Action book.
fab502d5d Adjust release notes
269a025ef Release 0.60.1
6bff50bea Merge branch 'temp601'
e15251c43 releaser: Add release notes to /docs for release of 0.60.1
690b864b9 Update use-modules.md
345ca8c36 Update syntax-highlighting.md
be64af9f5 Update syntax-highlighting.md
df9dead83 Update syntax-highlighting.md
1c6e6d238 Fix relnotes
0ea6b2012 Update homepagetweets.toml
2c465625d Update index.md
0025bba09 Update index.md
7417f1c05 Update index.md
9eeb8ce57 Release 0.60.0
25a711023 Merge branch 'temp60'
0c4faab0e releaser: Add release notes to /docs for release of 0.60.0
779e5108e Update installing.md
2ef1c386a Minor text improvements in README.md
41ec5a19a Reword sentence for clarity search.md
ded74f098 Add Goldmark as the new default markdown handler
cb55cdbb0 Update introduction.md
fcaad653a Update homepage.md
7427a1fc5 Update configuration.md
8cc2c72ca tpl/collections: Allow dict to create nested structures
4538c092c Merge commit 'efc0b1bb6c6564f54d596467dbc6a18cb206954e'
90f908e7b Support Go time format strings in permalinks

git-subtree-dir: docs
git-subtree-split: af4b7ac5b403e392a92228e66058331905fff7dc
This commit is contained in:
Bjørn Erik Pedersen 2019-12-15 10:35:09 +01:00
parent efc0b1bb6c
commit 2e711a28c7
46 changed files with 677 additions and 617 deletions

View File

@ -13,16 +13,16 @@ Note that this repository contains solely the documentation for Hugo. For contri
*Pull requests shall **only** contain changes to the actual documentation. However, changes on the code base of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had these in mind when writing:
Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had the following criteria in mind when writing:
* Short is good. People go to the library to read novels. If there is more than one way to _do a thing_ in Hugo, describe the current _best practice_ (avoid "… but you can also do …" and "… in older versions of Hugo you had to …".
* For examples, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great, but don't list long and similar examples just so people can use them on their sites.
* Hugo has users from all over the world, so an easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
* For example, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great. Don't list long and similar examples just so people can use them on their sites.
* Hugo has users from all over the world, so easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
## Branches
* The `master` branch is where the site is automatically built from, and is the place to put changes relevant to the current Hugo version.
* The `next` branch is where we store changes that is related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
* The `next` branch is where we store changes that are related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
## Build

View File

@ -15,18 +15,6 @@ pluralizeListTitles = false
# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
disableAliases = true
# Highlighting config (Pygments)
# It is (currently) not in use, but you can do ```go in a content file if you want to.
pygmentsCodeFences = true
pygmentsOptions = ""
# Use the Chroma stylesheet
pygmentsUseClasses = true
pygmentsUseClassic = false
# See https://help.farbox.com/pygments.html
pygmentsStyle = "trac"
[module]
[module.hugoVersion]
min = "0.56.0"

View File

@ -14,17 +14,11 @@ pluralizeListTitles = false
# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
disableAliases = true
# Highlighting config (Pygments)
# It is (currently) not in use, but you can do ```go in a content file if you want to.
pygmentsCodeFences = true
pygmentsOptions = ""
# Use the Chroma stylesheet
pygmentsUseClasses = true
pygmentsUseClassic = false
# See https://help.farbox.com/pygments.html
pygmentsStyle = "trac"
[markup]
[markup.highlight]
style = "trac"
lineNumbersInTable = true
noClasses = false
[outputs]
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]

View File

@ -43,7 +43,7 @@ sections:
link: templates/
color_classes: bg-primary-color-light black
image: /images/home-page-templating-example.png
copy: "Hugo's Go-based templating provides just the right amount of logic to build anything from the simple to complex. If you prefer Jade/Pug-like syntax, you can also use Amber, Ace, or any combination of the three."
copy: "Hugo's Go-based templating provides just the right amount of logic to build anything from the simple to complex."
---
Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.

View File

@ -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/

View File

@ -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"
---
The current list of content formats in Hugo:
<div>
<h1>Hello, Hugo!</h1>
</div>
```
| 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.|
{{% 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 %}}
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/).
## 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.
## External Helpers
{{< 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
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!
## Additional Formats Through External Helpers
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/)).
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:

View File

@ -98,11 +98,12 @@ Tags:
{{ range $k, $v := .Tags }}
TAG: {{ $k }}: {{ $v }}
{{ end }}
{{ end }}
```
#### Exif fields
Data
Date
: "photo taken" date/time
Lat

View File

@ -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
* `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.
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
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" */>}}
@ -52,144 +74,65 @@ func GetTitleFunc(style string) func(s string) string {
case "go":
return strings.Title
case "chicago":
tc := transform.NewTitleConverter(transform.ChicagoStyle)
return tc.Title
return transform.NewTitleConverter(transform.ChicagoStyle)
default:
tc := transform.NewTitleConverter(transform.APStyle)
return tc.Title
return transform.NewTitleConverter(transform.APStyle)
}
}
{{< / 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 {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
// ... code
```
````
Gives this:
```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":
return transform.NewTitleConverter(transform.ChicagoStyle)
default:
return transform.NewTitleConverter(transform.APStyle)
}
}
```
{{< 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.
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.
## 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 >}}
## 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.
{{% 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 %}}
If you have never worked with Pygments before, here is a brief primer:
+ 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.
On Debian and Ubuntu systems, you may also install Pygments by running `sudo apt-get install python3-pygments`.
[Prism]: https://prismjs.com
[prismdownload]: https://prismjs.com/download.html
[Highlight.js]: https://highlightjs.org/

View File

@ -18,7 +18,11 @@ toc: true
---
{{% note "TOC Heading Levels are Fixed" %}}
Currently, the `{{.TableOfContents}}` [page variable](/variables/page/) does not allow you to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `<nav id="TableOfContents"><ul></ul></nav>` is going to start at `<h1>` when pulling from `{{.Content}}`.
Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `<nav id="TableOfContents"><ul></ul></nav>` was going to start at `<h1>` when pulling from `{{.Content}}`.
Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a switch to [Goldmark](https://github.com/yuin/goldmark/) as the default library for Markdown which has improved and configurable implementation of TOC. Take a look at [how to configure TOC](/getting-started/configuration-markup/#table-of-contents) for Goldmark renderer.
{{% /note %}}
## Usage
@ -43,7 +47,7 @@ A collection of textile samples lay spread out on the table - Samsa was a travel
Hugo will take this Markdown and create a table of contents from `## Introduction`, `## My Heading`, and `### My Subheading` and then store it in the [page variable][pagevars]`.TableOfContents`.
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with any `<h1>`'s (i.e., `#` in markdown) inside your content.'
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with appropriate HTML headings. See [the available settings](/getting-started/configuration-markup/#table-of-contents) to configure what heading levels you want to include in TOC.
{{% note "Table of contents not available for MMark" %}}
Hugo documents created in the [MMark](/content-management/formats/#mmark) Markdown dialect do not currently display TOCs. TOCs are, however, compatible with all other supported Markdown formats.

View File

@ -38,6 +38,13 @@ permalinks:
Only the content under `posts/` will have the new URL structure. For example, the file `content/posts/sample-entry.md` with `date: 2017-02-27T19:20:00-05:00` in its front matter will render to `public/2017/02/sample-entry/index.html` at build time and therefore be reachable at `https://example.com/2017/02/sample-entry/`.
If the standard date-based permalink configuration does not meet your needs, you can also format URL segments using [Go time formatting directives](https://golang.org/pkg/time/#Time.Format). For example, a URL structure with two digit years and month and day digits without zero padding can be accomplished with:
{{< code-toggle file="config" copy="false" >}}
permalinks:
posts: /:06/:1/:2/:title/
{{< /code-toggle >}}
You can also configure permalinks of taxonomies with the same syntax, by using the plural form of the taxonomy instead of the section. You will probably only want to use the configuration values `:slug` or `:title`.
### Permalink Configuration Values
@ -80,6 +87,8 @@ The following is a list of values that can be used in a `permalink` definition i
`:filename`
: the content's filename (without extension)
Additionally, a Go time format string prefixed with `:` may be used.
## Aliases
Aliases can be used to create redirects to your page from other URLs.

View File

@ -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.

View File

@ -21,6 +21,12 @@ aliases: []
`dict` is especially useful for passing more than one value to a partial template.
Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deply nested structure, e.g.:
```go-text-template
{{ $m := dict (slice "a" "b" "c") "value" }}
```
## Example: Using `dict` to pass multiple values to a `partial`

View File

@ -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

View File

@ -17,7 +17,8 @@ aliases: [/overview/introduction/]
toc: false
---
If this is your first time using Hugo and you've [already installed Hugo on your machine][installed], we recommend the [quick start][].
If this is your first time using Hugo and you've [already installed Hugo on your machine][installed], we recommend the [quick start][]. You can also use [external learning resources][] to learn Hugo.
[installed]: /getting-started/installing/
[quick start]: /getting-started/quick-start/
[external learning resources]: /getting-started/external-learning-resources/

View File

@ -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.

View File

@ -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.
@ -365,9 +350,9 @@ To set config params, prefix the name with `HUGO_PARAMS_`
Test and document setting params via JSON env var.
{{< /todo >}}
## Ignore Files When Rendering
## Ignore Content Files When Rendering
The following statement inside `./config.toml` will cause Hugo to ignore files ending with `.foo` and `.boo` when rendering:
The following statement inside `./config.toml` will cause Hugo to ignore content files ending with `.foo` and `.boo` when rendering:
```
ignoreFiles = [ "\\.foo$", "\\.boo$" ]
@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

View File

@ -0,0 +1,29 @@
---
title: External Learning Resources
linktitle: External Learning Resources
description: A list of tutorials and books on Hugo.
date: 2019-10-20
publishdate: 2019-10-20
lastmod: 2019-10-20
keywords: [books,tutorials,learning,usage]
menu:
docs:
parent: "getting-started"
weight: 70
weight: 70
sections_weight: 70
draft: false
toc: false
---
## Books
### Hugo In Action
[![Hugo In Action](hia.jpg)](https://www.manning.com/books/hugo-in-action)
Hugo in Action is a step-by-step guide to using Hugo to create static websites. Working with a complete example website and source code samples, youll learn how to build and host a low-maintenance, high-performance site that will wow your users and stay stable without relying on a third-party server.
[Hugo In Action Home Page](https://www.manning.com/books/hugo-in-action)
## Video tutorials
### Video Playlist by Mike Dane
Mike Dane expains the various features of via dedicated tutorials on [Youtube](https://www.youtube.com/watch?list=PLLAZ4kZ9dFpOnyRlyS-liKL5ReHDcj4G3&v=qtIqKaDlqXo).

View File

@ -463,6 +463,8 @@ Hugo installed via Snap can write only inside the users `$HOME` directory---a
This installs the "extended" Sass/SCSS version.
This option is not recommended because the Hugo in Linux package managers for Debian and Ubuntu is usually a few versions behind as described [here](https://github.com/gcushen/hugo-academic/issues/703)
### Arch Linux
You can also install Hugo from the Arch Linux [community](https://www.archlinux.org/packages/community/x86_64/hugo/) repository. Applies also to derivatives such as Manjaro.
@ -502,12 +504,6 @@ OpenBSD provides a package for Hugo via `pkg_add`:
Upgrading Hugo is as easy as downloading and replacing the executable youve 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].

View File

@ -21,7 +21,9 @@ toc: true
{{% note %}}
This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing).
It is recommended to have [Git](https://git-scm.com/downloads) installed to run this tutorial.
It is recommended to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
For other approaches learning Hugo like book or a video tutorial refer to the [external learning resources](/getting-started/external-learning-resources/) page.
{{% /note %}}

View File

@ -90,14 +90,14 @@ cloudFrontDistributionID = <ID>
# Samples:
[[deployment.matchers]]
# Cache static assets for 20 years.
# Cache static assets for 1 year.
pattern = "^.+\\.(js|css|svg|ttf)$"
cacheControl = "max-age=630720000, no-transform, public"
cacheControl = "max-age=31536000, no-transform, public"
gzip = true
[[deployment.matchers]]
pattern = "^.+\\.(png|jpg)$"
cacheControl = "max-age=630720000, no-transform, public"
cacheControl = "max-age=31536000, no-transform, public"
gzip = false
[[deployment.matchers]]

View File

@ -16,9 +16,9 @@ aliases: [/themes/usage/,/themes/installing/,/installing-and-using-themes/]
toc: true
---
## Prerequisites
## Prerequisite
{{% gomodules-info %}}
{{< gomodules-info >}}

View File

@ -0,0 +1,136 @@
---
date: 2019-11-27
title: "Now CommonMark Compliant!"
description: "Goldmark -- CommonMark compliant, GitHub flavored, fast and flexible -- is the new default library for Markdown in Hugo."
categories: ["Releases"]
---
[Goldmark](https://github.com/yuin/goldmark/) by [@yuin](https://github.com/yuin) is now the new default library used for Markdown in Hugo. It's CommonMark compliant and GitHub flavored, and both fast and flexible. Blackfriday, the old default, has served us well, but there have been formatting and portability issues that were hard to work around. The "CommonMark compliant" part is the main selling feature of Goldmark, but with that you also get attribute syntax on headers and code blocks (for code blocks you can turn on/off line numbers and highlight line ranges), strikethrough support and an improved and configurable implementation of `TableOfContents`. See [Markup Configuration](https://gohugo.io/getting-started/configuration-markup/) for an overview of extensions.
Please read the [Notes Section](#notes) and the updated documentation. We suggest you start with [List of content formats in Hugo](https://gohugo.io/content-management/formats/#list-of-content-formats). Goldmark is better, but the feature set is not fully comparable and it may be more stricter in some areas (there are 17 rules for how a [headline](https://spec.commonmark.org/0.29/#emphasis-and-strong-emphasis) should look like); if you have any problems you cannot work around, see [Configure Markup](https://gohugo.io/getting-started/configuration-markup/#configure-markup) for a way to change the default Markdown handler.
Also, if you have lots of inline HTML in your Markdown files, you may have to enable the `unsafe` mode:
{{< code-toggle file="config" >}}
markup:
goldmark:
renderer:
unsafe: true
{{< /code-toggle >}}
This release represents **62 contributions by 10 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@max-arnold](https://github.com/max-arnold), and [@trimbo](https://github.com/trimbo) for their ongoing contributions.
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) and [@davidsneighbour](https://github.com/davidsneighbour) for great work on the documentation site.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **8 contributions by 4 contributors**. A special thanks to [@bep](https://github.com/bep), [@jasdeepgill](https://github.com/jasdeepgill), [@luucamay](https://github.com/luucamay), and [@jkreft-usgs](https://github.com/jkreft-usgs) for their work on the documentation site.
Hugo now has:
* 39668+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 440+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 274+ [themes](http://themes.gohugo.io/)
## Notes
* Permalink config now supports Go date format strings. [#6489](https://github.com/gohugoio/hugo/pull/6489)
* We have removed the option to use Pygments as a highlighter. [#4491](https://github.com/gohugoio/hugo/pull/4491)
* Config option for code highlighting of code fences in Markdown is now default on. This is what most people wants.
* There are some differences in the feature set of Goldmark and Blackfriday. See the documentation for details.
* The highlight shortcode/template func and the code fence attributes now share the same API regarding line numbers and highlight ranges.
* The `Total in ...` for the `hugo` command now includes the configuration and modules loading, which should make it more honest/accurate.
* The image logic in the 3 SEO internal templates twitter_cards.html, opengraph.html, and schema.html is consolidated: `images` page param first, then bundled image matching `*feature*`, `*cover*` or `*thumbnail*`, then finally `images` site param.
* Deprecate mmark [33d73330](https://github.com/gohugoio/hugo/commit/33d733300a4f0b765234706e51bb7e077fdc2471) [@bep](https://github.com/bep) [#6486](https://github.com/gohugoio/hugo/issues/6486)
## Enhancements
### Templates
* Featured and Site.Params image support for Schema [c91970c0](https://github.com/gohugoio/hugo/commit/c91970c08ddf8c22ca4f967c2cc864c483987ac7) [@max-arnold](https://github.com/max-arnold)
* Add support for featured and global image to OpenGraph template [25a6b336](https://github.com/gohugoio/hugo/commit/25a6b33693992e8c6d9c35bc1e781ce3e2bca4be) [@max-arnold](https://github.com/max-arnold)
* Allow dict to create nested structures [a2670bf4](https://github.com/gohugoio/hugo/commit/a2670bf460e10ed5de69f90abbe7c4e2b32068cf) [@bep](https://github.com/bep) [#6497](https://github.com/gohugoio/hugo/issues/6497)
* Add collections.Reverse [90d0cdf2](https://github.com/gohugoio/hugo/commit/90d0cdf236b54000bfe444ba3a00236faaa28790) [@bep](https://github.com/bep) [#6499](https://github.com/gohugoio/hugo/issues/6499)
* Make index work with slice as the last arg [95ef93be](https://github.com/gohugoio/hugo/commit/95ef93be667afb480184175a319584fd651abf03) [@bep](https://github.com/bep) [#6496](https://github.com/gohugoio/hugo/issues/6496)
* Add some index map test cases [9f46a72c](https://github.com/gohugoio/hugo/commit/9f46a72c7eec25a4b9dea387d5717173b8d9ec72) [@bep](https://github.com/bep) [#3974](https://github.com/gohugoio/hugo/issues/3974)
### Output
* Add some more output if modules download takes time [14a1de14](https://github.com/gohugoio/hugo/commit/14a1de14fb1ec93444ba5dd028fdad8959924545) [@bep](https://github.com/bep) [#6519](https://github.com/gohugoio/hugo/issues/6519)
* Add some more output if loading modules takes time [2dcc1318](https://github.com/gohugoio/hugo/commit/2dcc1318d1d9ed849d040115aa5ba6191a1c102a) [@bep](https://github.com/bep) [#6519](https://github.com/gohugoio/hugo/issues/6519)
### Core
* Disable test assertion on Windows [dd1e5fc0](https://github.com/gohugoio/hugo/commit/dd1e5fc0b43739941372c0c27b75977380acd582) [@bep](https://github.com/bep)
* Adjust .Site.Permalinks deprecation level [03b369e6](https://github.com/gohugoio/hugo/commit/03b369e6726ed8a732c07db48f7209425c434bbe) [@bep](https://github.com/bep)
* Remove .Site.Ref/RelRef [69fd1c60](https://github.com/gohugoio/hugo/commit/69fd1c60d8bcf6d1cea4bfea852f62df8891ee81) [@bep](https://github.com/bep)
* Increase default timeout value to 30s [a8e9f838](https://github.com/gohugoio/hugo/commit/a8e9f8389a61471fa372c815b216511201b56823) [@bep](https://github.com/bep) [#6502](https://github.com/gohugoio/hugo/issues/6502)
* Add a benchmark [0cf85c07](https://github.com/gohugoio/hugo/commit/0cf85c071aba57de8c6567fba166ed8332d01bac) [@bep](https://github.com/bep)
### Other
* Add some internal template image tests [dcde8af8](https://github.com/gohugoio/hugo/commit/dcde8af8c6ab39eb34b5e1d6030d1aa2fe6923ca) [@bep](https://github.com/bep) [#6542](https://github.com/gohugoio/hugo/issues/6542)
* Update Goldmark [b0c7749f](https://github.com/gohugoio/hugo/commit/b0c7749fa1efca04839b767e1d48d617f3556867) [@bep](https://github.com/bep)
* Use HUGO_ENV if set [5c5231e0](https://github.com/gohugoio/hugo/commit/5c5231e09e20953dc262df7d3b351a35f1c4b058) [@bep](https://github.com/bep) [#6456](https://github.com/gohugoio/hugo/issues/6456)
* Make the image cache more robust [d6f7a9e2](https://github.com/gohugoio/hugo/commit/d6f7a9e28dfd5abff08b6aaf6fb3493c46bd1e39) [@bep](https://github.com/bep) [#6501](https://github.com/gohugoio/hugo/issues/6501)
* Update to Go 1.13.4 and Go 1.12.13 [031f948f](https://github.com/gohugoio/hugo/commit/031f948f87ac97ca49d0a487a392a8a0c6afb699) [@bep](https://github.com/bep)
* Restore -v behaviour [71597bd1](https://github.com/gohugoio/hugo/commit/71597bd1adfb016a3ea1977068c37dce92d49458) [@bep](https://github.com/bep)
* Update Goldmark [82219128](https://github.com/gohugoio/hugo/commit/8221912869cf863d64ae7b50e0085589dc18e4d2) [@bep](https://github.com/bep)
* Improve grammar in README.md [e1175ae8](https://github.com/gohugoio/hugo/commit/e1175ae83a365e0b17ec5904194e68ff3833e15a) [@jasdeepgill](https://github.com/jasdeepgill)
* Replace the temp for with a dependency [a2d77f4a](https://github.com/gohugoio/hugo/commit/a2d77f4a803ce27802ea653a4aab53b89c37b488) [@bep](https://github.com/bep)
* Update Chroma [b546417a](https://github.com/gohugoio/hugo/commit/b546417a27f8c59c8c7ccaebfef6bca03f5c4ac4) [@bep](https://github.com/bep)
* Update Goldmark [4175b046](https://github.com/gohugoio/hugo/commit/4175b0468680b076a5e5f90450157a98f841789b) [@bep](https://github.com/bep)
* markup/tableofcontents: GoDoc etc. [55f951cb](https://github.com/gohugoio/hugo/commit/55f951cbba69c29daabca57eeff5661d132fa162) [@bep](https://github.com/bep)
* Minor cleanups [20f351ee](https://github.com/gohugoio/hugo/commit/20f351ee4cd40b3b53e33805fc6226c837290ed7) [@moorereason](https://github.com/moorereason)
* Add Goldmark as the new default markdown handler [bfb9613a](https://github.com/gohugoio/hugo/commit/bfb9613a14ab2d93a4474e5486d22e52a9d5e2b3) [@bep](https://github.com/bep) [#5963](https://github.com/gohugoio/hugo/issues/5963)[#1778](https://github.com/gohugoio/hugo/issues/1778)[#6355](https://github.com/gohugoio/hugo/issues/6355)
* Add parallel task executor helper [628efd6e](https://github.com/gohugoio/hugo/commit/628efd6e293d27984a3f5ba33522f8edd19d69d6) [@bep](https://github.com/bep)
* Update homepage.md [14a985f8](https://github.com/gohugoio/hugo/commit/14a985f8abc527d4e8487fcd5fa742e1ab2a00ed) [@bep](https://github.com/bep)
* Do not check for remote modules if main project is vendored [20ec9fa2](https://github.com/gohugoio/hugo/commit/20ec9fa2bbd69dc47dfc9f1db40c954e08520071) [@bep](https://github.com/bep) [#6506](https://github.com/gohugoio/hugo/issues/6506)
* Add hint when dir not empty [1a36ce9b](https://github.com/gohugoio/hugo/commit/1a36ce9b0903e02a5068aed5f807ed9d21f48ece) [@YaguraStation](https://github.com/YaguraStation) [#4825](https://github.com/gohugoio/hugo/issues/4825)
* Headless bundles should not be listed in .Pages [d1d1f240](https://github.com/gohugoio/hugo/commit/d1d1f240a25945b37eebe8a9a3f439f290832b33) [@bep](https://github.com/bep) [#6492](https://github.com/gohugoio/hugo/issues/6492)
* Support Go time format strings in permalinks [70a1aa34](https://github.com/gohugoio/hugo/commit/70a1aa345b95bcf325f19c6e7184bcd6f885e454) [@look](https://github.com/look)
* Increase timeout to 30000 for mage -v check [cafecca4](https://github.com/gohugoio/hugo/commit/cafecca440e495ec915cc6290fe09d2a343e9c95) [@anthonyfok](https://github.com/anthonyfok)
* Prepare for Goldmark [5f6b6ec6](https://github.com/gohugoio/hugo/commit/5f6b6ec68936ebbbf590894c02a1a3ecad30735f) [@bep](https://github.com/bep) [#5963](https://github.com/gohugoio/hugo/issues/5963)
* Update quicktest [366ee4d8](https://github.com/gohugoio/hugo/commit/366ee4d8da1c2b0c1751e9bf6d54638439735296) [@bep](https://github.com/bep)
* Use pointer receiver for ContentSpec [9abd3967](https://github.com/gohugoio/hugo/commit/9abd396789d007193145db9246d5daf1640bbb8a) [@bep](https://github.com/bep)
* Allow arm64 to fail [ad4c56b5](https://github.com/gohugoio/hugo/commit/ad4c56b5512226e74fb4ed6f10630d26d93e9eb6) [@bep](https://github.com/bep)
* Add a JSON roundtrip test [3717db1f](https://github.com/gohugoio/hugo/commit/3717db1f90797f4e2a5d546472fb6b6df072d435) [@bep](https://github.com/bep) [#6472](https://github.com/gohugoio/hugo/issues/6472)
* Update .travis.yml for arm64 support, etc. [ae4fde08](https://github.com/gohugoio/hugo/commit/ae4fde0866b2a10f0a414e0d76c4ff09bed3776e) [@anthonyfok](https://github.com/anthonyfok)
* Skip Test386 on non-AMD64 architectures [c6d69d0c](https://github.com/gohugoio/hugo/commit/c6d69d0c95c42915956c210dbac8b884682d4a3e) [@anthonyfok](https://github.com/anthonyfok)
* Switch to mage builds, various optimizations [ed268232](https://github.com/gohugoio/hugo/commit/ed2682325aeb8fd1c8139077d14a5f6906757a4e) [@jakejarvis](https://github.com/jakejarvis)
* Add exception for new test image [66fe68ff](https://github.com/gohugoio/hugo/commit/66fe68ffc98974936e157b18cf6bd9266ee081a4) [@anthonyfok](https://github.com/anthonyfok) [#6439](https://github.com/gohugoio/hugo/issues/6439)
* Adjust benchmark templates [c5e1e824](https://github.com/gohugoio/hugo/commit/c5e1e8241a3b9f922f4a5134064ab2847174a959) [@bep](https://github.com/bep)
* Update quicktest [3e8b5a5c](https://github.com/gohugoio/hugo/commit/3e8b5a5c0157fdcf93588a42fbc90b3cd898f6b1) [@bep](https://github.com/bep)
* Do not attempt to build if there is no config file [e6aa6edb](https://github.com/gohugoio/hugo/commit/e6aa6edb4c5f37feb1f2bb8c0f3f80933c7adf5f) [@ollien](https://github.com/ollien) [#5896](https://github.com/gohugoio/hugo/issues/5896)
## Fixes
### Output
* Fix mage check on darwin and add debugging output [8beaa4c2](https://github.com/gohugoio/hugo/commit/8beaa4c25efb593d0363271000a3667b96567976) [@trimbo](https://github.com/trimbo)
### Core
* Fix cascade in server mode [01766439](https://github.com/gohugoio/hugo/commit/01766439246add22a6e6d0c12f932610be55cd8a) [@bep](https://github.com/bep) [#6538](https://github.com/gohugoio/hugo/issues/6538)
* Fix .Sections vs siblings [da535235](https://github.com/gohugoio/hugo/commit/da53523599b43261520a22d77019b390aaa072e7) [@bep](https://github.com/bep) [#6365](https://github.com/gohugoio/hugo/issues/6365)
* Fix recently broken timeout config [e3451371](https://github.com/gohugoio/hugo/commit/e3451371bdb68015f89c8c0f7d8ea0a19fff8df5) [@bep](https://github.com/bep)
* Fix emoji handling inside shortcodes [812688fc](https://github.com/gohugoio/hugo/commit/812688fc2f3e220ac35cad9f0445a2548f0cc603) [@bep](https://github.com/bep) [#6504](https://github.com/gohugoio/hugo/issues/6504)
* Fix ref/relref anhcor handling [c26d00db](https://github.com/gohugoio/hugo/commit/c26d00db648a4b475d94c9ed8e21dafb6efa1776) [@bep](https://github.com/bep) [#6481](https://github.com/gohugoio/hugo/issues/6481)
### Other
* Fix language handling in ExecuteAsTemplate [96f09659](https://github.com/gohugoio/hugo/commit/96f09659ce8752c32a2a6429c9faf23be4faa091) [@bep](https://github.com/bep) [#6331](https://github.com/gohugoio/hugo/issues/6331)
* Fix potential data race [03e2d746](https://github.com/gohugoio/hugo/commit/03e2d7462dec17c2f623a13db709f9efc88182af) [@bep](https://github.com/bep) [#6478](https://github.com/gohugoio/hugo/issues/6478)
* Fix jekyll metadata import on individual posts [8a89b858](https://github.com/gohugoio/hugo/commit/8a89b8582f0f681dc28961adb05ab0bf66da9543) [@trimbo](https://github.com/trimbo) [#5576](https://github.com/gohugoio/hugo/issues/5576)
* Fix Params case handling in the index, sort and where func [a3fe5e5e](https://github.com/gohugoio/hugo/commit/a3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f) [@bep](https://github.com/bep)
* Fix GetPage Params case issue [cd07e6d5](https://github.com/gohugoio/hugo/commit/cd07e6d57b158a76f812e8c4c9567dbc84f57939) [@bep](https://github.com/bep) [#5946](https://github.com/gohugoio/hugo/issues/5946)
* Update to Chroma v0.6.9 for Java lexer fix [8483b53a](https://github.com/gohugoio/hugo/commit/8483b53aefc3c6b52f9917e6e5af9c4d2e98df66) [@anthonyfok](https://github.com/anthonyfok) [#6476](https://github.com/gohugoio/hugo/issues/6476)
* Update past go-cmp's checkptr fix [c3d433af](https://github.com/gohugoio/hugo/commit/c3d433af56071d42aeb3f85854bd30db64ed70b8) [@anthonyfok](https://github.com/anthonyfok)
* Fix crash in multilingual content fs [33c474b9](https://github.com/gohugoio/hugo/commit/33c474b9b3bd470670740f30c5131071ce906b22) [@bep](https://github.com/bep) [#6463](https://github.com/gohugoio/hugo/issues/6463)
* Update to Chroma v0.6.8 to fix a crash [baa97508](https://github.com/gohugoio/hugo/commit/baa975082c6809c8a02a8109ec3062a2b7d48344) [@bep](https://github.com/bep) [#6450](https://github.com/gohugoio/hugo/issues/6450)

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,19 @@
---
date: 2019-11-29
title: "Hugo 0.60.1: A couple of Bug Fixes"
description: "This version fixes a couple of bugs introduced in 0.60.0."
categories: ["Releases"]
---
This is a bug-fix release with a couple of important fixes.
* deps: Update minify [86a5b59f](https://github.com/gohugoio/hugo/commit/86a5b59f64dd6c4d338a9e091e98cd0ad6d4824f) [@MeiK2333](https://github.com/MeiK2333) [#6475](https://github.com/gohugoio/hugo/issues/6475)
* Fix headless regression [bb80fff6](https://github.com/gohugoio/hugo/commit/bb80fff69ad3f2ddff23819bf6eb6f4b8512dc2a) [@bep](https://github.com/bep) [#6552](https://github.com/gohugoio/hugo/issues/6552)
* deps: Update Goldmark [347cfb0c](https://github.com/gohugoio/hugo/commit/347cfb0c17b08626250180e8a84b53fc4800473f) [@bep](https://github.com/bep) [#6549](https://github.com/gohugoio/hugo/issues/6549)[#6551](https://github.com/gohugoio/hugo/issues/6551)
* hugolib: Fix timeout number parsing for YAML/JSON config [b60ae35b](https://github.com/gohugoio/hugo/commit/b60ae35b97c4f44b9b09fcf06c863c695bc3c73a) [@bep](https://github.com/bep) [#6555](https://github.com/gohugoio/hugo/issues/6555)

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -0,0 +1,56 @@
---
date: 2019-12-11
title: "40K GitHub Stars Edition"
description: "40K stars on GitHub is a good enough reason to release a new version of Hugo!"
categories: ["Releases"]
---
This is the [40K GitHub Stars Edition](https://github.com/gohugoio/hugo/stargazers). It's mostly a bug fix release, and an important note is the deprecation of Amber and Ace as template engines. See [#6609](https://github.com/gohugoio/hugo/issues/6609) for more information.
This release represents **10 contributions by 3 contributors** to the main Hugo code base.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **5 contributions by 4 contributors**. A special thanks to [@YuriyOborozhnyi](https://github.com/YuriyOborozhnyi), [@bep](https://github.com/bep), [@Flogex](https://github.com/Flogex), and [@atishay](https://github.com/atishay) for their work on the documentation site.
Hugo now has:
* 40029+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 440+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 279+ [themes](http://themes.gohugo.io/)
## Notes
* Deprecate Ace and Amber [5f8c2818](https://github.com/gohugoio/hugo/commit/5f8c2818f120b881f58f4cec67aed876edb8bcdf) [@bep](https://github.com/bep) [#6609](https://github.com/gohugoio/hugo/issues/6609)
## Enhancements
### Templates
* Allow any key type in partialCached [0efb00c2](https://github.com/gohugoio/hugo/commit/0efb00c2a86ec3f52000a643f26f54bb2a9dfbd6) [@bep](https://github.com/bep) [#6572](https://github.com/gohugoio/hugo/issues/6572)
### Other
* Update Goldmark [3cc217a6](https://github.com/gohugoio/hugo/commit/3cc217a650546b8bc29deabb95e648aacef96fbf) [@bep](https://github.com/bep)
* Add typographic chars from goldmark to toc [c5f2f583](https://github.com/gohugoio/hugo/commit/c5f2f5837fdf6a30c7b28e8368033623b74a30a0) [@tangiel](https://github.com/tangiel) [#6592](https://github.com/gohugoio/hugo/issues/6592)
* Reimplement pygmentsCodefencesGuessSyntax [40a092b0](https://github.com/gohugoio/hugo/commit/40a092b0687d44ecb53ef1fd53001a6299345780) [@bep](https://github.com/bep) [#6565](https://github.com/gohugoio/hugo/issues/6565)
* Update Goldmark [d534ce94](https://github.com/gohugoio/hugo/commit/d534ce9424c952800dfb26c2faff2d47e9597cad) [@bep](https://github.com/bep) [#6557](https://github.com/gohugoio/hugo/issues/6557)
* Update minify [86a5b59f](https://github.com/gohugoio/hugo/commit/86a5b59f64dd6c4d338a9e091e98cd0ad6d4824f) [@MeiK2333](https://github.com/MeiK2333) [#6475](https://github.com/gohugoio/hugo/issues/6475)
* Update Goldmark [347cfb0c](https://github.com/gohugoio/hugo/commit/347cfb0c17b08626250180e8a84b53fc4800473f) [@bep](https://github.com/bep) [#6549](https://github.com/gohugoio/hugo/issues/6549)[#6551](https://github.com/gohugoio/hugo/issues/6551)
## Fixes
### Core
* Fix timeout number parsing for YAML/JSON config [b60ae35b](https://github.com/gohugoio/hugo/commit/b60ae35b97c4f44b9b09fcf06c863c695bc3c73a) [@bep](https://github.com/bep) [#6555](https://github.com/gohugoio/hugo/issues/6555)
### Other
* Fix headless regression [bb80fff6](https://github.com/gohugoio/hugo/commit/bb80fff69ad3f2ddff23819bf6eb6f4b8512dc2a) [@bep](https://github.com/bep) [#6552](https://github.com/gohugoio/hugo/issues/6552)

View File

@ -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

View File

@ -36,10 +36,6 @@ The homepage, similar to other [list pages in Hugo][lists], accepts content and
See the homepage template below or [Content Organization][contentorg] for more information on the role of `_index.md` in adding content and front matter to list pages.
## `.Pages` on the Homepage
In addition to the standard [page variables][pagevars], the homepage template has access to *all* site content via `.Pages`.
## Example Homepage Template
The following is an example of a homepage template that uses [partial][partials], [base][] templates, and a content file at `content/_index.md` to populate the `{{.Title}}` and `{{.Content}}` [page variables][pagevars].

View File

@ -25,8 +25,6 @@ The following is only a primer on Go Templates. For an in-depth look into Go Tem
Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
{{< youtube gnJbPO-GFIw >}}
## Basic Syntax
Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`.

View File

@ -4,7 +4,7 @@ linktitle: Custom Output Formats
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
date: 2017-03-22
publishdate: 2017-03-22
lastmod: 2017-03-22
lastmod: 2019-12-11
categories: [templates]
keywords: ["amp","outputs","rss"]
menu:
@ -31,7 +31,7 @@ This is the full set of built-in media types in Hugo:
**Note:**
* It is possible to add custom media types or change the defaults; e.g., if you want to change the suffix for `text/html` to `asp`.
* The `Suffix` is the value that will be used for URLs and filenames for that media type in Hugo.
* `Suffixes` are the values that will be used for URLs and filenames for that media type in Hugo.
* The `Type` is the identifier that must be used when defining new/custom `Output Formats` (see below).
* The full set of media types will be registered in Hugo's built-in development server to make sure they are recognized by the browser.
@ -40,9 +40,9 @@ To add or modify a media type, define it in a `mediaTypes` section in your [site
{{< code-toggle file="config" >}}
[mediaTypes]
[mediaTypes."text/enriched"]
suffix = "enr"
suffixes = ["enr"]
[mediaTypes."text/html"]
suffix = "asp"
suffixes = ["asp"]
{{</ code-toggle >}}
The above example adds one new media type, `text/enriched`, and changes the suffix for the built-in `text/html` media type.
@ -52,7 +52,7 @@ The above example adds one new media type, `text/enriched`, and changes the suff
```toml
[mediaTypes]
[mediaTypes."text/html"]
suffix = "htm"
suffixes = ["htm"]
# Redefine HTML to update its media type.
[outputFormats]
@ -221,7 +221,7 @@ From content files, you can use the [`ref` or `relref` shortcodes](/content-mana
A new output format needs a corresponding template in order to render anything useful.
{{% note %}}
The key distinction for Hugo versions 0.20 and newer is that Hugo looks at an output format's `Name` and MediaType's `Suffix` when choosing the template used to render a given `Page`.
The key distinction for Hugo versions 0.20 and newer is that Hugo looks at an output format's `Name` and MediaType's `Suffixes` when choosing the template used to render a given `Page`.
{{% /note %}}
The following table shows examples of different output formats, the suffix used, and Hugo's respective template [lookup order][]. All of the examples in the table can:

View File

@ -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.

View File

@ -18,7 +18,7 @@ aliases: []
toc: true
---
A static website with a dynamic search function? Yes. As alternatives to embeddable scripts from Google or other search engines, you can provide your visitors a custom search by indexing your content files directly.
A static website with a dynamic search function? Yes, Hugo provides an alternative to embeddable scripts from Google or other search engines for static websites. Hugo allows you to provide your visitors with a custom search function by indexing your content files directly.
* [GitHub Gist for Hugo Workflow](https://gist.github.com/sebz/efddfc8fdcb6b480f567). This gist contains a simple workflow to create a search index for your static website. It uses a simple Grunt script to index all your content files and [lunr.js](https://lunrjs.com/) to serve the search results.
* [hugo-elasticsearch](https://www.npmjs.com/package/hugo-elasticsearch). Generate [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) indexes for Hugo static sites by parsing front matter. Hugo-Elasticsearch will generate a newline delimited JSON (NDJSON) file that can be bulk uploaded into Elasticsearch using any one of the available [clients](https://www.elastic.co/guide/en/elasticsearch/client/index.html).

View File

@ -1,6 +1,13 @@
{
"chroma": {
"lexers": [
{
"Name": "ABAP",
"Aliases": [
"ABAP",
"abap"
]
},
{
"Name": "ABNF",
"Aliases": [
@ -134,6 +141,13 @@
"winbatch"
]
},
{
"Name": "BibTeX",
"Aliases": [
"bib",
"bibtex"
]
},
{
"Name": "BlitzBasic",
"Aliases": [
@ -405,7 +419,8 @@
"Aliases": [
"forth",
"frt",
"fs"
"fs",
"fth"
]
},
{
@ -579,12 +594,27 @@
"idris"
]
},
{
"Name": "Igor",
"Aliases": [
"igor",
"igorpro",
"ipf"
]
},
{
"Name": "Io",
"Aliases": [
"io"
]
},
{
"Name": "J",
"Aliases": [
"ijs",
"j"
]
},
{
"Name": "JSON",
"Aliases": [
@ -1342,6 +1372,63 @@
}
]
},
"config": {
"markup": {
"defaultMarkdownHandler": "goldmark",
"highlight": {
"style": "monokai",
"codeFences": true,
"noClasses": true,
"lineNos": false,
"lineNumbersInTable": true,
"lineNoStart": 1,
"hl_Lines": "",
"tabWidth": 4
},
"tableOfContents": {
"startLevel": 2,
"endLevel": 3
},
"goldmark": {
"renderer": {
"hardWraps": false,
"xHTML": false,
"unsafe": false
},
"parser": {
"autoHeadingID": true,
"attribute": true
},
"extensions": {
"typographer": true,
"footnote": true,
"definitionList": true,
"table": true,
"strikethrough": true,
"linkify": true,
"taskList": true
}
},
"blackFriday": {
"smartypants": true,
"smartypantsQuotesNBSP": false,
"angledQuotes": false,
"fractions": true,
"hrefTargetBlank": false,
"nofollowLinks": false,
"noreferrerLinks": false,
"smartDashes": true,
"latexDashes": true,
"taskLists": true,
"plainIDAnchors": true,
"extensions": null,
"extensionsMask": null,
"skipHTML": false,
"footnoteAnchorPrefix": "",
"footnoteReturnLinkContents": ""
}
}
},
"media": {
"types": [
{
@ -1513,6 +1600,68 @@
"suffixes": [
"scss"
]
},
{
"type": "video/3gpp",
"string": "video/3gpp",
"mainType": "video",
"subType": "3gpp",
"delimiter": ".",
"suffixes": [
"3gpp",
"3gp"
]
},
{
"type": "video/mp4",
"string": "video/mp4",
"mainType": "video",
"subType": "mp4",
"delimiter": ".",
"suffixes": [
"mp4"
]
},
{
"type": "video/mpeg",
"string": "video/mpeg",
"mainType": "video",
"subType": "mpeg",
"delimiter": ".",
"suffixes": [
"mpg",
"mpeg"
]
},
{
"type": "video/ogg",
"string": "video/ogg",
"mainType": "video",
"subType": "ogg",
"delimiter": ".",
"suffixes": [
"ogv"
]
},
{
"type": "video/webm",
"string": "video/webm",
"mainType": "video",
"subType": "webm",
"delimiter": ".",
"suffixes": [
"webm"
]
},
{
"type": "video/x-msvideo",
"string": "video/x-msvideo",
"mainType": "video",
"subType": "x-msvideo",
"delimiter": ".",
"suffixes": [
"avi"
]
}
]
},
@ -2290,10 +2439,10 @@
]
},
"Eq": {
"Description": "Eq returns the boolean truth of arg1 == arg2.",
"Description": "Eq returns the boolean truth of arg1 == arg2 || arg1 == arg3 || arg1 == arg4.",
"Args": [
"x",
"y"
"first",
"others"
],
"Aliases": [
"eq"
@ -2454,7 +2603,7 @@
]
},
"Dictionary": {
"Description": "Dictionary creates a map[string]interface{} from the given parameters by\nwalking the parameters and treating them as key-value pairs. The number\nof parameters must be even.",
"Description": "Dictionary creates a map[string]interface{} from the given parameters by\nwalking the parameters and treating them as key-value pairs. The number\nof parameters must be even.\nThe keys can be string slices, which will create the needed nested structure.",
"Args": [
"values"
],
@ -2521,7 +2670,7 @@
"Description": "Index returns the result of indexing its first argument by the following\narguments. Thus \"index x 1 2 3\" is, in Go syntax, x[1][2][3]. Each\nindexed item must be a map, slice, or array.\n\nCopied from Go stdlib src/text/template/funcs.go.\n\nWe deviate from the stdlib due to https://github.com/golang/go/issues/14751.\n\nTODO(moorereason): merge upstream changes.",
"Args": [
"item",
"indices"
"args"
],
"Aliases": [
"index"
@ -2630,6 +2779,12 @@
]
]
},
"Reverse": {
"Description": "",
"Args": null,
"Aliases": null,
"Examples": null
},
"Seq": {
"Description": "Seq creates a sequence of integers. It's named and used as GNU's seq.\n\nExamples:\n 3 =\u003e 1, 2, 3\n 1 2 4 =\u003e 1, 3\n -3 =\u003e -1, -2, -3\n 1 4 =\u003e 1, 2, 3, 4\n 1 -2 =\u003e 1, 0, -1, -2",
"Args": [

View File

@ -1,3 +1,10 @@
[[tweet]]
name = "Heinrich Hartmann"
twitter_handle = "@heinrichhartman"
quote = "Working with @GoHugoIO is such a joy. Having worked with #Jekyll in the past, the near instant preview is a big win! Did not expect this to make such a huge difference."
link = "https://twitter.com/heinrichhartman/status/1199736512264462341"
date = 2019-11-12T00:00:00Z
[[tweet]]
name = "Joshua Steven"
twitter_handle = "@jscarto"

View File

@ -0,0 +1,34 @@
{{ $file := .Get "file" }}
{{ $code := "" }}
{{ with .Get "config" }}
{{ $file = $file | default "config" }}
{{ $sections := (split . ".") }}
{{ $configSection := index $.Site.Data.docs.config $sections }}
{{ $code = dict $sections $configSection }}
{{ else }}
{{ $code = $.Inner }}
{{ end }}
{{ $langs := (slice "yaml" "toml" "json") }}
<div class="code relative" {{ with $file }}id="{{ . | urlize}}"{{ end }}>
<div class="code-nav flex flex-nowrap items-stretch">
{{- with $file -}}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">{{ . }}.</div>
{{- end -}}
{{ range $langs }}
<button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">{{ . }}</button>&nbsp;
{{ end }}
</div>
<div class="tab-content">
{{ range $langs }}
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
{{ highlight ($code | transform.Remarshal . | safeHTML) . ""}}
</div>
{{ if ne ($.Get "copy") "false" }}
<button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
</button>
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
{{ end }}
</div>
</div>

View File

@ -0,0 +1,8 @@
{{ $version := .Get 0 }}
{{ if not $version }}
{{ errorf "Missing version in new-in shortcode "}}
{{ end }}
{{ $version = $version | strings.TrimPrefix "v" }}
<button class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 ml2 px-4 border border-gray-400 rounded shadow">
<a href="{{ printf "https://gohugo.io/news/%s-relnotes/" $version }}" target="_blank">New in v{{$version}}</a>
</button>

View File

@ -3,7 +3,7 @@ publish = "public"
command = "hugo --gc --minify"
[context.production.environment]
HUGO_VERSION = "0.59.1"
HUGO_VERSION = "0.61.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.59.1"
HUGO_VERSION = "0.61.0"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.59.1"
HUGO_VERSION = "0.61.0"
[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.59.1"
HUGO_VERSION = "0.61.0"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

View File

@ -1 +0,0 @@
Pygments==2.1.3

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB