Matth
August 19, 2020, 8:04am
1
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
Matth
August 19, 2020, 9:25am
3
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
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
---
system
Closed
April 20, 2023, 1:42pm
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.