diff --git a/.gitignore b/.gitignore index 666ac34..d15f938 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bin +coverage.out coverage.txt diff --git a/Makefile b/Makefile index cacaa8a..b814549 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ BUILD_DIR := bin COMMIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null) BUILD_DATE ?= $(shell date +%FT%T%z) VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || git describe --tags 2>/dev/null || echo "v0.0.0-$(COMMIT_HASH)") -COVERAGE_OUT := coverage.txt +COVERAGE_OUT := coverage.out # Go variables GOCMD := GO111MODULE=on go diff --git a/examples/doc.adoc b/examples/doc.adoc new file mode 100644 index 0000000..ffe215c --- /dev/null +++ b/examples/doc.adoc @@ -0,0 +1,8 @@ += This header comes from a custom AsciiDoc file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. diff --git a/examples/doc.md b/examples/doc.md new file mode 100644 index 0000000..79b0ef9 --- /dev/null +++ b/examples/doc.md @@ -0,0 +1,8 @@ +# This header comes from a custom Markdown file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. diff --git a/examples/doc.txt b/examples/doc.txt new file mode 100644 index 0000000..6ccbbd6 --- /dev/null +++ b/examples/doc.txt @@ -0,0 +1,8 @@ +# This header comes from a custom Text file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. diff --git a/internal/format/asciidoc_document_test.go b/internal/format/asciidoc_document_test.go index a2428f2..9628ca2 100644 --- a/internal/format/asciidoc_document_test.go +++ b/internal/format/asciidoc_document_test.go @@ -454,25 +454,55 @@ func TestAsciidocDocumentOutputValues(t *testing.T) { } func TestAsciidocDocumentHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "document-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "document-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "document-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "document-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().Build() - expected, err := testutil.GetExpected("asciidoc", "document-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("asciidoc", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewAsciidocDocument(settings) - actual, err := printer.Print(module, settings) + printer := NewAsciidocDocument(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestAsciidocDocumentOutputValuesNoSensitivity(t *testing.T) { diff --git a/internal/format/asciidoc_table_test.go b/internal/format/asciidoc_table_test.go index ebb8e0d..8a900ca 100644 --- a/internal/format/asciidoc_table_test.go +++ b/internal/format/asciidoc_table_test.go @@ -454,25 +454,55 @@ func TestAsciidocTableOutputValues(t *testing.T) { } func TestAsciidocTableHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "table-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "table-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "table-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "table-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().Build() - expected, err := testutil.GetExpected("asciidoc", "table-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("asciidoc", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewAsciidocTable(settings) - actual, err := printer.Print(module, settings) + printer := NewAsciidocTable(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestAsciidocTableOutputValuesNoSensitivity(t *testing.T) { diff --git a/internal/format/json_test.go b/internal/format/json_test.go index 0a1bf36..791b4ba 100644 --- a/internal/format/json_test.go +++ b/internal/format/json_test.go @@ -393,25 +393,55 @@ func TestJsonOutputValues(t *testing.T) { } func TestJsonHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "json-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "json-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "json-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "json-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().Build() - expected, err := testutil.GetExpected("json", "json-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("json", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewJSON(settings) - actual, err := printer.Print(module, settings) + printer := NewJSON(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestJsonEmpty(t *testing.T) { diff --git a/internal/format/markdown_document_test.go b/internal/format/markdown_document_test.go index 9dd024a..aefad26 100644 --- a/internal/format/markdown_document_test.go +++ b/internal/format/markdown_document_test.go @@ -474,25 +474,55 @@ func TestDocumentOutputValues(t *testing.T) { } func TestDocumentHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "document-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "document-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "document-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "document-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().Build() - expected, err := testutil.GetExpected("markdown", "document-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("markdown", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewDocument(settings) - actual, err := printer.Print(module, settings) + printer := NewDocument(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestDocumentOutputValuesNoSensitivity(t *testing.T) { diff --git a/internal/format/markdown_table_test.go b/internal/format/markdown_table_test.go index 61b2120..40ce184 100644 --- a/internal/format/markdown_table_test.go +++ b/internal/format/markdown_table_test.go @@ -474,25 +474,55 @@ func TestTableOutputValues(t *testing.T) { } func TestTableHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "table-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "table-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "table-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "table-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().Build() - expected, err := testutil.GetExpected("markdown", "table-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("markdown", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewTable(settings) - actual, err := printer.Print(module, settings) + printer := NewTable(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestTableOutputValuesNoSensitivity(t *testing.T) { diff --git a/internal/format/pretty_test.go b/internal/format/pretty_test.go index 65a2e89..1655e59 100644 --- a/internal/format/pretty_test.go +++ b/internal/format/pretty_test.go @@ -393,25 +393,55 @@ func TestPrettyOutputValues(t *testing.T) { } func TestPrettyHeaderFromFile(t *testing.T) { - assert := assert.New(t) - settings := testutil.Settings().WithSections().WithColor().Build() + tests := []struct { + name string + golden string + file string + }{ + { + name: "load module header from .adoc", + golden: "pretty-HeaderFromADOCFile", + file: "doc.adoc", + }, + { + name: "load module header from .md", + golden: "pretty-HeaderFromMDFile", + file: "doc.md", + }, + { + name: "load module header from .tf", + golden: "pretty-HeaderFromTFFile", + file: "doc.tf", + }, + { + name: "load module header from .txt", + golden: "pretty-HeaderFromTXTFile", + file: "doc.txt", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert := assert.New(t) + settings := testutil.Settings().WithSections().WithColor().Build() - expected, err := testutil.GetExpected("pretty", "pretty-HeaderFromFile") - assert.Nil(err) + expected, err := testutil.GetExpected("pretty", tt.golden) + assert.Nil(err) - options, err := module.NewOptions().WithOverwrite(&module.Options{ - HeaderFromFile: "doc.tf", - }) - assert.Nil(err) + options, err := module.NewOptions().WithOverwrite(&module.Options{ + HeaderFromFile: tt.file, + }) + assert.Nil(err) - module, err := testutil.GetModule(options) - assert.Nil(err) + module, err := testutil.GetModule(options) + assert.Nil(err) - printer := NewPretty(settings) - actual, err := printer.Print(module, settings) + printer := NewPretty(settings) + actual, err := printer.Print(module, settings) - assert.Nil(err) - assert.Equal(expected, actual) + assert.Nil(err) + assert.Equal(expected, actual) + }) + } } func TestPrettyEmpty(t *testing.T) { diff --git a/internal/format/testdata/asciidoc/document-HeaderFromADOCFile.golden b/internal/format/testdata/asciidoc/document-HeaderFromADOCFile.golden new file mode 100644 index 0000000..7205eeb --- /dev/null +++ b/internal/format/testdata/asciidoc/document-HeaderFromADOCFile.golden @@ -0,0 +1,353 @@ += This header comes from a custom AsciiDoc file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +== Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +== Inputs + +The following input variables are supported: + +=== unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +=== bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +=== bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +=== bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +=== string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +=== string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +=== string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +=== number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +=== number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +=== number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +=== number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +=== map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +=== map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +=== map-1 + +Description: It's map number one. + +Type: `map` + +Default: +[source,json] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +=== list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +=== list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +=== list-1 + +Description: It's list number one. + +Type: `list` + +Default: +[source,json] +---- +[ + "a", + "b", + "c" +] +---- + +=== input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +=== input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +=== input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: +[source,json] +---- +[ + "name rack:location" +] +---- + +=== long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: +[source,hcl] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +Default: +[source,json] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +=== no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +=== with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +=== string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +=== string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +=== string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +=== number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +=== bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +=== list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +=== object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +== Outputs + +The following outputs are exported: + +=== unquoted + +Description: It's unquoted output. + +=== output-2 + +Description: It's output number two. + +=== output-1 + +Description: It's output number one. + +=== output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/asciidoc/document-HeaderFromMDFile.golden b/internal/format/testdata/asciidoc/document-HeaderFromMDFile.golden new file mode 100644 index 0000000..9ed7143 --- /dev/null +++ b/internal/format/testdata/asciidoc/document-HeaderFromMDFile.golden @@ -0,0 +1,353 @@ +# This header comes from a custom Markdown file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +== Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +== Inputs + +The following input variables are supported: + +=== unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +=== bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +=== bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +=== bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +=== string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +=== string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +=== string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +=== number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +=== number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +=== number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +=== number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +=== map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +=== map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +=== map-1 + +Description: It's map number one. + +Type: `map` + +Default: +[source,json] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +=== list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +=== list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +=== list-1 + +Description: It's list number one. + +Type: `list` + +Default: +[source,json] +---- +[ + "a", + "b", + "c" +] +---- + +=== input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +=== input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +=== input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: +[source,json] +---- +[ + "name rack:location" +] +---- + +=== long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: +[source,hcl] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +Default: +[source,json] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +=== no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +=== with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +=== string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +=== string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +=== string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +=== number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +=== bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +=== list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +=== object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +== Outputs + +The following outputs are exported: + +=== unquoted + +Description: It's unquoted output. + +=== output-2 + +Description: It's output number two. + +=== output-1 + +Description: It's output number one. + +=== output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/asciidoc/document-HeaderFromFile.golden b/internal/format/testdata/asciidoc/document-HeaderFromTFFile.golden similarity index 100% rename from internal/format/testdata/asciidoc/document-HeaderFromFile.golden rename to internal/format/testdata/asciidoc/document-HeaderFromTFFile.golden diff --git a/internal/format/testdata/asciidoc/document-HeaderFromTXTFile.golden b/internal/format/testdata/asciidoc/document-HeaderFromTXTFile.golden new file mode 100644 index 0000000..377bd6f --- /dev/null +++ b/internal/format/testdata/asciidoc/document-HeaderFromTXTFile.golden @@ -0,0 +1,353 @@ +# This header comes from a custom Text file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +== Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +== Inputs + +The following input variables are supported: + +=== unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +=== bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +=== bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +=== bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +=== string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +=== string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +=== string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +=== number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +=== number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +=== number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +=== number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +=== map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +=== map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +=== map-1 + +Description: It's map number one. + +Type: `map` + +Default: +[source,json] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +=== list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +=== list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +=== list-1 + +Description: It's list number one. + +Type: `list` + +Default: +[source,json] +---- +[ + "a", + "b", + "c" +] +---- + +=== input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +=== input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +=== input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: +[source,json] +---- +[ + "name rack:location" +] +---- + +=== long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: +[source,hcl] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +Default: +[source,json] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +=== no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +=== with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +=== string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +=== string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +=== string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +=== number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +=== bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +=== list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +=== object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +== Outputs + +The following outputs are exported: + +=== unquoted + +Description: It's unquoted output. + +=== output-2 + +Description: It's output number two. + +=== output-1 + +Description: It's output number one. + +=== output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/asciidoc/table-HeaderFromADOCFile.golden b/internal/format/testdata/asciidoc/table-HeaderFromADOCFile.golden new file mode 100644 index 0000000..ffd4ad0 --- /dev/null +++ b/internal/format/testdata/asciidoc/table-HeaderFromADOCFile.golden @@ -0,0 +1,265 @@ += This header comes from a custom AsciiDoc file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|terraform |>= 0.12 +|aws |>= 2.15.0 +|random |>= 2.2.0 +|=== + +== Providers + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|tls |n/a +|aws |>= 2.15.0 +|aws.ident |>= 2.15.0 +|null |n/a +|=== + +== Inputs + +[cols="a,a,a,a",options="header,autowidth"] +|=== +|Name |Description |Type |Default +|unquoted +|n/a +|`any` +|n/a + +|bool-3 +|n/a +|`bool` +|`true` + +|bool-2 +|It's bool number two. +|`bool` +|`false` + +|bool-1 +|It's bool number one. +|`bool` +|`true` + +|string-3 +|n/a +|`string` +|`""` + +|string-2 +|It's string number two. +|`string` +|n/a + +|string-1 +|It's string number one. +|`string` +|`"bar"` + +|number-3 +|n/a +|`number` +|`"19"` + +|number-4 +|n/a +|`number` +|`15.75` + +|number-2 +|It's number number two. +|`number` +|n/a + +|number-1 +|It's number number one. +|`number` +|`42` + +|map-3 +|n/a +|`map` +|`{}` + +|map-2 +|It's map number two. +|`map` +|n/a + +|map-1 +|It's map number one. +|`map` +| + +[source] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +|list-3 +|n/a +|`list` +|`[]` + +|list-2 +|It's list number two. +|`list` +|n/a + +|list-1 +|It's list number one. +|`list` +| + +[source] +---- +[ + "a", + "b", + "c" +] +---- + +|input_with_underscores +|A variable with underscores. +|`any` +|n/a + +|input-with-pipe +|It includes v1 \| v2 \| v3 +|`string` +|`"v1"` + +|input-with-code-block +|This is a complicated one. We need a newline. +And an example in a code block +[source] +---- +default = [ + "machine rack01:neptune" +] +---- + +|`list` +| + +[source] +---- +[ + "name rack:location" +] +---- + +|long_type +|This description is itself markdown. + +It spans over multiple lines. + +| + +[source] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +| + +[source] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +|no-escape-default-value +|The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. +|`string` +|`"VALUE_WITH_UNDERSCORE"` + +|with-url +|The description contains url. https://www.domain.com/foo/bar_baz.html +|`string` +|`""` + +|string_default_empty +|n/a +|`string` +|`""` + +|string_default_null +|n/a +|`string` +|`null` + +|string_no_default +|n/a +|`string` +|n/a + +|number_default_zero +|n/a +|`number` +|`0` + +|bool_default_false +|n/a +|`bool` +|`false` + +|list_default_empty +|n/a +|`list(string)` +|`[]` + +|object_default_empty +|n/a +|`object({})` +|`{}` + +|=== + +== Outputs + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Description +|unquoted |It's unquoted output. +|output-2 |It's output number two. +|output-1 |It's output number one. +|output-0.12 |terraform 0.12 only +|=== diff --git a/internal/format/testdata/asciidoc/table-HeaderFromMDFile.golden b/internal/format/testdata/asciidoc/table-HeaderFromMDFile.golden new file mode 100644 index 0000000..4b0bc0f --- /dev/null +++ b/internal/format/testdata/asciidoc/table-HeaderFromMDFile.golden @@ -0,0 +1,265 @@ +# This header comes from a custom Markdown file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|terraform |>= 0.12 +|aws |>= 2.15.0 +|random |>= 2.2.0 +|=== + +== Providers + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|tls |n/a +|aws |>= 2.15.0 +|aws.ident |>= 2.15.0 +|null |n/a +|=== + +== Inputs + +[cols="a,a,a,a",options="header,autowidth"] +|=== +|Name |Description |Type |Default +|unquoted +|n/a +|`any` +|n/a + +|bool-3 +|n/a +|`bool` +|`true` + +|bool-2 +|It's bool number two. +|`bool` +|`false` + +|bool-1 +|It's bool number one. +|`bool` +|`true` + +|string-3 +|n/a +|`string` +|`""` + +|string-2 +|It's string number two. +|`string` +|n/a + +|string-1 +|It's string number one. +|`string` +|`"bar"` + +|number-3 +|n/a +|`number` +|`"19"` + +|number-4 +|n/a +|`number` +|`15.75` + +|number-2 +|It's number number two. +|`number` +|n/a + +|number-1 +|It's number number one. +|`number` +|`42` + +|map-3 +|n/a +|`map` +|`{}` + +|map-2 +|It's map number two. +|`map` +|n/a + +|map-1 +|It's map number one. +|`map` +| + +[source] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +|list-3 +|n/a +|`list` +|`[]` + +|list-2 +|It's list number two. +|`list` +|n/a + +|list-1 +|It's list number one. +|`list` +| + +[source] +---- +[ + "a", + "b", + "c" +] +---- + +|input_with_underscores +|A variable with underscores. +|`any` +|n/a + +|input-with-pipe +|It includes v1 \| v2 \| v3 +|`string` +|`"v1"` + +|input-with-code-block +|This is a complicated one. We need a newline. +And an example in a code block +[source] +---- +default = [ + "machine rack01:neptune" +] +---- + +|`list` +| + +[source] +---- +[ + "name rack:location" +] +---- + +|long_type +|This description is itself markdown. + +It spans over multiple lines. + +| + +[source] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +| + +[source] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +|no-escape-default-value +|The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. +|`string` +|`"VALUE_WITH_UNDERSCORE"` + +|with-url +|The description contains url. https://www.domain.com/foo/bar_baz.html +|`string` +|`""` + +|string_default_empty +|n/a +|`string` +|`""` + +|string_default_null +|n/a +|`string` +|`null` + +|string_no_default +|n/a +|`string` +|n/a + +|number_default_zero +|n/a +|`number` +|`0` + +|bool_default_false +|n/a +|`bool` +|`false` + +|list_default_empty +|n/a +|`list(string)` +|`[]` + +|object_default_empty +|n/a +|`object({})` +|`{}` + +|=== + +== Outputs + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Description +|unquoted |It's unquoted output. +|output-2 |It's output number two. +|output-1 |It's output number one. +|output-0.12 |terraform 0.12 only +|=== diff --git a/internal/format/testdata/asciidoc/table-HeaderFromFile.golden b/internal/format/testdata/asciidoc/table-HeaderFromTFFile.golden similarity index 100% rename from internal/format/testdata/asciidoc/table-HeaderFromFile.golden rename to internal/format/testdata/asciidoc/table-HeaderFromTFFile.golden diff --git a/internal/format/testdata/asciidoc/table-HeaderFromTXTFile.golden b/internal/format/testdata/asciidoc/table-HeaderFromTXTFile.golden new file mode 100644 index 0000000..f77e84a --- /dev/null +++ b/internal/format/testdata/asciidoc/table-HeaderFromTXTFile.golden @@ -0,0 +1,265 @@ +# This header comes from a custom Text file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +== Requirements + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|terraform |>= 0.12 +|aws |>= 2.15.0 +|random |>= 2.2.0 +|=== + +== Providers + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Version +|tls |n/a +|aws |>= 2.15.0 +|aws.ident |>= 2.15.0 +|null |n/a +|=== + +== Inputs + +[cols="a,a,a,a",options="header,autowidth"] +|=== +|Name |Description |Type |Default +|unquoted +|n/a +|`any` +|n/a + +|bool-3 +|n/a +|`bool` +|`true` + +|bool-2 +|It's bool number two. +|`bool` +|`false` + +|bool-1 +|It's bool number one. +|`bool` +|`true` + +|string-3 +|n/a +|`string` +|`""` + +|string-2 +|It's string number two. +|`string` +|n/a + +|string-1 +|It's string number one. +|`string` +|`"bar"` + +|number-3 +|n/a +|`number` +|`"19"` + +|number-4 +|n/a +|`number` +|`15.75` + +|number-2 +|It's number number two. +|`number` +|n/a + +|number-1 +|It's number number one. +|`number` +|`42` + +|map-3 +|n/a +|`map` +|`{}` + +|map-2 +|It's map number two. +|`map` +|n/a + +|map-1 +|It's map number one. +|`map` +| + +[source] +---- +{ + "a": 1, + "b": 2, + "c": 3 +} +---- + +|list-3 +|n/a +|`list` +|`[]` + +|list-2 +|It's list number two. +|`list` +|n/a + +|list-1 +|It's list number one. +|`list` +| + +[source] +---- +[ + "a", + "b", + "c" +] +---- + +|input_with_underscores +|A variable with underscores. +|`any` +|n/a + +|input-with-pipe +|It includes v1 \| v2 \| v3 +|`string` +|`"v1"` + +|input-with-code-block +|This is a complicated one. We need a newline. +And an example in a code block +[source] +---- +default = [ + "machine rack01:neptune" +] +---- + +|`list` +| + +[source] +---- +[ + "name rack:location" +] +---- + +|long_type +|This description is itself markdown. + +It spans over multiple lines. + +| + +[source] +---- +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +---- + +| + +[source] +---- +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +---- + +|no-escape-default-value +|The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. +|`string` +|`"VALUE_WITH_UNDERSCORE"` + +|with-url +|The description contains url. https://www.domain.com/foo/bar_baz.html +|`string` +|`""` + +|string_default_empty +|n/a +|`string` +|`""` + +|string_default_null +|n/a +|`string` +|`null` + +|string_no_default +|n/a +|`string` +|n/a + +|number_default_zero +|n/a +|`number` +|`0` + +|bool_default_false +|n/a +|`bool` +|`false` + +|list_default_empty +|n/a +|`list(string)` +|`[]` + +|object_default_empty +|n/a +|`object({})` +|`{}` + +|=== + +== Outputs + +[cols="a,a",options="header,autowidth"] +|=== +|Name |Description +|unquoted |It's unquoted output. +|output-2 |It's output number two. +|output-1 |It's output number one. +|output-0.12 |terraform 0.12 only +|=== diff --git a/internal/format/testdata/json/json-HeaderFromADOCFile.golden b/internal/format/testdata/json/json-HeaderFromADOCFile.golden new file mode 100644 index 0000000..3922a45 --- /dev/null +++ b/internal/format/testdata/json/json-HeaderFromADOCFile.golden @@ -0,0 +1,294 @@ +{ + "header": "= This header comes from a custom AsciiDoc file\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna\naliqua. Ut enim ad minim veniam, quis nostrud exercitation\nullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit\nesse cillum dolore eu fugiat nulla pariatur.\n", + "inputs": [ + { + "name": "unquoted", + "type": "any", + "description": null, + "default": null, + "required": true + }, + { + "name": "bool-3", + "type": "bool", + "description": null, + "default": true, + "required": false + }, + { + "name": "bool-2", + "type": "bool", + "description": "It's bool number two.", + "default": false, + "required": false + }, + { + "name": "bool-1", + "type": "bool", + "description": "It's bool number one.", + "default": true, + "required": false + }, + { + "name": "string-3", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string-2", + "type": "string", + "description": "It's string number two.", + "default": null, + "required": true + }, + { + "name": "string-1", + "type": "string", + "description": "It's string number one.", + "default": "bar", + "required": false + }, + { + "name": "number-3", + "type": "number", + "description": null, + "default": "19", + "required": false + }, + { + "name": "number-4", + "type": "number", + "description": null, + "default": 15.75, + "required": false + }, + { + "name": "number-2", + "type": "number", + "description": "It's number number two.", + "default": null, + "required": true + }, + { + "name": "number-1", + "type": "number", + "description": "It's number number one.", + "default": 42, + "required": false + }, + { + "name": "map-3", + "type": "map", + "description": null, + "default": {}, + "required": false + }, + { + "name": "map-2", + "type": "map", + "description": "It's map number two.", + "default": null, + "required": true + }, + { + "name": "map-1", + "type": "map", + "description": "It's map number one.", + "default": { + "a": 1, + "b": 2, + "c": 3 + }, + "required": false + }, + { + "name": "list-3", + "type": "list", + "description": null, + "default": [], + "required": false + }, + { + "name": "list-2", + "type": "list", + "description": "It's list number two.", + "default": null, + "required": true + }, + { + "name": "list-1", + "type": "list", + "description": "It's list number one.", + "default": [ + "a", + "b", + "c" + ], + "required": false + }, + { + "name": "input_with_underscores", + "type": "any", + "description": "A variable with underscores.", + "default": null, + "required": true + }, + { + "name": "input-with-pipe", + "type": "string", + "description": "It includes v1 | v2 | v3", + "default": "v1", + "required": false + }, + { + "name": "input-with-code-block", + "type": "list", + "description": "This is a complicated one. We need a newline. \nAnd an example in a code block\n```\ndefault = [\n \"machine rack01:neptune\"\n]\n```\n", + "default": [ + "name rack:location" + ], + "required": false + }, + { + "name": "long_type", + "type": "object({\n name = string,\n foo = object({ foo = string, bar = string }),\n bar = object({ foo = string, bar = string }),\n fizz = list(string),\n buzz = list(string)\n })", + "description": "This description is itself markdown.\n\nIt spans over multiple lines.\n", + "default": { + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" + }, + "required": false + }, + { + "name": "no-escape-default-value", + "type": "string", + "description": "The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.", + "default": "VALUE_WITH_UNDERSCORE", + "required": false + }, + { + "name": "with-url", + "type": "string", + "description": "The description contains url. https://www.domain.com/foo/bar_baz.html", + "default": "", + "required": false + }, + { + "name": "string_default_empty", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string_default_null", + "type": "string", + "description": null, + "default": null, + "required": false + }, + { + "name": "string_no_default", + "type": "string", + "description": null, + "default": null, + "required": true + }, + { + "name": "number_default_zero", + "type": "number", + "description": null, + "default": 0, + "required": false + }, + { + "name": "bool_default_false", + "type": "bool", + "description": null, + "default": false, + "required": false + }, + { + "name": "list_default_empty", + "type": "list(string)", + "description": null, + "default": [], + "required": false + }, + { + "name": "object_default_empty", + "type": "object({})", + "description": null, + "default": {}, + "required": false + } + ], + "outputs": [ + { + "name": "unquoted", + "description": "It's unquoted output." + }, + { + "name": "output-2", + "description": "It's output number two." + }, + { + "name": "output-1", + "description": "It's output number one." + }, + { + "name": "output-0.12", + "description": "terraform 0.12 only" + } + ], + "providers": [ + { + "name": "tls", + "alias": null, + "version": null + }, + { + "name": "aws", + "alias": null, + "version": ">= 2.15.0" + }, + { + "name": "aws", + "alias": "ident", + "version": ">= 2.15.0" + }, + { + "name": "null", + "alias": null, + "version": null + } + ], + "requirements": [ + { + "name": "terraform", + "version": ">= 0.12" + }, + { + "name": "aws", + "version": ">= 2.15.0" + }, + { + "name": "random", + "version": ">= 2.2.0" + } + ] +} \ No newline at end of file diff --git a/internal/format/testdata/json/json-HeaderFromMDFile.golden b/internal/format/testdata/json/json-HeaderFromMDFile.golden new file mode 100644 index 0000000..98379f7 --- /dev/null +++ b/internal/format/testdata/json/json-HeaderFromMDFile.golden @@ -0,0 +1,294 @@ +{ + "header": "# This header comes from a custom Markdown file\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna\naliqua. Ut enim ad minim veniam, quis nostrud exercitation\nullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit\nesse cillum dolore eu fugiat nulla pariatur.\n", + "inputs": [ + { + "name": "unquoted", + "type": "any", + "description": null, + "default": null, + "required": true + }, + { + "name": "bool-3", + "type": "bool", + "description": null, + "default": true, + "required": false + }, + { + "name": "bool-2", + "type": "bool", + "description": "It's bool number two.", + "default": false, + "required": false + }, + { + "name": "bool-1", + "type": "bool", + "description": "It's bool number one.", + "default": true, + "required": false + }, + { + "name": "string-3", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string-2", + "type": "string", + "description": "It's string number two.", + "default": null, + "required": true + }, + { + "name": "string-1", + "type": "string", + "description": "It's string number one.", + "default": "bar", + "required": false + }, + { + "name": "number-3", + "type": "number", + "description": null, + "default": "19", + "required": false + }, + { + "name": "number-4", + "type": "number", + "description": null, + "default": 15.75, + "required": false + }, + { + "name": "number-2", + "type": "number", + "description": "It's number number two.", + "default": null, + "required": true + }, + { + "name": "number-1", + "type": "number", + "description": "It's number number one.", + "default": 42, + "required": false + }, + { + "name": "map-3", + "type": "map", + "description": null, + "default": {}, + "required": false + }, + { + "name": "map-2", + "type": "map", + "description": "It's map number two.", + "default": null, + "required": true + }, + { + "name": "map-1", + "type": "map", + "description": "It's map number one.", + "default": { + "a": 1, + "b": 2, + "c": 3 + }, + "required": false + }, + { + "name": "list-3", + "type": "list", + "description": null, + "default": [], + "required": false + }, + { + "name": "list-2", + "type": "list", + "description": "It's list number two.", + "default": null, + "required": true + }, + { + "name": "list-1", + "type": "list", + "description": "It's list number one.", + "default": [ + "a", + "b", + "c" + ], + "required": false + }, + { + "name": "input_with_underscores", + "type": "any", + "description": "A variable with underscores.", + "default": null, + "required": true + }, + { + "name": "input-with-pipe", + "type": "string", + "description": "It includes v1 | v2 | v3", + "default": "v1", + "required": false + }, + { + "name": "input-with-code-block", + "type": "list", + "description": "This is a complicated one. We need a newline. \nAnd an example in a code block\n```\ndefault = [\n \"machine rack01:neptune\"\n]\n```\n", + "default": [ + "name rack:location" + ], + "required": false + }, + { + "name": "long_type", + "type": "object({\n name = string,\n foo = object({ foo = string, bar = string }),\n bar = object({ foo = string, bar = string }),\n fizz = list(string),\n buzz = list(string)\n })", + "description": "This description is itself markdown.\n\nIt spans over multiple lines.\n", + "default": { + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" + }, + "required": false + }, + { + "name": "no-escape-default-value", + "type": "string", + "description": "The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.", + "default": "VALUE_WITH_UNDERSCORE", + "required": false + }, + { + "name": "with-url", + "type": "string", + "description": "The description contains url. https://www.domain.com/foo/bar_baz.html", + "default": "", + "required": false + }, + { + "name": "string_default_empty", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string_default_null", + "type": "string", + "description": null, + "default": null, + "required": false + }, + { + "name": "string_no_default", + "type": "string", + "description": null, + "default": null, + "required": true + }, + { + "name": "number_default_zero", + "type": "number", + "description": null, + "default": 0, + "required": false + }, + { + "name": "bool_default_false", + "type": "bool", + "description": null, + "default": false, + "required": false + }, + { + "name": "list_default_empty", + "type": "list(string)", + "description": null, + "default": [], + "required": false + }, + { + "name": "object_default_empty", + "type": "object({})", + "description": null, + "default": {}, + "required": false + } + ], + "outputs": [ + { + "name": "unquoted", + "description": "It's unquoted output." + }, + { + "name": "output-2", + "description": "It's output number two." + }, + { + "name": "output-1", + "description": "It's output number one." + }, + { + "name": "output-0.12", + "description": "terraform 0.12 only" + } + ], + "providers": [ + { + "name": "tls", + "alias": null, + "version": null + }, + { + "name": "aws", + "alias": null, + "version": ">= 2.15.0" + }, + { + "name": "aws", + "alias": "ident", + "version": ">= 2.15.0" + }, + { + "name": "null", + "alias": null, + "version": null + } + ], + "requirements": [ + { + "name": "terraform", + "version": ">= 0.12" + }, + { + "name": "aws", + "version": ">= 2.15.0" + }, + { + "name": "random", + "version": ">= 2.2.0" + } + ] +} \ No newline at end of file diff --git a/internal/format/testdata/json/json-HeaderFromFile.golden b/internal/format/testdata/json/json-HeaderFromTFFile.golden similarity index 100% rename from internal/format/testdata/json/json-HeaderFromFile.golden rename to internal/format/testdata/json/json-HeaderFromTFFile.golden diff --git a/internal/format/testdata/json/json-HeaderFromTXTFile.golden b/internal/format/testdata/json/json-HeaderFromTXTFile.golden new file mode 100644 index 0000000..f988eea --- /dev/null +++ b/internal/format/testdata/json/json-HeaderFromTXTFile.golden @@ -0,0 +1,294 @@ +{ + "header": "# This header comes from a custom Text file\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna\naliqua. Ut enim ad minim veniam, quis nostrud exercitation\nullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit\nesse cillum dolore eu fugiat nulla pariatur.\n", + "inputs": [ + { + "name": "unquoted", + "type": "any", + "description": null, + "default": null, + "required": true + }, + { + "name": "bool-3", + "type": "bool", + "description": null, + "default": true, + "required": false + }, + { + "name": "bool-2", + "type": "bool", + "description": "It's bool number two.", + "default": false, + "required": false + }, + { + "name": "bool-1", + "type": "bool", + "description": "It's bool number one.", + "default": true, + "required": false + }, + { + "name": "string-3", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string-2", + "type": "string", + "description": "It's string number two.", + "default": null, + "required": true + }, + { + "name": "string-1", + "type": "string", + "description": "It's string number one.", + "default": "bar", + "required": false + }, + { + "name": "number-3", + "type": "number", + "description": null, + "default": "19", + "required": false + }, + { + "name": "number-4", + "type": "number", + "description": null, + "default": 15.75, + "required": false + }, + { + "name": "number-2", + "type": "number", + "description": "It's number number two.", + "default": null, + "required": true + }, + { + "name": "number-1", + "type": "number", + "description": "It's number number one.", + "default": 42, + "required": false + }, + { + "name": "map-3", + "type": "map", + "description": null, + "default": {}, + "required": false + }, + { + "name": "map-2", + "type": "map", + "description": "It's map number two.", + "default": null, + "required": true + }, + { + "name": "map-1", + "type": "map", + "description": "It's map number one.", + "default": { + "a": 1, + "b": 2, + "c": 3 + }, + "required": false + }, + { + "name": "list-3", + "type": "list", + "description": null, + "default": [], + "required": false + }, + { + "name": "list-2", + "type": "list", + "description": "It's list number two.", + "default": null, + "required": true + }, + { + "name": "list-1", + "type": "list", + "description": "It's list number one.", + "default": [ + "a", + "b", + "c" + ], + "required": false + }, + { + "name": "input_with_underscores", + "type": "any", + "description": "A variable with underscores.", + "default": null, + "required": true + }, + { + "name": "input-with-pipe", + "type": "string", + "description": "It includes v1 | v2 | v3", + "default": "v1", + "required": false + }, + { + "name": "input-with-code-block", + "type": "list", + "description": "This is a complicated one. We need a newline. \nAnd an example in a code block\n```\ndefault = [\n \"machine rack01:neptune\"\n]\n```\n", + "default": [ + "name rack:location" + ], + "required": false + }, + { + "name": "long_type", + "type": "object({\n name = string,\n foo = object({ foo = string, bar = string }),\n bar = object({ foo = string, bar = string }),\n fizz = list(string),\n buzz = list(string)\n })", + "description": "This description is itself markdown.\n\nIt spans over multiple lines.\n", + "default": { + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" + }, + "required": false + }, + { + "name": "no-escape-default-value", + "type": "string", + "description": "The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.", + "default": "VALUE_WITH_UNDERSCORE", + "required": false + }, + { + "name": "with-url", + "type": "string", + "description": "The description contains url. https://www.domain.com/foo/bar_baz.html", + "default": "", + "required": false + }, + { + "name": "string_default_empty", + "type": "string", + "description": null, + "default": "", + "required": false + }, + { + "name": "string_default_null", + "type": "string", + "description": null, + "default": null, + "required": false + }, + { + "name": "string_no_default", + "type": "string", + "description": null, + "default": null, + "required": true + }, + { + "name": "number_default_zero", + "type": "number", + "description": null, + "default": 0, + "required": false + }, + { + "name": "bool_default_false", + "type": "bool", + "description": null, + "default": false, + "required": false + }, + { + "name": "list_default_empty", + "type": "list(string)", + "description": null, + "default": [], + "required": false + }, + { + "name": "object_default_empty", + "type": "object({})", + "description": null, + "default": {}, + "required": false + } + ], + "outputs": [ + { + "name": "unquoted", + "description": "It's unquoted output." + }, + { + "name": "output-2", + "description": "It's output number two." + }, + { + "name": "output-1", + "description": "It's output number one." + }, + { + "name": "output-0.12", + "description": "terraform 0.12 only" + } + ], + "providers": [ + { + "name": "tls", + "alias": null, + "version": null + }, + { + "name": "aws", + "alias": null, + "version": ">= 2.15.0" + }, + { + "name": "aws", + "alias": "ident", + "version": ">= 2.15.0" + }, + { + "name": "null", + "alias": null, + "version": null + } + ], + "requirements": [ + { + "name": "terraform", + "version": ">= 0.12" + }, + { + "name": "aws", + "version": ">= 2.15.0" + }, + { + "name": "random", + "version": ">= 2.2.0" + } + ] +} \ No newline at end of file diff --git a/internal/format/testdata/markdown/document-HeaderFromADOCFile.golden b/internal/format/testdata/markdown/document-HeaderFromADOCFile.golden new file mode 100644 index 0000000..bd04807 --- /dev/null +++ b/internal/format/testdata/markdown/document-HeaderFromADOCFile.golden @@ -0,0 +1,353 @@ += This header comes from a custom AsciiDoc file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +## Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +## Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +## Inputs + +The following input variables are supported: + +### unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +### bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +### bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +### bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +### string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +### string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +### string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +### number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +### number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +### number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +### number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +### map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +### map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +### map-1 + +Description: It's map number one. + +Type: `map` + +Default: + +```json +{ + "a": 1, + "b": 2, + "c": 3 +} +``` + +### list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +### list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +### list-1 + +Description: It's list number one. + +Type: `list` + +Default: + +```json +[ + "a", + "b", + "c" +] +``` + +### input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +### input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +### input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: + +```json +[ + "name rack:location" +] +``` + +### long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: + +```hcl +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +``` + +Default: + +```json +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +``` + +### no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +### with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +### string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +### string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +### string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +### number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +### bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +### list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +### object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +## Outputs + +The following outputs are exported: + +### unquoted + +Description: It's unquoted output. + +### output-2 + +Description: It's output number two. + +### output-1 + +Description: It's output number one. + +### output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/markdown/document-HeaderFromMDFile.golden b/internal/format/testdata/markdown/document-HeaderFromMDFile.golden new file mode 100644 index 0000000..22935be --- /dev/null +++ b/internal/format/testdata/markdown/document-HeaderFromMDFile.golden @@ -0,0 +1,353 @@ +# This header comes from a custom Markdown file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +## Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +## Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +## Inputs + +The following input variables are supported: + +### unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +### bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +### bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +### bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +### string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +### string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +### string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +### number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +### number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +### number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +### number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +### map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +### map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +### map-1 + +Description: It's map number one. + +Type: `map` + +Default: + +```json +{ + "a": 1, + "b": 2, + "c": 3 +} +``` + +### list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +### list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +### list-1 + +Description: It's list number one. + +Type: `list` + +Default: + +```json +[ + "a", + "b", + "c" +] +``` + +### input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +### input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +### input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: + +```json +[ + "name rack:location" +] +``` + +### long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: + +```hcl +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +``` + +Default: + +```json +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +``` + +### no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +### with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +### string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +### string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +### string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +### number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +### bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +### list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +### object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +## Outputs + +The following outputs are exported: + +### unquoted + +Description: It's unquoted output. + +### output-2 + +Description: It's output number two. + +### output-1 + +Description: It's output number one. + +### output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/markdown/document-HeaderFromFile.golden b/internal/format/testdata/markdown/document-HeaderFromTFFile.golden similarity index 100% rename from internal/format/testdata/markdown/document-HeaderFromFile.golden rename to internal/format/testdata/markdown/document-HeaderFromTFFile.golden diff --git a/internal/format/testdata/markdown/document-HeaderFromTXTFile.golden b/internal/format/testdata/markdown/document-HeaderFromTXTFile.golden new file mode 100644 index 0000000..414a2f2 --- /dev/null +++ b/internal/format/testdata/markdown/document-HeaderFromTXTFile.golden @@ -0,0 +1,353 @@ +# This header comes from a custom Text file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +## Requirements + +The following requirements are needed by this module: + +- terraform (>= 0.12) + +- aws (>= 2.15.0) + +- random (>= 2.2.0) + +## Providers + +The following providers are used by this module: + +- tls + +- aws (>= 2.15.0) + +- aws.ident (>= 2.15.0) + +- null + +## Inputs + +The following input variables are supported: + +### unquoted + +Description: n/a + +Type: `any` + +Default: n/a + +### bool-3 + +Description: n/a + +Type: `bool` + +Default: `true` + +### bool-2 + +Description: It's bool number two. + +Type: `bool` + +Default: `false` + +### bool-1 + +Description: It's bool number one. + +Type: `bool` + +Default: `true` + +### string-3 + +Description: n/a + +Type: `string` + +Default: `""` + +### string-2 + +Description: It's string number two. + +Type: `string` + +Default: n/a + +### string-1 + +Description: It's string number one. + +Type: `string` + +Default: `"bar"` + +### number-3 + +Description: n/a + +Type: `number` + +Default: `"19"` + +### number-4 + +Description: n/a + +Type: `number` + +Default: `15.75` + +### number-2 + +Description: It's number number two. + +Type: `number` + +Default: n/a + +### number-1 + +Description: It's number number one. + +Type: `number` + +Default: `42` + +### map-3 + +Description: n/a + +Type: `map` + +Default: `{}` + +### map-2 + +Description: It's map number two. + +Type: `map` + +Default: n/a + +### map-1 + +Description: It's map number one. + +Type: `map` + +Default: + +```json +{ + "a": 1, + "b": 2, + "c": 3 +} +``` + +### list-3 + +Description: n/a + +Type: `list` + +Default: `[]` + +### list-2 + +Description: It's list number two. + +Type: `list` + +Default: n/a + +### list-1 + +Description: It's list number one. + +Type: `list` + +Default: + +```json +[ + "a", + "b", + "c" +] +``` + +### input_with_underscores + +Description: A variable with underscores. + +Type: `any` + +Default: n/a + +### input-with-pipe + +Description: It includes v1 \| v2 \| v3 + +Type: `string` + +Default: `"v1"` + +### input-with-code-block + +Description: This is a complicated one. We need a newline. +And an example in a code block +``` +default = [ + "machine rack01:neptune" +] +``` + +Type: `list` + +Default: + +```json +[ + "name rack:location" +] +``` + +### long_type + +Description: This description is itself markdown. + +It spans over multiple lines. + +Type: + +```hcl +object({ + name = string, + foo = object({ foo = string, bar = string }), + bar = object({ foo = string, bar = string }), + fizz = list(string), + buzz = list(string) + }) +``` + +Default: + +```json +{ + "bar": { + "bar": "bar", + "foo": "bar" + }, + "buzz": [ + "fizz", + "buzz" + ], + "fizz": [], + "foo": { + "bar": "foo", + "foo": "foo" + }, + "name": "hello" +} +``` + +### no-escape-default-value + +Description: The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. + +Type: `string` + +Default: `"VALUE_WITH_UNDERSCORE"` + +### with-url + +Description: The description contains url. https://www.domain.com/foo/bar_baz.html + +Type: `string` + +Default: `""` + +### string_default_empty + +Description: n/a + +Type: `string` + +Default: `""` + +### string_default_null + +Description: n/a + +Type: `string` + +Default: `null` + +### string_no_default + +Description: n/a + +Type: `string` + +Default: n/a + +### number_default_zero + +Description: n/a + +Type: `number` + +Default: `0` + +### bool_default_false + +Description: n/a + +Type: `bool` + +Default: `false` + +### list_default_empty + +Description: n/a + +Type: `list(string)` + +Default: `[]` + +### object_default_empty + +Description: n/a + +Type: `object({})` + +Default: `{}` + +## Outputs + +The following outputs are exported: + +### unquoted + +Description: It's unquoted output. + +### output-2 + +Description: It's output number two. + +### output-1 + +Description: It's output number one. + +### output-0.12 + +Description: terraform 0.12 only diff --git a/internal/format/testdata/markdown/table-HeaderFromADOCFile.golden b/internal/format/testdata/markdown/table-HeaderFromADOCFile.golden new file mode 100644 index 0000000..db4f14d --- /dev/null +++ b/internal/format/testdata/markdown/table-HeaderFromADOCFile.golden @@ -0,0 +1,69 @@ += This header comes from a custom AsciiDoc file + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis nostrud exercitation +ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +## Requirements + +| Name | Version | +|------|---------| +| terraform | >= 0.12 | +| aws | >= 2.15.0 | +| random | >= 2.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| tls | n/a | +| aws | >= 2.15.0 | +| aws.ident | >= 2.15.0 | +| null | n/a | + +## Inputs + +| Name | Description | Type | Default | +|------|-------------|------|---------| +| unquoted | n/a | `any` | n/a | +| bool-3 | n/a | `bool` | `true` | +| bool-2 | It's bool number two. | `bool` | `false` | +| bool-1 | It's bool number one. | `bool` | `true` | +| string-3 | n/a | `string` | `""` | +| string-2 | It's string number two. | `string` | n/a | +| string-1 | It's string number one. | `string` | `"bar"` | +| number-3 | n/a | `number` | `"19"` | +| number-4 | n/a | `number` | `15.75` | +| number-2 | It's number number two. | `number` | n/a | +| number-1 | It's number number one. | `number` | `42` | +| map-3 | n/a | `map` | `{}` | +| map-2 | It's map number two. | `map` | n/a | +| map-1 | It's map number one. | `map` |
{
"a": 1,
"b": 2,
"c": 3
} |
+| list-3 | n/a | `list` | `[]` |
+| list-2 | It's list number two. | `list` | n/a |
+| list-1 | It's list number one. | `list` | [| +| input_with_underscores | A variable with underscores. | `any` | n/a | +| input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` | +| input-with-code-block | This is a complicated one. We need a newline.
"a",
"b",
"c"
]
default = [| `list` |
"machine rack01:neptune"
]
[| +| long_type | This description is itself markdown.
"name rack:location"
]
object({
name = string,
foo = object({ foo = string, bar = string }),
bar = object({ foo = string, bar = string }),
fizz = list(string),
buzz = list(string)
}) | {
"bar": {
"bar": "bar",
"foo": "bar"
},
"buzz": [
"fizz",
"buzz"
],
"fizz": [],
"foo": {
"bar": "foo",
"foo": "foo"
},
"name": "hello"
} |
+| no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
+| with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
+| string_default_empty | n/a | `string` | `""` |
+| string_default_null | n/a | `string` | `null` |
+| string_no_default | n/a | `string` | n/a |
+| number_default_zero | n/a | `number` | `0` |
+| bool_default_false | n/a | `bool` | `false` |
+| list_default_empty | n/a | `list(string)` | `[]` |
+| object_default_empty | n/a | `object({})` | `{}` |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| unquoted | It's unquoted output. |
+| output-2 | It's output number two. |
+| output-1 | It's output number one. |
+| output-0.12 | terraform 0.12 only |
diff --git a/internal/format/testdata/markdown/table-HeaderFromMDFile.golden b/internal/format/testdata/markdown/table-HeaderFromMDFile.golden
new file mode 100644
index 0000000..ee9fee9
--- /dev/null
+++ b/internal/format/testdata/markdown/table-HeaderFromMDFile.golden
@@ -0,0 +1,69 @@
+# This header comes from a custom Markdown file
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| terraform | >= 0.12 |
+| aws | >= 2.15.0 |
+| random | >= 2.2.0 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| tls | n/a |
+| aws | >= 2.15.0 |
+| aws.ident | >= 2.15.0 |
+| null | n/a |
+
+## Inputs
+
+| Name | Description | Type | Default |
+|------|-------------|------|---------|
+| unquoted | n/a | `any` | n/a |
+| bool-3 | n/a | `bool` | `true` |
+| bool-2 | It's bool number two. | `bool` | `false` |
+| bool-1 | It's bool number one. | `bool` | `true` |
+| string-3 | n/a | `string` | `""` |
+| string-2 | It's string number two. | `string` | n/a |
+| string-1 | It's string number one. | `string` | `"bar"` |
+| number-3 | n/a | `number` | `"19"` |
+| number-4 | n/a | `number` | `15.75` |
+| number-2 | It's number number two. | `number` | n/a |
+| number-1 | It's number number one. | `number` | `42` |
+| map-3 | n/a | `map` | `{}` |
+| map-2 | It's map number two. | `map` | n/a |
+| map-1 | It's map number one. | `map` | {
"a": 1,
"b": 2,
"c": 3
} |
+| list-3 | n/a | `list` | `[]` |
+| list-2 | It's list number two. | `list` | n/a |
+| list-1 | It's list number one. | `list` | [| +| input_with_underscores | A variable with underscores. | `any` | n/a | +| input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` | +| input-with-code-block | This is a complicated one. We need a newline.
"a",
"b",
"c"
]
default = [| `list` |
"machine rack01:neptune"
]
[| +| long_type | This description is itself markdown.
"name rack:location"
]
object({
name = string,
foo = object({ foo = string, bar = string }),
bar = object({ foo = string, bar = string }),
fizz = list(string),
buzz = list(string)
}) | {
"bar": {
"bar": "bar",
"foo": "bar"
},
"buzz": [
"fizz",
"buzz"
],
"fizz": [],
"foo": {
"bar": "foo",
"foo": "foo"
},
"name": "hello"
} |
+| no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
+| with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
+| string_default_empty | n/a | `string` | `""` |
+| string_default_null | n/a | `string` | `null` |
+| string_no_default | n/a | `string` | n/a |
+| number_default_zero | n/a | `number` | `0` |
+| bool_default_false | n/a | `bool` | `false` |
+| list_default_empty | n/a | `list(string)` | `[]` |
+| object_default_empty | n/a | `object({})` | `{}` |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| unquoted | It's unquoted output. |
+| output-2 | It's output number two. |
+| output-1 | It's output number one. |
+| output-0.12 | terraform 0.12 only |
diff --git a/internal/format/testdata/markdown/table-HeaderFromFile.golden b/internal/format/testdata/markdown/table-HeaderFromTFFile.golden
similarity index 100%
rename from internal/format/testdata/markdown/table-HeaderFromFile.golden
rename to internal/format/testdata/markdown/table-HeaderFromTFFile.golden
diff --git a/internal/format/testdata/markdown/table-HeaderFromTXTFile.golden b/internal/format/testdata/markdown/table-HeaderFromTXTFile.golden
new file mode 100644
index 0000000..9ac8cae
--- /dev/null
+++ b/internal/format/testdata/markdown/table-HeaderFromTXTFile.golden
@@ -0,0 +1,69 @@
+# This header comes from a custom Text file
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| terraform | >= 0.12 |
+| aws | >= 2.15.0 |
+| random | >= 2.2.0 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| tls | n/a |
+| aws | >= 2.15.0 |
+| aws.ident | >= 2.15.0 |
+| null | n/a |
+
+## Inputs
+
+| Name | Description | Type | Default |
+|------|-------------|------|---------|
+| unquoted | n/a | `any` | n/a |
+| bool-3 | n/a | `bool` | `true` |
+| bool-2 | It's bool number two. | `bool` | `false` |
+| bool-1 | It's bool number one. | `bool` | `true` |
+| string-3 | n/a | `string` | `""` |
+| string-2 | It's string number two. | `string` | n/a |
+| string-1 | It's string number one. | `string` | `"bar"` |
+| number-3 | n/a | `number` | `"19"` |
+| number-4 | n/a | `number` | `15.75` |
+| number-2 | It's number number two. | `number` | n/a |
+| number-1 | It's number number one. | `number` | `42` |
+| map-3 | n/a | `map` | `{}` |
+| map-2 | It's map number two. | `map` | n/a |
+| map-1 | It's map number one. | `map` | {
"a": 1,
"b": 2,
"c": 3
} |
+| list-3 | n/a | `list` | `[]` |
+| list-2 | It's list number two. | `list` | n/a |
+| list-1 | It's list number one. | `list` | [| +| input_with_underscores | A variable with underscores. | `any` | n/a | +| input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` | +| input-with-code-block | This is a complicated one. We need a newline.
"a",
"b",
"c"
]
default = [| `list` |
"machine rack01:neptune"
]
[| +| long_type | This description is itself markdown.
"name rack:location"
]
object({
name = string,
foo = object({ foo = string, bar = string }),
bar = object({ foo = string, bar = string }),
fizz = list(string),
buzz = list(string)
}) | {
"bar": {
"bar": "bar",
"foo": "bar"
},
"buzz": [
"fizz",
"buzz"
],
"fizz": [],
"foo": {
"bar": "foo",
"foo": "foo"
},
"name": "hello"
} |
+| no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
+| with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
+| string_default_empty | n/a | `string` | `""` |
+| string_default_null | n/a | `string` | `null` |
+| string_no_default | n/a | `string` | n/a |
+| number_default_zero | n/a | `number` | `0` |
+| bool_default_false | n/a | `bool` | `false` |
+| list_default_empty | n/a | `list(string)` | `[]` |
+| object_default_empty | n/a | `object({})` | `{}` |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| unquoted | It's unquoted output. |
+| output-2 | It's output number two. |
+| output-1 | It's output number one. |
+| output-0.12 | terraform 0.12 only |
diff --git a/internal/format/testdata/pretty/pretty-HeaderFromADOCFile.golden b/internal/format/testdata/pretty/pretty-HeaderFromADOCFile.golden
new file mode 100644
index 0000000..3ce0c1b
--- /dev/null
+++ b/internal/format/testdata/pretty/pretty-HeaderFromADOCFile.golden
@@ -0,0 +1,169 @@
+
+
+[90m= This header comes from a custom AsciiDoc file
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+[0m
+
+
+
+[36mrequirement.terraform[0m (>= 0.12)
+
+[36mrequirement.aws[0m (>= 2.15.0)
+
+[36mrequirement.random[0m (>= 2.2.0)
+
+
+
+[36mprovider.tls[0m
+
+[36mprovider.aws[0m (>= 2.15.0)
+
+[36mprovider.aws.ident[0m (>= 2.15.0)
+
+[36mprovider.null[0m
+
+
+
+[36minput.unquoted[0m (required)
+[90mn/a[0m
+
+[36minput.bool-3[0m (true)
+[90mn/a[0m
+
+[36minput.bool-2[0m (false)
+[90mIt's bool number two.[0m
+
+[36minput.bool-1[0m (true)
+[90mIt's bool number one.[0m
+
+[36minput.string-3[0m ("")
+[90mn/a[0m
+
+[36minput.string-2[0m (required)
+[90mIt's string number two.[0m
+
+[36minput.string-1[0m ("bar")
+[90mIt's string number one.[0m
+
+[36minput.number-3[0m ("19")
+[90mn/a[0m
+
+[36minput.number-4[0m (15.75)
+[90mn/a[0m
+
+[36minput.number-2[0m (required)
+[90mIt's number number two.[0m
+
+[36minput.number-1[0m (42)
+[90mIt's number number one.[0m
+
+[36minput.map-3[0m ({})
+[90mn/a[0m
+
+[36minput.map-2[0m (required)
+[90mIt's map number two.[0m
+
+[36minput.map-1[0m ({
+ "a": 1,
+ "b": 2,
+ "c": 3
+})
+[90mIt's map number one.[0m
+
+[36minput.list-3[0m ([])
+[90mn/a[0m
+
+[36minput.list-2[0m (required)
+[90mIt's list number two.[0m
+
+[36minput.list-1[0m ([
+ "a",
+ "b",
+ "c"
+])
+[90mIt's list number one.[0m
+
+[36minput.input_with_underscores[0m (required)
+[90mA variable with underscores.[0m
+
+[36minput.input-with-pipe[0m ("v1")
+[90mIt includes v1 | v2 | v3[0m
+
+[36minput.input-with-code-block[0m ([
+ "name rack:location"
+])
+[90mThis is a complicated one. We need a newline.
+And an example in a code block
+```
+default = [
+ "machine rack01:neptune"
+]
+```[0m
+
+[36minput.long_type[0m ({
+ "bar": {
+ "bar": "bar",
+ "foo": "bar"
+ },
+ "buzz": [
+ "fizz",
+ "buzz"
+ ],
+ "fizz": [],
+ "foo": {
+ "bar": "foo",
+ "foo": "foo"
+ },
+ "name": "hello"
+})
+[90mThis description is itself markdown.
+
+It spans over multiple lines.[0m
+
+[36minput.no-escape-default-value[0m ("VALUE_WITH_UNDERSCORE")
+[90mThe description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.[0m
+
+[36minput.with-url[0m ("")
+[90mThe description contains url. https://www.domain.com/foo/bar_baz.html[0m
+
+[36minput.string_default_empty[0m ("")
+[90mn/a[0m
+
+[36minput.string_default_null[0m (null)
+[90mn/a[0m
+
+[36minput.string_no_default[0m (required)
+[90mn/a[0m
+
+[36minput.number_default_zero[0m (0)
+[90mn/a[0m
+
+[36minput.bool_default_false[0m (false)
+[90mn/a[0m
+
+[36minput.list_default_empty[0m ([])
+[90mn/a[0m
+
+[36minput.object_default_empty[0m ({})
+[90mn/a[0m
+
+
+
+[36moutput.unquoted[0m
+[90mIt's unquoted output.[0m
+
+[36moutput.output-2[0m
+[90mIt's output number two.[0m
+
+[36moutput.output-1[0m
+[90mIt's output number one.[0m
+
+[36moutput.output-0.12[0m
+[90mterraform 0.12 only[0m
+
diff --git a/internal/format/testdata/pretty/pretty-HeaderFromMDFile.golden b/internal/format/testdata/pretty/pretty-HeaderFromMDFile.golden
new file mode 100644
index 0000000..37c27d3
--- /dev/null
+++ b/internal/format/testdata/pretty/pretty-HeaderFromMDFile.golden
@@ -0,0 +1,169 @@
+
+
+[90m# This header comes from a custom Markdown file
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+[0m
+
+
+
+[36mrequirement.terraform[0m (>= 0.12)
+
+[36mrequirement.aws[0m (>= 2.15.0)
+
+[36mrequirement.random[0m (>= 2.2.0)
+
+
+
+[36mprovider.tls[0m
+
+[36mprovider.aws[0m (>= 2.15.0)
+
+[36mprovider.aws.ident[0m (>= 2.15.0)
+
+[36mprovider.null[0m
+
+
+
+[36minput.unquoted[0m (required)
+[90mn/a[0m
+
+[36minput.bool-3[0m (true)
+[90mn/a[0m
+
+[36minput.bool-2[0m (false)
+[90mIt's bool number two.[0m
+
+[36minput.bool-1[0m (true)
+[90mIt's bool number one.[0m
+
+[36minput.string-3[0m ("")
+[90mn/a[0m
+
+[36minput.string-2[0m (required)
+[90mIt's string number two.[0m
+
+[36minput.string-1[0m ("bar")
+[90mIt's string number one.[0m
+
+[36minput.number-3[0m ("19")
+[90mn/a[0m
+
+[36minput.number-4[0m (15.75)
+[90mn/a[0m
+
+[36minput.number-2[0m (required)
+[90mIt's number number two.[0m
+
+[36minput.number-1[0m (42)
+[90mIt's number number one.[0m
+
+[36minput.map-3[0m ({})
+[90mn/a[0m
+
+[36minput.map-2[0m (required)
+[90mIt's map number two.[0m
+
+[36minput.map-1[0m ({
+ "a": 1,
+ "b": 2,
+ "c": 3
+})
+[90mIt's map number one.[0m
+
+[36minput.list-3[0m ([])
+[90mn/a[0m
+
+[36minput.list-2[0m (required)
+[90mIt's list number two.[0m
+
+[36minput.list-1[0m ([
+ "a",
+ "b",
+ "c"
+])
+[90mIt's list number one.[0m
+
+[36minput.input_with_underscores[0m (required)
+[90mA variable with underscores.[0m
+
+[36minput.input-with-pipe[0m ("v1")
+[90mIt includes v1 | v2 | v3[0m
+
+[36minput.input-with-code-block[0m ([
+ "name rack:location"
+])
+[90mThis is a complicated one. We need a newline.
+And an example in a code block
+```
+default = [
+ "machine rack01:neptune"
+]
+```[0m
+
+[36minput.long_type[0m ({
+ "bar": {
+ "bar": "bar",
+ "foo": "bar"
+ },
+ "buzz": [
+ "fizz",
+ "buzz"
+ ],
+ "fizz": [],
+ "foo": {
+ "bar": "foo",
+ "foo": "foo"
+ },
+ "name": "hello"
+})
+[90mThis description is itself markdown.
+
+It spans over multiple lines.[0m
+
+[36minput.no-escape-default-value[0m ("VALUE_WITH_UNDERSCORE")
+[90mThe description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.[0m
+
+[36minput.with-url[0m ("")
+[90mThe description contains url. https://www.domain.com/foo/bar_baz.html[0m
+
+[36minput.string_default_empty[0m ("")
+[90mn/a[0m
+
+[36minput.string_default_null[0m (null)
+[90mn/a[0m
+
+[36minput.string_no_default[0m (required)
+[90mn/a[0m
+
+[36minput.number_default_zero[0m (0)
+[90mn/a[0m
+
+[36minput.bool_default_false[0m (false)
+[90mn/a[0m
+
+[36minput.list_default_empty[0m ([])
+[90mn/a[0m
+
+[36minput.object_default_empty[0m ({})
+[90mn/a[0m
+
+
+
+[36moutput.unquoted[0m
+[90mIt's unquoted output.[0m
+
+[36moutput.output-2[0m
+[90mIt's output number two.[0m
+
+[36moutput.output-1[0m
+[90mIt's output number one.[0m
+
+[36moutput.output-0.12[0m
+[90mterraform 0.12 only[0m
+
diff --git a/internal/format/testdata/pretty/pretty-HeaderFromFile.golden b/internal/format/testdata/pretty/pretty-HeaderFromTFFile.golden
similarity index 100%
rename from internal/format/testdata/pretty/pretty-HeaderFromFile.golden
rename to internal/format/testdata/pretty/pretty-HeaderFromTFFile.golden
diff --git a/internal/format/testdata/pretty/pretty-HeaderFromTXTFile.golden b/internal/format/testdata/pretty/pretty-HeaderFromTXTFile.golden
new file mode 100644
index 0000000..2ba53ee
--- /dev/null
+++ b/internal/format/testdata/pretty/pretty-HeaderFromTXTFile.golden
@@ -0,0 +1,169 @@
+
+
+[90m# This header comes from a custom Text file
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+[0m
+
+
+
+[36mrequirement.terraform[0m (>= 0.12)
+
+[36mrequirement.aws[0m (>= 2.15.0)
+
+[36mrequirement.random[0m (>= 2.2.0)
+
+
+
+[36mprovider.tls[0m
+
+[36mprovider.aws[0m (>= 2.15.0)
+
+[36mprovider.aws.ident[0m (>= 2.15.0)
+
+[36mprovider.null[0m
+
+
+
+[36minput.unquoted[0m (required)
+[90mn/a[0m
+
+[36minput.bool-3[0m (true)
+[90mn/a[0m
+
+[36minput.bool-2[0m (false)
+[90mIt's bool number two.[0m
+
+[36minput.bool-1[0m (true)
+[90mIt's bool number one.[0m
+
+[36minput.string-3[0m ("")
+[90mn/a[0m
+
+[36minput.string-2[0m (required)
+[90mIt's string number two.[0m
+
+[36minput.string-1[0m ("bar")
+[90mIt's string number one.[0m
+
+[36minput.number-3[0m ("19")
+[90mn/a[0m
+
+[36minput.number-4[0m (15.75)
+[90mn/a[0m
+
+[36minput.number-2[0m (required)
+[90mIt's number number two.[0m
+
+[36minput.number-1[0m (42)
+[90mIt's number number one.[0m
+
+[36minput.map-3[0m ({})
+[90mn/a[0m
+
+[36minput.map-2[0m (required)
+[90mIt's map number two.[0m
+
+[36minput.map-1[0m ({
+ "a": 1,
+ "b": 2,
+ "c": 3
+})
+[90mIt's map number one.[0m
+
+[36minput.list-3[0m ([])
+[90mn/a[0m
+
+[36minput.list-2[0m (required)
+[90mIt's list number two.[0m
+
+[36minput.list-1[0m ([
+ "a",
+ "b",
+ "c"
+])
+[90mIt's list number one.[0m
+
+[36minput.input_with_underscores[0m (required)
+[90mA variable with underscores.[0m
+
+[36minput.input-with-pipe[0m ("v1")
+[90mIt includes v1 | v2 | v3[0m
+
+[36minput.input-with-code-block[0m ([
+ "name rack:location"
+])
+[90mThis is a complicated one. We need a newline.
+And an example in a code block
+```
+default = [
+ "machine rack01:neptune"
+]
+```[0m
+
+[36minput.long_type[0m ({
+ "bar": {
+ "bar": "bar",
+ "foo": "bar"
+ },
+ "buzz": [
+ "fizz",
+ "buzz"
+ ],
+ "fizz": [],
+ "foo": {
+ "bar": "foo",
+ "foo": "foo"
+ },
+ "name": "hello"
+})
+[90mThis description is itself markdown.
+
+It spans over multiple lines.[0m
+
+[36minput.no-escape-default-value[0m ("VALUE_WITH_UNDERSCORE")
+[90mThe description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'.[0m
+
+[36minput.with-url[0m ("")
+[90mThe description contains url. https://www.domain.com/foo/bar_baz.html[0m
+
+[36minput.string_default_empty[0m ("")
+[90mn/a[0m
+
+[36minput.string_default_null[0m (null)
+[90mn/a[0m
+
+[36minput.string_no_default[0m (required)
+[90mn/a[0m
+
+[36minput.number_default_zero[0m (0)
+[90mn/a[0m
+
+[36minput.bool_default_false[0m (false)
+[90mn/a[0m
+
+[36minput.list_default_empty[0m ([])
+[90mn/a[0m
+
+[36minput.object_default_empty[0m ({})
+[90mn/a[0m
+
+
+
+[36moutput.unquoted[0m
+[90mIt's unquoted output.[0m
+
+[36moutput.output-2[0m
+[90mIt's output number two.[0m
+
+[36moutput.output-1[0m
+[90mIt's output number one.[0m
+
+[36moutput.output-0.12[0m
+[90mterraform 0.12 only[0m
+
diff --git a/internal/format/testdata/xml/xml-HeaderFromADOCFile.golden b/internal/format/testdata/xml/xml-HeaderFromADOCFile.golden
new file mode 100644
index 0000000..6d48fbe
--- /dev/null
+++ b/internal/format/testdata/xml/xml-HeaderFromADOCFile.golden
@@ -0,0 +1,294 @@
+