node.js Jade/pug 中的评论

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8540720/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:54:20  来源:igfitidea点击:

Comments in Jade/pug

node.jspug

提问by Randomblue

I tried making comments in Jade/pug, but the comments render as text in the HTML. This is my code:

我尝试在 Jade/pug 中发表评论,但评论在 HTML 中呈现为文本。这是我的代码:

doctype html

html(lang='en')
    body
        / This should be a comment

What am I doing something stupid?

我在做什么蠢事?

回答by alessioalex

As written in the comment documentation, you can either use //which will translate to a HTML comment or //-which won't be visible in the outputted HTML code.

正如注释文档中所写,您可以使用//which 将转换为 HTML 注释,或者使用//-which 在输出的 HTML 代码中不可见。

回答by IRSHAD

In jade we use //-for comment. If you are trying to comment a block, make sure it should be indented properly like in below example-

在 jade 中,我们使用//-进行注释。如果您尝试评论一个块,请确保它应正确缩进,如下例所示 -

doctype html

html(lang='en')
    body
        //- 
            This should be a comment
            Indent correctly for block content