Markdown list in YAML front matter not working

Hello,

I have a field “text” in my page front matter with content to be markdownified. I call it with {{ .text | markdownify}} in my template.

It renders correctly paragraph and font weight but for a reason I can’t understand it does not render correctly lists.

For exemple, this:

text : "
#### Hello world

lorem ipsum etc ...

- first item
- second item
- third item
"

Is rendered like this:

I tried several way to write the list but none seems to work. And I cannot find a way to have indented lists

You are removing new lines that should not be removed. See https://yaml-multiline.info.

Example 1

---
title: "Foo"
date: 2020-08-19T04:37:26-04:00
draft: false
text: |
  #### Hello world

  lorem ipsum etc ...

  - first item
  - second item
  - third item
---

Example 2

---
title: "Foo"
date: 2020-08-19T04:37:26-04:00
draft: false
text: "
#### Hello world

lorem ipsum etc ...

- first item

- second item

- third item
"
---
1 Like

Thanks, indeed it works for the list but how we do indented list ? In standard markdown we just have ti add 4 spaces but it does not work:

 - first item
 
 - second item
 
     - sub item
 
     - sub item
 
 - third item

Capture d’écran 2020-08-19 à 11.25.00

1 Like

Leading whitespace within flow scalars is ignored. See https://yaml-multiline.info.

Single-quoted

Leading whitespace on lines is ignored.

Double-quoted

Leading whitespace on lines is ignored.

Plain

Additional leading whitespace is ignored.

You must use a block scalar:

---
title: "Foo"
date: 2020-08-19T04:37:26-04:00
draft: false
text: |
  #### Hello world

  lorem ipsum etc ...

  - first item
  - second item
    - sub item
    - sub item
  - third item
---

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