2013-05-18 139 views
-2
<snippet> 
    <content> 
     <!doctype html> 
<html> 

<head> 
     <style type = "text/css"> 

     </style> 
</head> 

<body> 
     <script type = "text/javascript"> 

     </script> 
</body> 

</html> 
    </content> 
    <tabTrigger>html_t</tabTrigger> 
    <description>html_css_javascript</description> 
    <scope>html</scope> 
</snippet> 

创建片段时,我将它保存为h.sublime - 摘录,我得到错误“的片段没有内容包/User/h.sublime-snippet”如何在崇高的文本2

回答

3
<snippet> 
    <content><![CDATA[ 
Hello, ${1:this} is a ${2:snippet}. 
]]></content> 
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> 
    <!-- <tabTrigger>hello</tabTrigger> --> 
    <!-- Optional: Set a scope to limit where the snippet will trigger --> 
    <!-- <scope>source.python</scope> --> 
</snippet> 

如果你比较你在这个例子中的代码,你会看到你缺少一些关键组件 - 例如,<![CDATA[那么你的HTML代码,然后]]>

0

这是为了使一个片段(HTML注释)的例子,通过点击c + tab触发:

<snippet> 
    <content><![CDATA <!-- ${1:comment} -->]</content> 
    <!-- Optional: Tab trigger to activate the snippet --> 
    <tabTrigger>c</tabTrigger> 
    <description>Snippet to make fast html comment</description> 
</snippet>