pulumi/pkg/codegen/docs/templates
Justin Van Patten 7162491d0b
[docsgen] Fix rendering of deprecated messages and text in description lists (#13773)
A change was made a while back to remove the use of shortcodes. As part
of that, the shortcode used to render markdown was replaced by a
function call that used goldmark to render markdown. The resulting HTML
from that wraps the text in paragraph tags.

This causes some problems for rendering the docs. For deprecations, the
deprecation message now shows up outside of the "Deprecated" box. This
happens because the rendered markdown was being wrapped in `<p></p>`
tags, leading to `<p class="resource-deprecated">Deprecated:
<p>message</p></p>`, which does not render correctly because paragraph
tags cannot be nested.

Also, in description lists, rendered markdown text was being wrapped in
paragraph tags (e.g. `<dd><p>text</p></dd>`), causing it to render
differently from text not wrapped in paragraph tags (e.g.
`<dd>text</dd>`).

This change addresses these issues.

- First, `<div class="resource-deprecated">` is used rather than `<p>`
to contain the deprecation information.

- Second, the `markdownify` function will now trim unnecessary paragraph
tags.

Fixes https://github.com/pulumi/pulumi-hugo/issues/2832
Fixes https://github.com/pulumi/registry/issues/3008

---

## Before

<img width="713" alt="Screen Shot 2023-08-24 at 5 21 44 PM"
src="https://github.com/pulumi/pulumi/assets/710598/1358cc74-dd8a-4bc0-bed8-603b1439b2aa">

## After

<img width="721" alt="Screen Shot 2023-08-24 at 5 21 58 PM"
src="https://github.com/pulumi/pulumi/assets/710598/ad501e68-1bac-486c-a723-7db2b3442c8a">

## Before

<img width="719" alt="Screen Shot 2023-08-24 at 5 22 28 PM"
src="https://github.com/pulumi/pulumi/assets/710598/6ca40b85-9008-429b-83c3-2f0d681752f3">

## After

<img width="714" alt="Screen Shot 2023-08-24 at 5 24 02 PM"
src="https://github.com/pulumi/pulumi/assets/710598/eec1dacf-8c24-470e-b1e3-da843b4aeaee">
2023-08-26 17:36:28 +00:00
..
constructor_args.tmpl Remove leading and trailing whitespace in resource properties (#6959) 2021-05-04 17:59:30 -07:00
constructor_params.tmpl Extend API doc generation 2022-05-04 10:00:53 +02:00
enums.tmpl Replace Hugo shortcodes (#9491) 2022-04-29 15:04:15 -07:00
examples.tmpl Extend API doc generation 2022-05-04 10:00:53 +02:00
function.tmpl [docsgen] Fix rendering of deprecated messages and text in description lists (#13773) 2023-08-26 17:36:28 +00:00
header.tmpl [codegen/docs] Update API docs templates to include layout front-matter param (#8242) 2021-10-17 22:36:31 -07:00
index.tmpl [codegen/docs] Update API docs templates to include layout front-matter param (#8242) 2021-10-17 22:36:31 -07:00
index_categories.tmpl remove icons 2023-06-09 14:13:11 -04:00
package_details.tmpl update package details template 2023-01-12 14:11:03 -08:00
properties.tmpl Pass through resource replacement in the schema (#9603) 2022-05-17 13:59:47 -07:00
read_inputs.tmpl Update the resource-docs templates 2020-03-30 14:38:29 -07:00
resource.tmpl [docsgen] Fix rendering of deprecated messages and text in description lists (#13773) 2023-08-26 17:36:28 +00:00
utils.tmpl Add data attribute tag for swifttype to resource property element (#9226) 2022-03-21 10:36:04 -07:00
yaml_constructor.tmpl Extend API doc generation 2022-05-04 10:00:53 +02:00