Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape < and > in YAML/Jekyll?

I'm trying to escape the characters < and >, e.g. in:

description: "some file <x> bla bla"

Note: x should be generated literally. The generated HTML code always generates a <li> and/or <ul>, because of the < and >, which clearly should not happen.

What I tried is:

  • Using " (like above)
  • Using '
  • using escape characters like \
  • using unicode form like \x..
like image 568
Michel Keijzers Avatar asked Jan 20 '26 04:01

Michel Keijzers


1 Answers

HTML escaping should do the trick:

description: "some file &lt;x&gt; bla bla"
like image 174
Mureinik Avatar answered Jan 21 '26 22:01

Mureinik