问题描述
我正在远离 Dreamweaver ()(我知道它很糟糕,但是确实有用),用于将电子邮件开发为VS Code.Dreamweaver提供的一个便捷功能是自定义代码段的使用.VS Code也提供了自定义代码段,但它与 Dreamweaver片段,据我所知,它需要付出更多的努力.以下是VS代码中发生的情况.
I'm in the process of moving away from Dreamweaver (I know its terrible but it has it uses) for email development to VS Code. One handy feature Dreamweaver offered was the use of custom snippets. VS Code offers custom snippets too but it works differently to Dreamweaver snippets and requires a little more hard work from what I can see. Below is what is happening in VS Code.
VS Code自定义代码段
{
"Preheader": {
"prefix": "preheader",
"body": [
"<span style="display:none !important; mso-hide: all; color:#FEE4DC; max-height: 0px; overflow: hidden;">text goes here</span>"
],
"description": "preheader for email"
}
}
结果
<span style=
预期结果
<span style="display:none !important; mso-hide: all; color:#FEE4DC; max-height: 0px; overflow: hidden;">text goes here</span>
看来我必须做一些转义才能获得预期的结果?这有点平凡,因为我在电子邮件开发过程中可能会有大量的代码:(
It seems I have to do some escaping to get the expected result? This would be a little mundane as I could have massive lines of code in my email development process :(
我是否在VS Code中使用正确的功能来创建客户片段?或使用功能不正确.
Am I using the correct feature in VS Code to create customer snippets? or am using the feature incorrectly.
推荐答案
这只是您的引号,请尝试:
It is just your quotes, try:
"<span style='display:none !important; mso-hide: all; color:#FEE4DC; max-height: 0px; overflow: hidden;'>text goes here</span>"
请注意双引号和单引号的交替.同样,您似乎也无法以另一种方式使用它(外部的单引号=否).
Note the alternation of double and single quotes. Also it doesn't seem as if you can have it the other way around (single quotes around the outside = no).
或者,如果您想在html中使用双引号,则可以这样对内部引号进行转义:
Or, if you want double quotes in your html, you can escape the internal quotes like so:
"<span style=\"display:none !important; mso-hide: all; color:#FEE4DC; max-height: 0px; overflow: hidden;\">text goes here</span>"
这篇关于在VS Code中创建自定义HTML代码段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!