hegemonic / catharsis

A JavaScript parser for Google Closure Compiler and JSDoc type expressions.
MIT License
54 stars 14 forks source link

Provide an option to escape non-HTML-safe characters in stringified types #9

Closed hegemonic closed 11 years ago

hegemonic commented 11 years ago

JSDoc needs to be able to stringify bogus type expressions that contain HTML markup, such as:

{
  "type": "TypeApplication",
  "expression": {
    "type": "NameExpression",
    "name": "Array"
  },
  "applications": [
    {
      "type": "NameExpression",
      "name": "<a href=\"FooClass.html\">FooClass</a>"
    }
  ]
}

Without the HTML, that would be stringified as Array.<FooClass>, and I could replace the < with &lt;. With the HTML, though, I need Catharsis to escape the <; otherwise I'll end up escaping the HTML tags as well.