From: Bjørn Erik Pedersen Date: Tue, 28 Jun 2022 18:51:33 +0000 (+0200) Subject: Merge commit 'bdf935d66c1f02dfc942a30e9fc00519bba3aacb' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=65e52a7f5c79e6cfeabafa67d1bff4994c7fc4a4;p=brevno-suite%2Fhugo Merge commit 'bdf935d66c1f02dfc942a30e9fc00519bba3aacb' --- 65e52a7f5c79e6cfeabafa67d1bff4994c7fc4a4 diff --cc docs/.github/workflows/spellcheck.yml index 0129bbb27,000000000..6f68fee18 mode 100644,000000..100644 --- a/docs/.github/workflows/spellcheck.yml +++ b/docs/.github/workflows/spellcheck.yml @@@ -1,17 -1,0 +1,20 @@@ +name: 'Check spelling' +on: # rebuild any PRs and main branch changes + push: + branches-ignore: + - "dependabot/**" + pull_request: + ++permissions: ++ contents: read ++ +jobs: + spellcheck: + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - uses: streetsidesoftware/cspell-action@3bc52c39528d0214a947ff7f8b5c23ad3273435b ++ - uses: actions/checkout@v3 ++ - uses: streetsidesoftware/cspell-action@v2 + with: + inline: warning + strict: false + incremental_files_only: true diff --cc docs/content/en/about/what-is-hugo.md index b84f61f10,000000000..69ca1fddb mode 100644,000000..100644 --- a/docs/content/en/about/what-is-hugo.md +++ b/docs/content/en/about/what-is-hugo.md @@@ -1,63 -1,0 +1,62 @@@ +--- +title: What is Hugo +linktitle: What is Hugo +description: Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +layout: single +menu: + docs: + parent: "about" + weight: 10 +weight: 10 +sections_weight: 10 +draft: false +aliases: [/overview/introduction/,/about/why-i-built-hugo/] +toc: true +--- + +Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors. + - Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP. ++Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP. + +We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made. + +## How Fast is Hugo? + +{{< youtube "CdiDYZ51a2o" >}} + +## What Does Hugo Do? + +In technical terms, Hugo takes a source directory of files and templates and uses these as input to create a complete website. + +## Who Should Use Hugo? + +Hugo is for people that prefer writing in a text editor over a browser. + +Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases. + +Hugo is for people building a blog, a company site, a portfolio site, documentation, a single landing page, or a website with thousands of pages. + +[@spf13]: https://twitter.com/spf13 - [Aerobatic]: https://www.aerobatic.com/ +[Amazon S3]: https://aws.amazon.com/s3/ +[Azure]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website +[CloudFront]: https://aws.amazon.com/cloudfront/ "Amazon CloudFront" +[DreamHost]: https://www.dreamhost.com/ +[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting" +[GitHub Pages]: https://pages.github.com/ +[GitLab Pages]: https://about.gitlab.com/features/pages/ +[Go language]: https://golang.org/ +[GoDaddy]: https://www.godaddy.com/ "GoDaddy.com Hosting" +[Google Cloud Storage]: https://cloud.google.com/storage/ +[Heroku]: https://www.heroku.com/ +[Jekyll]: https://jekyllrb.com/ +[Middleman]: https://middlemanapp.com/ +[Nanoc]: https://nanoc.ws/ +[Netlify]: https://netlify.com +[Rackspace]: https://www.rackspace.com/cloud/files +[Surge]: https://surge.sh +[contributing to it]: https://github.com/gohugoio/hugo +[rackspace]: https://www.rackspace.com/openstack/public/files +[static site generator]: /about/benefits/ diff --cc docs/content/en/content-management/syntax-highlighting.md index 31f12f7d3,000000000..8ff270c54 mode 100644,000000..100644 --- a/docs/content/en/content-management/syntax-highlighting.md +++ b/docs/content/en/content-management/syntax-highlighting.md @@@ -1,138 -1,0 +1,139 @@@ +--- +title: Syntax Highlighting +description: Hugo comes with really fast syntax highlighting from Chroma. +date: 2017-02-01 +publishdate: 2017-02-01 +keywords: [highlighting,chroma,code blocks,syntax] +categories: [content management] +menu: + docs: + parent: "content-management" + weight: 300 +weight: 20 +sections_weight: 20 +draft: false +aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/] +toc: true +--- + +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. + +## Configure Syntax Highlighter + +See [Configure Highlight](/getting-started/configuration-markup#highlight). + +## Generate Syntax Highlighter CSS + +If you run with `markup.highlight.noClasses=false` 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 [`highlight` shortcode](https://gohugo.io/content-management/shortcodes/#highlight). It 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`: configure line numbers. Valid values are `true`, `false`, `table`, or `inline`. `false` will turn off line numbers if it's configured to be on in site config. {{< new-in "0.60.0" >}} `table` will give copy-and-paste friendly code blocks. +* `hl_lines`: lists a set of line numbers or line number ranges to be highlighted. +* `linenostart=199`: starts the line number count from 199. +* `anchorlinenos`: Configure anchors on line numbers. Valid values are `true` or `false`; +* `lineanchors`: Configure a prefix for the anchors on line numbers. Will be suffixed with `-`, so linking to the line number 1 with the option `lineanchors=prefix` adds the anchor `prefix-1` to the page. ++* `hl_inline` Highlight inside a `` (inline HTML element) tag. Valid values are `true` or `false`. The `code` tag will get a class with name `code-inline`. {{< new-in "0.101.0" >}} + +### Example: Highlight Shortcode + +``` +{{}} +// ... code +{{}} +``` + +Gives this: + +{{< highlight 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) + } +} +{{< / highlight >}} + +## Highlight Template Func + +See [Highlight](/functions/highlight/). + +## Highlighting in Code Fences + +Highlighting in code fences is enabled by default.{{< new-in "0.60.0" >}} + +```` +```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 >}} + +[Prism]: https://prismjs.com +[prismdownload]: https://prismjs.com/download.html +[Highlight.js]: https://highlightjs.org/ +[Rainbow]: https://craig.is/making/rainbows +[Syntax Highlighter]: https://alexgorbatchev.com/SyntaxHighlighter/ +[Google Prettify]: https://github.com/google/code-prettify +[Yandex]: https://yandex.ru/ diff --cc docs/content/en/documentation.md index 8364a42bb,000000000..77cf283fa mode 100644,000000..100644 --- a/docs/content/en/documentation.md +++ b/docs/content/en/documentation.md @@@ -1,22 -1,0 +1,21 @@@ +--- +title: Hugo Documentation +linktitle: Hugo +description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends. +date: 2017-02-01 +publishdate: 2017-02-01 +menu: + main: + parent: "section name" + weight: 01 +weight: 01 #rem +draft: false +slug: +aliases: [] +toc: false +layout: documentation-home +--- + +Hugo is the **world's fastest static website engine.** It's written in Go (aka Golang) and developed by [bep](https://github.com/bep), [spf13](https://github.com/spf13) and [friends](https://github.com/gohugoio/hugo/graphs/contributors). + +Below you will find some of the most common and helpful pages from our documentation. - foo diff --cc docs/content/en/functions/highlight.md index 1643fe075,000000000..40f3a78de mode 100644,000000..100644 --- a/docs/content/en/functions/highlight.md +++ b/docs/content/en/functions/highlight.md @@@ -1,104 -1,0 +1,108 @@@ +--- +title: highlight +linktitle: highlight +description: Renders code with a syntax highlighter. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2021-12-06 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [highlighting,code blocks,syntax] +signature: ["transform.Highlight INPUT LANG [OPTIONS]","highlight INPUT LANG [OPTIONS]"] +relatedfuncs: [] +deprecated: false +toc: true +--- +The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 available styles. + +## Parameters + +INPUT +: The code to highlight. + +LANG +: The language of the code to highlight. Choose from one of the [supported languages]. Case-insensitive. + +OPTIONS +: An optional, comma-separated list of zero or more [options]. Set default values in [site configuration]. + +## Options + +lineNos +: Boolean. Default is `false`.\ +Display a number at the beginning of each line. + +lineNumbersInTable +: Boolean. Default is `true`.\ +Render the highlighted code in an HTML table with two cells. The left table cell contains the line numbers. The right table cell contains the code, allowing a user to select and copy the code without line numbers. Irrelevant if `lineNos` is false. + +anchorLineNos +: Boolean. Default is `false`.\ +Render each line number as an HTML anchor element, and set the `id` attribute of the surrounding `` to the line number. Irrelevant if `lineNos` is false. + +lineAnchors +: String. Default is `""`.\ +When rendering a line number as an HTML anchor element, prepend this value to the `id` attribute of the surrounding ``. This provides unique `id` attributes when a page contains two or more code blocks. Irrelevant if `lineNos` or `anchorLineNos` is false. + +lineNoStart +: Integer. Default is `1`.\ +The number to display at the beginning of the first line. Irrelevant if `lineNos` is false. + +hl_Lines +: String. Default is `""`.\ +A space-separated list of lines to emphasize within the highlighted code. To emphasize lines 2, 3, 4, and 7, set this value to `2-4 7`. This option is independent of the `lineNoStart` option. + ++hl_inline ++: Boolean. Default is `false`.\ ++Render the highlighted code without a wrapping container. ++ +style +: String. Default is `monokai`.\ +The CSS styles to apply to the highlighted code. See the [style gallery] for examples. Case-sensitive. + +noClasses +: Boolean. Default is `true`.\ +Use inline CSS styles instead of an external CSS file. To use an external CSS file, set this value to `false` and [generate the file with the hugo client][hugo client]. + +tabWidth +: Integer. Default is `4`.\ +Substitute this number of spaces for each tab character in your highlighted code. + +guessSyntax +: Boolean. Default is `false`.\ +If the `LANG` parameter is blank or an unrecognized language, auto-detect the language if possible, otherwise use a fallback language. + +{{% note %}} +Instead of specifying both `lineNos` and `lineNumbersInTable`, you can use the following shorthand notation: + +`lineNos=inline` +: equivalent to `lineNos=true` and `lineNumbersInTable=false` + +`lineNos=table` +: equivalent to `lineNos=true` and `lineNumbersInTable=true` +{{% /note %}} + +## Examples + +```go-html-template +{{ $input := `fmt.Println("Hello World!")` }} +{{ transform.Highlight $input "go" }} + +{{ $input := `console.log('Hello World!');` }} +{{ $lang := "js" }} +{{ transform.Highlight $input $lang "lineNos=table, style=api" }} + +{{ $input := `echo "Hello World!"` }} +{{ $lang := "bash" }} +{{ $options := slice "lineNos=table" "style=dracula" }} +{{ transform.Highlight $input $lang (delimit $options ",") }} +``` + +[Chroma]: https://github.com/alecthomas/chroma +[hugo client]: {{< relref "commands/hugo_gen_chromastyles" >}} +[options]: {{< relref "#options" >}} +[site configuration]: {{< relref "getting-started/configuration-markup#highlight">}} +[style gallery]: https://xyproto.github.io/splash/docs/ +[supported languages]: {{< relref "content-management/syntax-highlighting#list-of-chroma-highlighting-languages" >}} diff --cc docs/content/en/templates/404.md index c638d89fa,000000000..87bbe1d36 mode 100644,000000..100644 --- a/docs/content/en/templates/404.md +++ b/docs/content/en/templates/404.md @@@ -1,65 -1,0 +1,65 @@@ +--- +title: Custom 404 Page +linktitle: 404 Page +description: If you know how to create a single page template, you have unlimited options for creating a custom 404. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-31 +categories: [templates] +keywords: [404, page not found] +menu: + docs: + parent: "templates" + weight: 120 +weight: 120 #rem +draft: false +aliases: [] +toc: false +--- + - When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://help.github.com/articles/custom-404-pages/) by creating a 404.html template file in your `/layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root. ++When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in your `/layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root. + +404 pages will have all the regular [page variables][pagevars] available to use in the templates. + +In addition to the standard page variables, the 404 page has access to all site content accessible from `.Pages`. + +``` +▾ layouts/ + 404.html +``` + +## 404.html + +This is a basic example of a 404.html template: + +{{< code file="layouts/404.html" download="404.html" >}} +{{ define "main"}} +
+
+

Go Home

+
+
+{{ end }} +{{< /code >}} + +## Automatic Loading + +Your 404.html file can be set to load automatically when a visitor enters a mistaken URL path, dependent upon the web serving environment you are using. For example: + +* [GitHub Pages](/hosting-and-deployment/hosting-on-github/) and [GitLab Pages](/hosting-and-deployment/hosting-on-gitlab/). The 404 page is automatic. +* Apache. You can specify `ErrorDocument 404 /404.html` in an `.htaccess` file in the root of your site. +* Nginx. You might specify `error_page 404 /404.html;` in your `nginx.conf` file. [Details here](https://nginx.org/en/docs/http/ngx_http_core_module.html#error_page). +* Amazon AWS S3. When setting a bucket up for static web serving, you can specify the error file from within the S3 GUI. +* Amazon CloudFront. You can specify the page in the Error Pages section in the CloudFront Console. [Details here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html) +* Caddy Server. Use the `handle_errors` directive to specify error pages for one or more status codes. [Details here](https://caddyserver.com/docs/caddyfile/directives/handle_errors) +* Netlify. Add `/* /404.html 404` to `content/_redirects`. [Details Here](https://www.netlify.com/docs/redirects/#custom-404) +* Azure Static website. You can specify the `Error document path` in the Static website configuration page of the Azure portal. [More details are available in the Static website documentation](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website). +* DigitalOcean App Platform. You can specify `error_document` in your app specification file or use control panel to set up error document. [Details here](https://docs.digitalocean.com/products/app-platform/references/app-specification-reference/). + +{{% note %}} +`hugo server` will not automatically load your custom `404.html` file, but you +can test the appearance of your custom "not found" page by navigating your +browser to `/404.html`. +{{% /note %}} + +[pagevars]: /variables/page/ diff --cc docs/layouts/shortcodes/chroma-lexers.html index 0df2b868f,000000000..2e10c3dee mode 100644,000000..100644 --- a/docs/layouts/shortcodes/chroma-lexers.html +++ b/docs/layouts/shortcodes/chroma-lexers.html @@@ -1,6 -1,0 +1,6 @@@ +
- {{ range .Site.Data.docs.chroma.lexers }} -
{{ .Name }}
-
{{ delimit .Aliases ", " }}
- {{ end }} -
++ {{ range .Site.Data.docs.chroma.lexers }} ++
{{ .Name }}
++
{{ with .Aliases }}{{ delimit . ", " }}{{ end }}
++ {{ end }} ++ diff --cc docs/netlify.toml index 38a178d4c,000000000..ade4b9a86 mode 100644,000000..100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@@ -1,35 -1,0 +1,35 @@@ +[build] +publish = "public" +command = "hugo --gc --minify" + +[context.production.environment] - HUGO_VERSION = "0.100.2" ++HUGO_VERSION = "0.101.0" +HUGO_ENV = "production" +HUGO_ENABLEGITINFO = "true" + +[context.split1] +command = "hugo --gc --minify --enableGitInfo" + +[context.split1.environment] - HUGO_VERSION = "0.100.2" ++HUGO_VERSION = "0.101.0" +HUGO_ENV = "production" + +[context.deploy-preview] +command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL" + +[context.deploy-preview.environment] - HUGO_VERSION = "0.100.2" ++HUGO_VERSION = "0.101.0" + +[context.branch-deploy] +command = "hugo --gc --minify -b $DEPLOY_PRIME_URL" + +[context.branch-deploy.environment] - HUGO_VERSION = "0.100.2" ++HUGO_VERSION = "0.101.0" + +[context.next.environment] +HUGO_ENABLEGITINFO = "true" + +[[redirects]] +from = "/npmjs/*" +to = "/npmjs/" +status = 200