UNPKG

hexo-tag-plugins

Version:

A number of tag plugins for theme-butterfly

31 lines (24 loc) 895 B
/** * timeline.js | https://volantis.js.org/v3/tag-plugins/#Timeline */ 'use strict'; function postTimeline(args, content) { if (args.length > 0) { return `<div class="timeline"><p class='p h2'>${args}</p>${content}</div>`; } else { return `<div class="timeline">${content}</div>`; } } function postTimenode(args, content) { args = args.join(' ').split(',') var time = args[0] return `<div class="timenode"><div class="meta"><p>${hexo.render.renderSync({text: time, engine: 'markdown'})}</p></div><div class="body">${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}</div></div>`; } // {% timeline %} // ... timenode ... // {% endtimeline %} hexo.extend.tag.register('timeline', postTimeline, {ends: true}); // {% timenode time %} // what happened // {% endtimenode %} hexo.extend.tag.register('timenode', postTimenode, {ends: true});