Rendering of string using markdownify not working

When I create the following code in a MD content file in Hugo

Lorem ipsum dolor sit amet, consectetur adipiscing elit:
- Cras condimentum vestibulum accumsan.
- Duis nibh mauris, fringilla in sapien at, rutrum condimentum est.
- Sed porttitor urna metus, a efficitur justo volutpat sit amet

I get the intended result when the site is rendered

Lorem ipsum dolor sit amet, consectetur adipiscing elit:

  • Cras condimentum vestibulum accumsan.
  • Duis nibh mauris, fringilla in sapien at, rutrum condimentum est.
  • Sed porttitor urna metus, a efficitur justo volutpat sit amet

But I need to store some piece of content in the parameters of the MD file (YAML syntax). So I thought I would use

myvar : "Lorem ipsum dolor sit amet, consectetur adipiscing elit:
- Cras condimentum vestibulum accumsan.
- Duis nibh mauris, fringilla in sapien at, rutrum condimentum est.
- Sed porttitor urna metus, a efficitur justo volutpat sit amet"

But when putting {{ .Params.myvar | markdownify }}, I get

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vitae maximus ipsum: - Cras condimentum vestibulum accumsan. - Duis nibh mauris, fringilla in sapien at, rutrum condimentum est. - Sed porttitor urna metus, a efficitur justo volutpat sit amet

I am obviously missing something with the rendering process, but I am stuck. I tried with single / double quotes, I tried using $.Page.RenderString instead of markdownify, but no luck.

Hugo v0.97.2 - No specific Goldmark parameters defined in config.

Anyone has a clue? Thanks in advance!

See https://yaml-multiline.info

---
title: 'Test'
date: 2022-11-03T10:41:51-07:00
draft: false
myvar: |
  Lorem ipsum dolor sit amet, consectetur adipiscing elit:
  - Cras condimentum vestibulum accumsan.
  - Duis nibh mauris, fringilla in sapien at, rutrum condimentum est.
  - Sed porttitor urna metus, a efficitur justo volutpat sit amet
---
1 Like

Thanks!

Just in case someone pass by and see the solution, I want to underline the importance of indentation with a block scalar.

This works:

myvar: |
  Lorem ipsum dolor sit amet, consectetur adipiscing elit:

This (no indentation) can cause an error. It did for me, as I had a : char in the string. And it tooks me a while to figure it out.

myvar: |
Lorem ipsum dolor sit amet, consectetur adipiscing elit:

It can be easy to mess up when your content is in a sub sub parameters or a list like it was for me.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.