Skip to content

Example TF file is not rendered in index.md with custom template #191

Closed
@arxeiss

Description

@arxeiss

I have file examples/provider/provider.tf and I run tfplugindocs generate. It works great and in file docs/index.md I see the content of provider.tf file.

However, when I create custom index template in file templates/index.md.tmpl with following content, it does not work. I see just path to the file instead of content of the file.

Just to be clear, content of my template is the same as the default one here https://github.com/hashicorp/terraform-plugin-docs/blob/main/internal/provider/template.go#L246 so it is not issue with my template. Especially because it works well for resources.md.tmpl and data-sources.md.tmpl

Source codes

---
page_title: "{{.ProviderShortName}} Provider"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines "  " }}
---

# {{.ProviderShortName}} Provider

{{ .Description | trimspace }}

{{ if .HasExample -}}
## Example Usage

{{ printf "{{tffile %q}}" .ExampleFile }}
{{- end }}

{{ .SchemaMarkdown | trimspace }}
<!-- ... not printing everything, affected part -->

## Example Usage

{{tffile "examples/provider/provider.tf"}}

<!-- ... continue with schema -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions