Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Generation with version v0.19.0 removes links and bulletpoints #355

Closed
1 task done
lechnerc77 opened this issue Apr 16, 2024 · 4 comments · Fixed by #358
Closed
1 task done

[BUG] Generation with version v0.19.0 removes links and bulletpoints #355

lechnerc77 opened this issue Apr 16, 2024 · 4 comments · Fixed by #358
Labels
bug Something isn't working

Comments

@lechnerc77
Copy link

Terraform CLI and terraform-plugin-docs Versions

Terraform version: 1.7.3
terraform-plugin-docs: 0.19.0

Provider Code

The resource template:
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines "  " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

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

{{tffile .ExampleFile}}
{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{ if .HasImport -}}
## Import

Import is supported using the following syntax:

{{tffile .ImportFile}}
{{- end }}

Expected Behavior

With the update from version 0.18.0 to 0.19.0 there are no changes in the generated markdown

Actual Behavior

The markdown gets reformated (bullet points are removed without proper spacing) as well as links are removed

Steps to Reproduce

  1. tfplugindocs generate --rendered-provider-name "SAP BTP"

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Here some screenshots that highlight the mismatch between the versions:

  • The template that is used
    Screenshot 2024-04-16 081035

  • The schema of the resource with the desscriptions
    Screenshot 2024-04-16 081138

  • The Git diff between version 0.18.0 and 0.19.0
    Screenshot 2024-04-16 080712

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Serpentiel
Copy link

We also face this problem in aiven/terraform-provider-aiven#1694. There is also another problem that we have. I'll create a new issue for it, too.

@SBGoods
Copy link
Contributor

SBGoods commented Apr 16, 2024

Hi @lechnerc77,
I'm sorry that you are running into trouble here. This seems to be related to PR #332 which refactored the implementation of the plainmarkdown function. The purpose of the plainmarkdown function is to strip out markdown elements to render the input as plain text, primarily for the YAML frontmatter. It looks like the previous implementation still kept some markdown formatting elements such as links and bulletpoints but removed others like headers.

Currently, the Terraform public registry doesn't ingress the description field of the YAML frontmatter and so how you would want it to be formatted is up to you. If you want to keep the markdown formatting, you can remove the plainmarkdown function from your template to something like:
{{ .Description | trimspace | prefixlines " " }} and it should render to something similar to what you had before or you can keep the plainmardown function to render the description as plain text.

Either way, if you are only using the plainmarkdown function for the description field of the YAML frontmatter, this should not affect how your documentation is rendered in the Terraform public registry.

@lechnerc77
Copy link
Author

Hi @SBGoods ,

thanks for your quick support and your explanation. Then I will regenerate the documentation with the latest version. As the description field is anyway not of relevance as of today, The look of the content is okay for me. Maybe we have to adjust the layout then at some later point in time if the Terraform registry considers that part of the markdown.

Maybe it would be worth to add this change in PR #332 to the release notes of 0.19.0 to avoid questions like mine.

From my perspective this issue can be closed then.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants