jsdoc2md / dmd

The default output template for jsdoc2md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement: prevent handlebars from escaping

catesandrew opened this issue · comments

The output is markdown therefore I do not need markdown escaping html characters. When you display the README.md in a browser it doesn't make a difference, but when you look at it as plain text then all those < are very distractive. At the very least add an option to disable the escaping. I also find the gfm tables to be better displayed in a browser but look horrible as plain text in emacs/vim/etc so I switched to list mode and that looks great.

Adding noEscape: true to this block forces the change. Probably best to turn it off for html output and give user option to override.

return handlebars.createCompileStream(
  options.template,
  {
    noEscape: true,
    preventIndent: true,
    data: { options: options },
    strict: false
  }
)

Occurrences where I noticed it were with strongly type Params like Promise.<string>, etc. Thanks

it's escaped to avoid browsers getting confused over values like Array<input>, thinking that's an html input which needs rendering.. there are other examples, e.g.the pipe symbol(|), which needs to be escaped in gfm markdown tables..

true, i could make it optional.. however, i'm working on jsdoc2md v2 as we speak, which has a human-readable terminal output option.. which solves this, so closing.

but thanks for the input!