[Markdown] Break page into separate pieces

Hi,

Because of reasons* i want to be able to break a content page into separate parts. I usually do this by splitting page.content with a separator string.

Up until a few versions ago i was using ~~~~~ or ===== to do so. However building the latest Zola seems that these chars now open a code block. Unfortunately i can’t date when the problem appeared as the last time i built my site the project was still called Gutenberg :wink:

Is this a regression or a feature? Is there a better editor-friendly character sequence i should use to replace it that i’m sure is not going to be markdownified at some point? ^^

Thanks!

*I think it’s very editor-friendly to have header/footer content defined in an actual page (instead of an HTML template they could break). Dividing the page into separate parts can allow to build clever multi-column layouts, among many other things

The latest version has updated the markdown parser to be CommonMark compliant.
In CommonMark, ~~~ is a way to start a code block and === a header.

You can use any characters not used in CommonMark: $, £, €, %, |, ?, !, @ etc. In short avoid =, ~, backticks, -, +, #, *, _ and you should be fine

Thanks for the answer!

Upon testing again, i figured ===== works as intended if i leave blank lines around, which sounds fair to me given that other symbols you suggested don’t really visually suggest horizontal lines breaking the content page.

1 Like

Hey sorry I found the docs semi-confusing– how did you use the page breaks to construct multi-column layouts?

jk I got it

if anyone comes looking here you are gonna want to split the page content into two global variables like so:
{% set_global page_split = page.content | split(pat="======") %}
{% set_global column_one = page_split.0 %}
{% set_global column_two = page_split.1 %}

and then use them in your page like:
{{ column_one | safe }}
{{ column_two | safe }}

wherever you want them to be

For future reference, Commonmark support thematic breaks that get translated to an ‘hr’ HTML element.

We can summon a thematic break with three or more consecutive stars (*), dashes (-) or underscores (_). Like so:

part1
---
part2

Then you can split by hr element (with closing ’ />’) as per the spec :slight_smile: