Search code examples
node.jsexpresspuganglebrackets

Node JS escape angle brackets from description text


I have a problem with my description text which I read in pug HTML template with Express.js and Node.js.

Inside MongoDB, my description does not contain angle bracket on first and last character places, but when I show description text on web page every description text starts and ends with < > Sample: printing value from db #{item.description} the result on web page < some description text >

Why are these brackets shows and how to remove it?


Solution

  • I found a solution for removing angle brackets from start and end of my description text.

    This code results < description > in my pug view file.

       .description-short
        #{item.description}
    

    When I changed to one row line:

    .description-short #{item.description}
    

    Angle brackets disappeared.