pulumi/pkg/codegen/docs/templates/utils.tmpl
Justin Van Patten 48a1d3f696
[docgen] Fix horizontal scroll in python resource docs (#6801)
Add line breaks and whitespace to avoid long horizontal scrolls for Python constructor/function arguments. Also, include the new ResourceArgs constructor overload.
2021-04-17 15:33:23 -07:00

19 lines
1.9 KiB
Cheetah

<!-- linkify_param is used to wrap constructor/function params in an anchor tag. -->
{{ define "linkify_param" }}<span class="nx">{{ if ne .Link "" }}<a href="{{ .Link }}">{{ end }}{{ if ne .DisplayName "" }}{{ .DisplayName }}{{ else }}{{ .Name }}{{ end }}{{ if ne .Link "" }}</a>{{ end }}</span>{{ end }}
<!-- linkify_go_param is used to wrap constructor/function params in an anchor tag specifically for go constructors. We are treating this as a snowflake for now. -->
{{ define "linkify_go_param" }}<span class="nx">{{ if ne .Link "" }}<a href="{{ .Link }}">{{ end }}New{{ if ne .DisplayName "" }}{{ .DisplayName }}{{ else }}{{ .Name }}{{ end }}{{ if ne .Link "" }}</a>{{ end }}</span>{{ end }}
<!-- linkify wraps any propertyType instance in an anchor tag. The display name/name is rendered as-is by passing it through the htmlSafe function
to avoid double-encoding html characters, which is typical of properties type names. -->
{{ define "linkify" }}<a href="{{ .Link }}">{{ if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>{{ end }}
<!-- linkify_constructor_args is like linkify, but will display the DescriptionName if it's present -->
{{ define "linkify_constructor_args" }}<a href="{{ .Link }}">{{ if ne .DescriptionName "" }}{{ htmlSafe .DescriptionName }}{{ else if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>{{ end }}
<!-- linkify_wo_style an wraps a propertyType with an anchor tag but retains parent styling. The display name/name is rendered as-is by
passing it through the htmlSafe function
to avoid double-encoding html characters, which is typical of properties type names. -->
{{ define "linkify_wo_style" }}
<a href="{{ .Link }}" style="color: inherit; text-decoration: inherit;">{{ if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>
{{ end }}