Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: render Markdown in rich parameter descriptions #6098

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

Merged
merged 10 commits into from
Feb 8, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Feb 8, 2023

Fixes: #5931

This PR introduces an option to use Markdown tags in rich parameter descriptions.

CLI will switch to description_plaintext to skip all tags. It uses glow to render the Markdown content as ASCII text.

CLI:
Screenshot 2023-02-08 at 11 39 18

Site:
Screenshot 2023-02-08 at 11 39 24

Template:

data "coder_parameter" "random_string" {
  name        = "Random string"
  icon        = "/icon/aws.png"
  description = <<-EOT
    See the [registry](https://container.registry.blah/namespace) for *options*.
    EOT
  default     = "helloworld"
  mutable     = true
}

@mtojek mtojek self-assigned this Feb 8, 2023
@mtojek mtojek marked this pull request as ready for review February 8, 2023 10:57
@mtojek mtojek requested a review from mafredri February 8, 2023 10:57
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That markdown lib was an nice find! My main concern is the lossiness of the plaintext output, otherwise this looks good. 👍🏻


` + "`There are also code tags!`"

expected := "Provide the machine image See the registry for options. Minion This is bold text. This is bold text. This is italic text. Blockquotes can also be nested. Strikethrough. 1. Lorem ipsum dolor sit amet. 2. Consectetur adipiscing elit. 3. Integer molestie lorem at massa. There are also code tags!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually want the CLI output to be this lossy? For instance:

  • Why do we not keep newlines?
  • Why don't we print links? We could e.g. do something like: See the registry (https://container.registry.blah/namespace) for options.

If newlines are not wanted here, perhaps we could call the field DescriptionCondensed instead of plaintext?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, mate! We can safely leave them.

Screenshot 2023-02-08 at 12 39 59

@mtojek mtojek requested a review from mafredri February 8, 2023 11:42
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely!

@mtojek mtojek merged commit 1dc4778 into coder:main Feb 8, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow template parameter descriptions to be markdown
2 participants