Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated highlight example in README #22

Open
fkling opened this issue Aug 13, 2015 · 0 comments
Open

Outdated highlight example in README #22

fkling opened this issue Aug 13, 2015 · 0 comments

Comments

@fkling
Copy link

fkling commented Aug 13, 2015

The README says that this should be possible:

// Synchronous highlighting with highlight.js
kramed.setOptions({
  highlight: function (code) {
    return require('highlight.js').highlightAuto(code).value;
  }
});

console.log(kramed(markdownString));

but it's not (anymore).

As far as I can tell, the default Renderer instance doesn't get the updated options passed in any way. I'm currently using

var options = {
  renderer: new kramed.Renderer({
    highlight: code => hljs.highlightAuto(code).value,
  }),
};

console.log(kramed(markdownString, options));

Not sure whether the README version is still supposed to work or not, but it seems that I have to explicitly create a Renderer instance if I want to pass options to it (seems inconvenient), and pass it to kramed instead of calling setOptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant