pug - 如何确定 Pugjs (jade) 上的块注释结束?
问题描述
如何在子元素之前使用块注释将元素添加到父元素?我试图这样做,但它给了我两个选择:
1-使子元素成为兄弟元素!我不想
body
main
.main-container#main
// this is a comment will apper on html file
//- this is a comment will not apper on html file
p hello
2-如果我给它2个缩进,子元素将成为块注释的一部分,如果我给它一个缩进它会引发错误!
body
main
.main-container#main
// this is a comment will apper on html file
//- this is a comment will not apper on html file
p hello
解决方案
注释和段落元素都应该与其父元素的子元素处于相同的缩进级别:
body
main#main
.main-container
// this comment will appear in compiled HTML
//- this comment won't appear in compiled HTML
p hello
请注意,注释语法的第一个正斜杠与p
.
推荐阅读
- sql - 如何从Oracle SQL中的多个表中获取记录的最后日期
- json - 类似 Grep 的工具,用于在返回匹配上下文的 JSON 文件中查找匹配项
- reactjs - 异步反应路线和无限循环
- ruby-on-rails - 如何在 Rails 3 中设置 x 框架默认选项
- python - 输出字符串看起来像 Python 中的报纸文章
- matlab - Matlab 事件函数不会停止积分
- javascript - 带有填充、描边和描边宽度的 SVG 形状
- python - 如何使用python将开始和结束标点符号与单词分开?
- angular - 仅在当前 PageSize 上的 Mat-Table 选择?
- spring-boot - 具有动态响应的 Wiremock Standalone