hexojs / hexo-renderer-marked

Markdown renderer for Hexo
MIT License
179 stars 94 forks source link

Added filter marked:use for direct access to the marked.use function #273

Closed crycode-de closed 8 months ago

crycode-de commented 8 months ago

Background: The marked-alert extension enables usage of GFM alerts. To use this extension (and maybe some others) the current marked:extensions filter is not enough since it only provides the extensions property but the altert extension also requires walkTokens to be set in marked.use(...).

This PR adds a marked:use filter allowing the usage of the marked.use function in a theme.

Usage example:

const markedAlert = require('marked-alert');

hexo.extend.filter.register('marked:use', function (markedUse) {
  markedUse(markedAlert());
});
coveralls commented 8 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling d192435ffc3820bbe6001c04dc4531bd39932793 on crycode-de:master into 1b0935497529ef4dbf81b5c42abc0a3289c91b2c on hexojs:master.

yoshinorin commented 8 months ago

@crycode-de We released a new version (v6.3.0) which includes this feature. https://www.npmjs.com/package/hexo-renderer-marked/v/6.3.0

Thank you :)