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

Support for rendering methods overrides #11

Closed
pepelsbey opened this Issue Dec 31, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@pepelsbey

pepelsbey commented Dec 31, 2014

Since it’s already supported by Marked, it would be great to be able to override renderers right from Docpad’s config. It’s also partially supported by docpad-plugin-robotskirt. Something like this:

plugins: {
marked: {
  markedRenderer: {
    heading: function (text, level) {
      var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
      return '<h' + level + '>' +
        text + ' <a name="' +
        escapedText +
        '" class="anchor" href="#' +
        escapedText +
        '"><span class="header-link"># </span></a></h' + level + '>';
    }
  }
},

Copied from StackOverflow question full of additional details.

There’s even a fork with all needed features applied, so it’s just a matter of checking if everything is correct and filing a pull request.

/cc @vladikoff @varya

@npatmaja

This comment has been minimized.

npatmaja commented Jan 11, 2015

@pepelsbey I've created a fork based on the links you mentioned above. You can try it by pointing your docpad-plugin-marked to the branch in your package.json:

"dependencies": {
    "docpad-plugin-marked": "git+ssh://git@github.com:npatmaja/docpad-plugin-marked.git#support-marked-renderer"
  }

And to define a custom renderer, put the definition in the docpadConfig inside the docpad.coffee file.

docpadConfig:
  plugins:
    marked:
      markedRenderer:
        heading: (text, level) ->
          "<h#{level}>#{text}</h#{level}>"

Please let me know your opinion.

@varya

This comment has been minimized.

Contributor

varya commented Jan 12, 2015

I've created a PR into marked #12
Looks like it responds your needs. If so, vote for it :-)

@kizu

This comment has been minimized.

Contributor

kizu commented Feb 9, 2015

#12 was merged, and released as v2.3.0. Thanks, everyone :)

@kizu kizu closed this Feb 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment