Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

markdownify post title in jekyll

It is possible to render Markdown on a post title? For example:

---
title: Foo and _other foo_
---

I want that output

<h1> Foo and <i>other foo</i></h1>
like image 423
HufflepuffBR Avatar asked Jun 21 '26 10:06

HufflepuffBR


1 Answers

Use the markdownify filter to the Liquid tag:

{{ page.title | markdownify }}

Note that this will wrap the output in paragraph tags (<p> ... </p>). If this is not desired (which it probably isn't), you can remove these with Liquid:

{{ page.title | markdownify | remove: '<p>' | remove: '</p>' }}

There have been attempts to fix markdownify to work with titles so that paragraph tag wrapping doesn't happen, but they haven't materialized and so this clumsy solution is what's available for now. If you'd like to work on it your help would be appreciated!

like image 106
Kyle Barbour Avatar answered Jun 24 '26 05:06

Kyle Barbour



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!