Skip to content

error with marked + highlight.js #787

Closed
@stla

Description

@stla

Hello,
Following this post.

$ node marked_test.js  > xx.txt
/home/stla/Github/temp/node_modules/marked/lib/marked.js:1227
    throw e;
    ^

TypeError: src.replace is not a function
Please report this to https://github.com/chjj/marked.
    at Lexer.lex (/home/stla/Github/temp/node_modules/marked/lib/marked.js:138:6)
    at Function.Lexer.lex (/home/stla/Github/temp/node_modules/marked/lib/marked.js:129:16)
    at marked (/home/stla/Github/temp/node_modules/marked/lib/marked.js:1219:31)
    at Object.<anonymous> (/home/stla/Github/temp/marked_test.js:14:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)

Node version:

$ node -v
v4.5.0

Source file:

var fs     = require('fs');
var hljs   = require('highlight.js');
var marked = require('marked');

var markdownString = fs.readFileSync('./node_modules/marked/README.md');

marked.setOptions({
  highlight: function (code) {
    return hljs.highlightAuto(code).value;
  }
});

var output = marked(markdownString);

console.log(output);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions