Skip to content

Commit 3cecc85

Browse files
committed
feat: configuration file snippet shortcode
1 parent 97db939 commit 3cecc85

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

docs/content/docs/configuration/file.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,47 @@ Config options inside the file are identical to command-line options.
1818
You can configure specific linters' options only within the config file (not the command-line).
1919

2020
There is a [`.golangci.reference.yml`](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml) file with all supported options, their descriptions, and default values.
21-
This file is neither a working example nor a recommended configuration, it's just a reference to display all the configuration options.
21+
This file is neither a working example nor a recommended configuration,
22+
it's just a reference to display all the configuration options used to generate the documentation.
2223

2324
The configuration file can be validated with the JSON Schema: [golangci.jsonschema.json](https://golangci-lint.run/jsonschema/golangci.jsonschema.json)
2425

25-
{ .ConfigurationExample }
26+
{{% configuration-file-snippet section="root" %}}
27+
28+
## `version` configuration
29+
30+
{{% configuration-file-snippet section="version" %}}
31+
32+
## `linters` configuration
33+
34+
{{< cards cols=2 >}}
35+
{{< card link="/docs/linters" title="Linters Overview" icon="collection" >}}
36+
{{< card link="/docs/linters/configuration" title="Linters Settings" icon="adjustments" >}}
37+
{{< /cards >}}
38+
39+
{{% configuration-file-snippet section="linters" %}}
40+
41+
## `formatters` configuration
42+
43+
{{< cards cols=2 >}}
44+
{{< card link="/docs/formatters" title="Formatters Overview" icon="collection" >}}
45+
{{< card link="/docs/formatters/configuration" title="Formatters Settings" icon="adjustments" >}}
46+
{{< /cards >}}
47+
48+
{{% configuration-file-snippet section="formatters" %}}
49+
50+
## `issues` configuration
51+
52+
{{% configuration-file-snippet section="issues" %}}
53+
54+
## `output` configuration
55+
56+
{{% configuration-file-snippet section="output" %}}
57+
58+
## `run` configuration
59+
60+
{{% configuration-file-snippet section="run" %}}
61+
62+
## `severity` configuration
63+
64+
{{% configuration-file-snippet section="severity" %}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- /*
2+
Creates a code block with the contents of a configuration file section.
3+
4+
@param {string} section The name of the section inside the data file.
5+
@returns {string}
6+
7+
@example {{% configuration-file-snippet section="sectionName" %}}
8+
*/ -}}
9+
10+
{{- $sectionName := .Get "section" -}}
11+
12+
{{- $file := index $.Site.Data.configuration_file -}}
13+
14+
```yaml
15+
{{ index $file $sectionName | safeHTML }}
16+
```

0 commit comments

Comments
 (0)