在液体中的你can逃避他们\'
\"
等等,但您的应用程序可能会逃脱整个序列。而是使用 unicode:
{% assign tags = "4\2019 × 6\2019, 5\2019 × 8\2019, ..., 16\201D × 16\201D × 16\201D, 24\201D × 36\201D, ..., rectangular, 55\201D × 57\201D with lip" | split: ',' %}
以供参考http://www.blooberry.com/indexdot/html/tagpages/entities/genpunctuation2.htm http://www.blooberry.com/indexdot/html/tagpages/entities/genpunctuation2.htm
我通常构建整个模板,然后在最后进行替换:
{% capture escape_to_unicode %}{% assign tags = "4′ × 6′, 5′ × 8′, ..., 16″ × 16″ × 16″, 24″ × 36″, ..., rectangular, 55″ × 57″ with lip" | split: ',' %}{% endcapture %}{{ escape_to_unicode | replace: "‘", \2018 | replace: "’", \2019 | replace: '“', \201C | replace: '”', \201D }}
引导:我非常厌倦人们用印刷意见来回答有关转义字符的问题。现实情况是,在某些情况下,您必须使用“非人类”等同于人类。我的示例通常是在电子邮件 html/css 中,我确信一定还有其他场景。