Files
terraform-docs/format/doc.go
Khosrow Moossavi d2fe2b1b29 Move print package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-09-28 15:04:07 -04:00

59 lines
1.5 KiB
Go

/*
Copyright 2021 The terraform-docs Authors.
Licensed under the MIT license (the "License"); you may not
use this file except in compliance with the License.
You may obtain a copy of the License at the LICENSE file in
the root directory of this source tree.
*/
// Package format provides different, out of the box supported, output format types.
//
// Usage
//
// A specific format can be instantiated either for `format.New()` function or
// directly calling its function (e.g. `NewMarkdownTable`, etc)
//
// config := print.DefaultConfig()
// config.Formatter = "markdown table"
//
// formatter, err := format.New(config)
// if err != nil {
// return err
// }
//
// err := formatter.Generate(tfmodule)
// if err != nil {
// return err
// }
//
//
// output, err := formatter.ExecuteTemplate("")
// if err != nil {
// return err
// }
//
// Note: if you don't intend to provide additional template for the generated
// content, or the target format doesn't provide templating (e.g. json, yaml,
// xml, or toml) you can use `Content()` function instead of `ExecuteTemplate()`.
// `Content()` returns all the sections combined with predefined order.
//
// output := formatter.Content()
//
// Supported formats are:
//
// • `NewAsciidocDocument`
// • `NewAsciidocTable`
// • `NewJSON`
// • `NewMarkdownDocument`
// • `NewMarkdownTable`
// • `NewPretty`
// • `NewTfvarsHCL`
// • `NewTfvarsJSON`
// • `NewTOML`
// • `NewXML`
// • `NewYAML`
//
package format