Forked from https://github.com/emallson/hexo-theme-tufte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
590 B
12 lines
590 B
var jsdom = require('jsdom'),
|
|
crypto = require('crypto'),
|
|
util = require('util');
|
|
|
|
hexo.extend.filter.register('after_post_render', function(data) {
|
|
data.content = data.content.replace(/<aside>([^\r]+?)<\/aside>/mg, function(match, content) {
|
|
var id = crypto.createHash('sha256').update(content).digest('hex');
|
|
return util.format('<label for="%s" class="sidenote-number margin-toggle"></label>', id) +
|
|
util.format('<input type="checkbox" class="margin-toggle" id="%s">', id) +
|
|
'<span class="sidenote">' + content + "</span>";
|
|
});
|
|
});
|