June 2013
Intermediate to advanced
236 pages
4h 33m
English
We have seen that HTML in variables is escaped by using escaped interpolation constructs != or !{}. How about escaping the Jade interpolation constructs =, !=, #{}, and !{}?
Jade interpolation constructs can be escaped with the combination of backslash (\) and the = HTML entity:
|
Jade |
Rendered HTML |
|---|---|
|
p = message
|
= message
|
|
p != message
|
!= message
|
|
p \#{message}
|
#{message}
|
|
p \!{message}
|
!{message}
|
|
p \\#{message}
|
\#{message}
|
|
p \\!{message}
|
\!{message}
|
Using the = HTML entity code makes Jade render = in the browser, rather than interpret it as the Jade interpolation construct.
# and ! are escaped using the popular escape character, backslash (\). If you intend to use \ as a literal, you will need to escape ...
Read now
Unlock full access