(function () { var myPlugin = function (hook, vm) { // Invoked one time when the docsify instance has mounted on the DOM hook.mounted(function () { console.log(window.Docsify,vm); }); // hook.beforeEach(function (markdown) { // const tag =" [-FAQ-]"; // console.log(markdown); // let tagPosition = markdown.indexOf(tag); // if(tagPosition===-1) return; // let toc = '> table of content : '+"\n"; // toc += '* Title 1 '+"\n"; // regex = new RegExp(tag,"i"); // markdown = markdown.replace(regex,toc); // return markdown; // }); hook.afterEach(function (html) { const tag ="[-FAQ-]"; let tagPosition = html.indexOf(tag); if(tagPosition===-1) return; let questionBlock = html.substr(tagPosition); let toc = ""; regex = new RegExp(tag,"i"); console.log(toc); html = html.replace("\[\-FAQ\-\]",toc); return html + 'Powered by redok'; }); }; // Add plugin to docsify's plugin array $docsify = $docsify || {}; $docsify.plugins = [].concat($docsify.plugins || [], myPlugin); })();