Showdown: anchors and images of subParser are errors when they are specific strings

Created on 5 Jun 2018  路  2Comments  路  Source: showdownjs/showdown

An error occurred

[constructor]()
[__proto__]()

an error is emitted as Uncaught TypeError: url.replace is not a function

Cause:

showdown/src/subParsers/makehtml/anchors.js: L.25~30 
if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
  url = globals.gUrls[linkId];
  if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
    title = globals.gTitles[linkId];
  }
}

When globals.gUrls is Object, globals.gUrls.constructor return functions. for that reason showdown.helper.isUndefined returns false.
At that time url becomes functions.
The result is this.

bug

Most helpful comment

Well caught. We will need to revamp the internals a bit. I believe this happens with other javascript "magic" words.

All 2 comments

Well caught. We will need to revamp the internals a bit. I believe this happens with other javascript "magic" words.

@tivie any news on when this will be solved?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeud picture jeud  路  3Comments

xduseko picture xduseko  路  3Comments

geudrik picture geudrik  路  7Comments

subodhpareek18 picture subodhpareek18  路  5Comments

LeahPike picture LeahPike  路  5Comments