feat: Parse `coder_metadata` resource `item` as markdown
matifali opened this issue · comments
resource "coder_metadata" "workspace_info" {
count = data.coder_workspace.me.start_count
resource_id = docker_image.deeplearning.id
icon = data.coder_parameter.framework.option[index(data.coder_parameter.framework.option.*.value, data.coder_parameter.framework.value)].icon
item {
key = "Framework"
value = data.coder_parameter.framework.option[index(data.coder_parameter.framework.option.*.value, data.coder_parameter.framework.value)].name
}
item {
key = "NGC Version"
value = local.ngc-version
link = 'https://some-link.com'
}
item {
key = "CPU Cores"
value = data.coder_parameter.cpu.value
}
item {
key = "RAM (GB)"
value = data.coder_parameter.ram.value
}
}
What do you think about this?@bpmct
What if we rendered markdown in the value instead, like we do for parameter descriptions?
That would do the purpose; This is my idea if we can somehow make the values clickable and can open links. Nice idea
As a workaround, an external coder_app
resource can be used.
Got my vote!
@coder/ts how difficult is it to support markdown for rendering values
field?
The difficult part is not the implementation but how to make it looks nice
Can't we simply render the text as markdown? For example
[Google](https://google.com)
Should render as Google
rendering it as markdown is trivial. this took me like 15 minutes. but it's also pretty weird to just have this sort of stuff be possible. 😅
there's also the fact that we currently support "click to copy", which makes a lot less sense when the description is more complex markdown, and interferes with clicking links.
I agree markdown could be pretty complex, the original request was to just be able to create hyperlinks. For example if we show the version of a software then clicking it could open a URL to the changelog.
I think we just need to come up with the right way to describe them. maybe we could restrict these to a subset of markdown somehow? and probably someway to detect whether it's markdown or not so we know whether to make it copyable or not. idk if we expose that in the terraform provider or if we just try to be smart about it.
maybe we could limit it to a super strict subset of markdown that basically only allows a single like and nothing else to keep it extra simple
SGTM, I do not have any other use case in mind. Maybe @bpmct can think of one.
I think a minimal markdown support with the ability to bold and hyperlink text would be enough.