mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-14 03:14:40 -04:00
Update Chroma highlighting docs
To the upcoming Hugo v0.30.
This commit is contained in:
parent
6adead19d6
commit
ce10cc02e3
@ -22,21 +22,21 @@ If you want to continue to use Pygments (see below), set `pygmentsUseClassic=tru
|
||||
|
||||
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)).
|
||||
|
||||
* `linenos=inline` turns on line numbers. Note that the `inline` value only has an effect in Pygments.
|
||||
* `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.
|
||||
* `linenostart=199` starts the line number count from 199.
|
||||
|
||||
With that, this:
|
||||
|
||||
```
|
||||
{{</* highlight go "linenos=inline,hl_lines=8 15-17,linenostart=199" */>}}
|
||||
{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
|
||||
// ... code
|
||||
{{</* / highlight */>}}
|
||||
```
|
||||
|
||||
Gives this:
|
||||
|
||||
{{< highlight go "linenos=inline,hl_lines=8 15-17,linenostart=199" >}}
|
||||
{{< 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.
|
||||
//
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Background */ .chroma { background-color: #f0f0f0 }
|
||||
/* Error */ .chroma .err { }
|
||||
/* LineTableTD */ .chroma .lntd { ; vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||
/* LineTable */ .chroma .lntable { ; border-spacing: 0; padding: 0; margin: 0; border: 0; width: 100%; overflow: auto; display: block; }
|
||||
/* LineHighlight */ .chroma .hl { background-color: #ffffcc; display: block; width: 100% }
|
||||
/* LineNumbersTable */ .chroma .lnt { ; margin-right: 0.4em; padding: 0 0.4em 0 0.4em; display: block; }
|
||||
/* LineNumbers */ .chroma .ln { ; margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
|
||||
/* Keyword */ .chroma .k { color: #007020; font-weight: bold }
|
||||
/* KeywordConstant */ .chroma .kc { color: #007020; font-weight: bold }
|
||||
|
@ -1,3 +1,14 @@
|
||||
.chroma .lntable pre {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.chroma .lntable pre code {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
pre, .pre {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
|
11696
themes/gohugoioTheme/static/dist/app.bundle.js
vendored
11696
themes/gohugoioTheme/static/dist/app.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
themes/gohugoioTheme/static/dist/main.css
vendored
2
themes/gohugoioTheme/static/dist/main.css
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user