Marked: src.replace is not a function

Created on 24 Dec 2015  路  4Comments  路  Source: markedjs/marked

I am getting this error when I try to use this library:

TypeError: src.replace is not a function
Please report this to https://github.com/chjj/marked.
at Lexer.lex (/Volumes/External/projects/BuildCMS/node_modules/marked/lib/marked.js:138:6)
at Function.Lexer.lex (/Volumes/External/projects/BuildCMS/node_modules/marked/lib/marked.js:129:16)
at marked (/Volumes/External/projects/BuildCMS/node_modules/marked/lib/marked.js:1218:31)
at figurePage (/Volumes/External/projects/BuildCMS/nodePress.js:227:12)
at processPage (/Volumes/External/projects/BuildCMS/nodePress.js:160:23)
at page (/Volumes/External/projects/BuildCMS/nodePress.js:135:9)
at /Volumes/External/projects/BuildCMS/nodePress.js:110:16
at Layer.handle as handle_request
at next (/Volumes/External/projects/BuildCMS/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Volumes/External/projects/BuildCMS/node_modules/express/lib/router/route.js:112:3)

Most helpful comment

It might be that you are not passing an string trough but an object or array.

All 4 comments

It might be that you are not passing an string trough but an object or array.

^ Most likely this.

682

I have this same error. I'm using firebase with polymerfire. If i bind a firebase document to data then bind <marked-element id="el" markdown="[[data]]"> I'll get several of these errors.

I got around that by setting up this observer:

observers: [
  '_dataChanged(data, data.*)'
],

_dataChanged: function(data) {
  if (typeof data === "string") {
    this.$.el.markdown = data;
  }
}

That works fine but it would be nice if marked.js handled this check for me so i could just bind onto my data and go.

Solved @joshbruce

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amejiarosario picture amejiarosario  路  3Comments

UziTech picture UziTech  路  4Comments

elennaro picture elennaro  路  4Comments

gclove picture gclove  路  4Comments

FireflyAndStars picture FireflyAndStars  路  3Comments