Can't escape characters in pug/jade

18 Views Asked by At

I'm trying to escape special characters in pug/jade but it keeps giving me errors.

I tried !{}, #[] and #[!] but non of these options allow me to use "(" character.

p.
   !{(} Edit !{>} Preferences !{>} Media !{&} 
1

There are 1 best solutions below

1
Sean On BEST ANSWER

If your goal is to have Pug compile to HTML that looks something like this:

<p>(Edit > Preferences > Media & Lorem Ipsum)</p>

You can just write this Pug:

p (Edit > Preferences > Media & Lorem Ipsum)

Or this:

p.
  (Edit > Preferences > Media & Lorem Ipsum)

You shouldn't need to escape special characters in plain text in Pug, unless they're HTML tags.

If the above doesn't work, there's something going on with how Pug is configured, and you'll need to ask a new question and include any error messages.