Преглед на файлове

Merge branch 'feature-zjy' of uskycloud/usky-dev-doc into master

zhaojinyu преди 4 дни
родител
ревизия
62f78ac0fc
променени са 1 файла, в които са добавени 61 реда и са изтрити 0 реда
  1. 61 0
      技术分享/gitbook服务部署及添加插件文档.md

+ 61 - 0
技术分享/gitbook服务部署及添加插件文档.md

@@ -148,6 +148,67 @@ docker logs usky-book
 
 
 
+
+
+出现警告解决方法
+warn: "options" property is deprecated, use config.get(key) instead
+原因是tbfed-pagefooter 插件使用了旧的 this.options.pluginsConfig 方式来访问配置项,GitBook 的新版本建议使用 this.config.get(key) 来替代旧的 this.options.pluginsConfig
+修改代码以解决警告
+你可以手动修改插件代码,将其更新为使用 this.config.get(key)
+插件的代码文件通常位于 node_modules/       
+我们这里找到 node_modules/gitbook-plugin-tbfed-pagefooter/index.js并修改为如下代码
+
+var moment = require('moment');
+module.exports = {
+  book: {
+    assets: './assets',
+    css: [
+      'footer.css'
+    ],
+  },
+  hooks: {
+    'page:before': function(page) {
+      var _label = 'File Modify: ',
+          _format = 'YYYY-MM-DD HH:mm:ss',
+          _copy = 'powered by Gitbook';
+
+      // 使用 this.config.get(key) 替代 this.options.pluginsConfig
+      var pluginsConfig = this.config.get('pluginsConfig');
+      if (pluginsConfig && pluginsConfig['tbfed-pagefooter']) {
+        _label = pluginsConfig['tbfed-pagefooter']['modify_label'] || _label;
+        _format = pluginsConfig['tbfed-pagefooter']['modify_format'] || _format;
+
+        var _c = pluginsConfig['tbfed-pagefooter']['copyright'];
+        _copy = _c ? _c + ' all right reserved,' + _copy : _copy;
+      }
+
+      var _copy = '<span class="copyright">' + _copy + '</span>';
+      var str = ' \n\n<footer class="page-footer">' + _copy +
+        '<span class="footer-modification">' +
+        _label +
+        '\n{{file.mtime | date("' + _format +
+        '")}}\n</span></footer>';
+
+      page.content = page.content + str;
+      return page;
+    }
+  },
+  filters: {
+    date: function(d, format) {
+      return moment(d).format(format);
+    }
+  }
+};
+
+
+
+
+
+
+
+
+
+
 插件描述如下
 
 渲染图表