Skip to content

Commit

Permalink
Fenced code blocks should have a language specified (gohugoio#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
coliff authored Oct 31, 2022
1 parent 2439331 commit 68f05fd
Show file tree
Hide file tree
Showing 43 changed files with 168 additions and 177 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"govendor",
"Gowans",
"Grayscale",
"Gregor",
"Gruber",
"gtag",
"gvfs",
Expand Down
1 change: 0 additions & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ MD034: false
MD036: false
MD037: false
MD038: false
MD040: false
MD041: false
MD046: false
MD049: false
Expand Down
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/commands/**
**/functions/**
**/news/**
**/showcase/**
**/zh/**
Expand Down
3 changes: 1 addition & 2 deletions content/en/about/security-model/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ menu:
weight: 4
weight: 5
sections_weight: 5
draft: false
aliases: [/security/]
toc: true
---
Expand Down Expand Up @@ -40,7 +39,7 @@ The default configuration is listed below. Any build using features not in the a

Note that these and other config settings in Hugo can be overridden by the OS environment. If you want to block all remote HTTP fetching of data:

```
```txt
HUGO_SECURITY_HTTP_URLS=none hugo
```

Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For many websites, this is enough configuration. However, you also have the opti

Disqus has its own [internal template](https://gohugo.io/templates/internal/#disqus) available, to render it add the following code where you want comments to appear:

```
```go-html-template
{{ template "_internal/disqus.html" . }}
```

Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ toc: true

Hugo! supports [GoAT](https://github.com/bep/goat) natively. This means that this code block:

````
````txt
```goat
. . . .--- 1 .-- 1 / 1
/ \ | | .---+ .-+ +
Expand Down
4 changes: 2 additions & 2 deletions content/en/content-management/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Notice that for security concerns only extensions that do not have path separato

Example of how to set extensions and attributes:

```
```yml
[markup.asciidocExt]
extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
workingFolderCurrent = true
Expand All @@ -112,7 +112,7 @@ Example of how to set extensions and attributes:
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
parameters. Run Hugo with `-v`. You will get an output like

```
```txt
INFO 2019/12/22 09:08:48 Rendering book-as-pdf.adoc with C:\Ruby26-x64\bin\asciidoctor.bat using asciidoc args [--no-header-footer -r asciidoctor-html5s -b html5s -r asciidoctor-diagram --base-dir D:\prototypes\hugo_asciidoc_ddd\docs -a outdir=D:\prototypes\hugo_asciidoc_ddd\build -] ...
```

Expand Down
17 changes: 7 additions & 10 deletions content/en/content-management/organization/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ linktitle: Organization
description: Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [content management,fundamentals]
keywords: [sections,content,organization,bundle,resources]
menu:
docs:
parent: "content-management"
weight: 10
weight: 10 #rem
draft: false
aliases: [/content/sections/]
toc: true
---
Expand All @@ -35,14 +33,13 @@ The bundle documentation is a **work in progress**. We will publish more compreh

## Organization of Content Source


In Hugo, your content should be organized in a manner that reflects the rendered website.

While Hugo supports content nested at any level, the top levels (i.e. `content/<DIRECTORIES>`) are special in Hugo and are considered the content type used to determine layouts etc. To read more about sections, including how to nest them, see [sections][].

Without any additional configuration, the following will automatically work:

```
```txt
.
└── content
└── about
Expand Down Expand Up @@ -73,7 +70,7 @@ The following demonstrates the relationships between your content organization a
You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:


```
```txt
. url
. ⊢--^-⊣
. path slug
Expand All @@ -85,7 +82,7 @@ content/posts/_index.md

At build, this will output to the following destination with the associated values:

```
```txt
url ("/posts/")
⊢-^-⊣
Expand All @@ -104,7 +101,7 @@ The [sections] can be nested as deeply as you want. The important thing to under
Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:


```
```txt
path ("posts/my-first-hugo-post.md")
. ⊢-----------^------------⊣
. section slug
Expand All @@ -114,7 +111,7 @@ content/posts/my-first-hugo-post.md

When Hugo builds your site, the content will be output to the following destination:

```
```txt
url ("/posts/my-first-hugo-post/")
⊢------------^----------⊣
Expand Down Expand Up @@ -180,7 +177,7 @@ slug: "new-post"

This will render to the following destination according to Hugo's default behavior:

```
```txt
example.com/posts/new-post/
```

Expand Down Expand Up @@ -217,7 +214,7 @@ url: /blog/new-url/

Assuming your `baseURL` is [configured][config] to `https://example.com`, the addition of `url` to the front matter will make `old-url.md` render to the following destination:

```
```txt
https://example.com/blog/new-url/
```

Expand Down
4 changes: 2 additions & 2 deletions content/en/content-management/page-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ MediaType.Suffixes
ByType
: Returns the page resources of the given type.

```go
```go-html-template
{{ .Resources.ByType "image" }}
```
Match
: Returns all the page resources (as a slice) whose `Name` matches the given Glob pattern ([examples](https://github.com/gobwas/glob/blob/master/readme.md)). The matching is case-insensitive.

```go
```go-html-template
{{ .Resources.Match "images/*" }}
```

Expand Down
6 changes: 3 additions & 3 deletions content/en/content-management/related.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ Here is the list of "Related" methods available on a page collection such `.Regu

Returns a collection of pages related the given one.

```
```go-html-template
{{ $related := site.RegularPages.Related . }}
```

#### .RelatedIndices PAGE INDICE1 [INDICE2 ...]

Returns a collection of pages related to a given one restricted to a list of indices.

```
```go-html-template
{{ $related := site.RegularPages.RelatedIndices . "tags" "date" }}
```

Expand All @@ -58,7 +58,7 @@ Returns a collection of pages related together by a set of indices and their mat

In order to build those set and pass them as argument, one must use the `keyVals` function where the first argument would be the `indice` and the consecutive ones its potential `matches`.

```
```go-html-template
{{ $related := site.RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
```

Expand Down
28 changes: 14 additions & 14 deletions content/en/content-management/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ Some shortcodes use or require closing shortcodes. Again like HTML, the opening

Here are two examples of paired shortcodes:

```
```go-html-template
{{%/* mdshortcode */%}}Stuff to `process` in the *center*.{{%/* /mdshortcode */%}}
```

```
```go-html-template
{{</* highlight go */>}} A bunch of code here {{</* /highlight */>}}
```

Expand All @@ -56,7 +56,7 @@ The examples above use two different delimiters, the difference being the `%` ch

You can pass multiple lines as parameters to a shortcode by using raw string literals:

```
```go-html-template
{{</* myshortcode `This is some <b>HTML</b>,
and a new line with a "quoted string".` */>}}
```
Expand All @@ -67,15 +67,15 @@ In Hugo `0.55` we changed how the `%` delimiter works. Shortcodes using the `%`

If you want the old behavior, you can put the following line in the start of your shortcode template:

```
```go-html-template
{{ $_hugo_config := `{ "version": 1 }` }}
```

### Shortcodes Without Markdown

The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without Markdown include internal HTML:

```
```go-html-template
{{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}}
```

Expand Down Expand Up @@ -150,13 +150,13 @@ attrlink

Bloggers often want to include GitHub gists when writing posts. Let's suppose we want to use the [gist at the following url][examplegist]:

```
```txt
https://gist.github.com/spf13/7896402
```

We can embed the gist in our content via username and gist ID pulled from the URL:

```
```go-html-template
{{</* gist spf13 7896402 */>}}
```

Expand Down Expand Up @@ -222,7 +222,7 @@ To see even more options for adding syntax-highlighted code blocks to your websi

If you'd like to embed a photo from [Instagram][], you only need the photo's ID. You can discern an Instagram photo ID from the URL:

```
```txt
https://www.instagram.com/p/BWNjjyYFxVx/
```

Expand Down Expand Up @@ -289,7 +289,7 @@ Read a more extensive description of `ref` and `relref` in the [cross references

#### Example `ref` and `relref` Input

```
```go-html-template
[Neat]({{</* ref "blog/neat.md" */>}})
[Who]({{</* relref "about.md#who" */>}})
```
Expand All @@ -298,7 +298,7 @@ Read a more extensive description of `ref` and `relref` in the [cross references

Assuming that standard Hugo pretty URLs are turned on.

```
```html
<a href="https://example.com/blog/neat">Neat</a>
<a href="/about/#who">Who</a>
```
Expand All @@ -307,7 +307,7 @@ Assuming that standard Hugo pretty URLs are turned on.

You want to include a single tweet into your blog post? Everything you need is the URL of the tweet:

```
```txt
https://twitter.com/SanDiegoZoo/status/1453110110599868418
```

Expand Down Expand Up @@ -337,7 +337,7 @@ Using the preceding `tweet` example, the following simulates the displayed exper

Adding a video from [Vimeo][] is equivalent to the [YouTube Input shortcode][].

```
```txt
https://vimeo.com/channels/staffpicks/146022717
```

Expand All @@ -360,7 +360,7 @@ Using the preceding `vimeo` example, the following HTML will be added to your re
{{% tip %}}
If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `<div>` that wraps the `<iframe>` *and* will remove the inline styles. Note that you will need to call the `id` as a named parameter as well. You can also give the vimeo video a descriptive title with `title`.

```
```go
{{</* vimeo id="146022717" class="my-vimeo-wrapper-class" title="My vimeo video" */>}}
```
{{% /tip %}}
Expand All @@ -375,7 +375,7 @@ Using the preceding `vimeo` example, the following simulates the displayed exper

The `youtube` shortcode embeds a responsive video player for [YouTube videos][]. Only the ID of the video is required, e.g.:

```
```txt
https://www.youtube.com/watch?v=w7Ft2ymGmfc
```

Expand Down
4 changes: 2 additions & 2 deletions content/en/content-management/syntax-highlighting.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Options:

### Example: Highlight Shortcode

```
```go-html-template
{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
// ... code
{{</* / highlight */>}}
Expand Down Expand Up @@ -102,7 +102,7 @@ See [Highlight](/functions/highlight/).
Highlighting in code fences is enabled by default.{{< new-in "0.60.0" >}}
````
````txt
```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
// ... code
```
Expand Down
4 changes: 2 additions & 2 deletions content/en/content-management/taxonomies.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Then, in each of the movies, you would specify terms for each of these taxonomie

To continue with the example of a movie site, the following demonstrates content relationships from the perspective of the taxonomy:

```
```txt
Actor <- Taxonomy
Bruce Willis <- Term
The Sixth Sense <- Value
Expand All @@ -63,7 +63,7 @@ Actor <- Taxonomy

From the perspective of the content, the relationships would appear differently, although the data and labels used are the same:

```
```txt
Unbreakable <- Value
Actors <- Taxonomy
Bruce Willis <- Term
Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a swi

Create your Markdown the way you normally would with the appropriate headings. Here is some example content:

```
```md
<!-- Your front matter up here -->

## Introduction
Expand Down
Loading

0 comments on commit 68f05fd

Please sign in to comment.