A renderer is used to render content.


hexo.extend.renderer.register(name, output, function(data, options){
// ...
}, sync);
Argument Description
name Input filename extension (lower case, without leading .)
output Output filename extension (lower case, without leading .)
sync Sync mode

Two arguments will be passed into the render function:

Argument Description
data Include two attributes: file path path and file content text. path won’t necessarily exist.
option Options


Async Mode

var stylus = require('stylus');
// Callback
hexo.extend.renderer.register('styl', 'css', function(data, options, callback){
stylus(data.text).set('filename', data.path).render(callback);
// Promise
hexo.extend.renderer.register('styl', 'css', function(data, options){
return new Promise(function(resolve, reject){

Sync Mode

var ejs = require('ejs');
hexo.extend.renderer.register('ejs', 'html', function(data, options){
options.filename = data.path;
return ejs.render(data.text, options);
}, true);