如何确定在PugjsJade上块注释的结尾?

问题描述

如何在子元素之前将元素添加到带有块注释的父元素中? 我尝试这样做,但这给了我两个选择:

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处于同一级别。