Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将来自GitHub的代码作为代码块包含在GitBook中_Javascript_Github_Gitbook - Fatal编程技术网

Javascript 将来自GitHub的代码作为代码块包含在GitBook中

Javascript 将来自GitHub的代码作为代码块包含在GitBook中,javascript,github,gitbook,Javascript,Github,Gitbook,如何在GitBook中显示这样的原始代码 https://raw.githubusercontent.com/luyongxu/SignalPlot/master/Code/1.016%20Asset%20Bubbles.R 我认为这与: 但是我不知道如何在主文档中调用JavaScript函数。只需在GitBook中添加一个book.json文件即可。将此粘贴到其中: { "plugins": ["github-embed"] } 现在只需在您的页面中添加以下内容: {% githu

如何在GitBook中显示这样的原始代码

https://raw.githubusercontent.com/luyongxu/SignalPlot/master/Code/1.016%20Asset%20Bubbles.R
我认为这与:
但是我不知道如何在主文档中调用JavaScript函数。

只需在GitBook中添加一个
book.json
文件即可。将此粘贴到其中:

{
    "plugins": ["github-embed"]
}
现在只需在您的页面中添加以下内容:

{% github_embed "https://github.com/v5analytics/gitbook-plugin-github-embed/blob/1cd16ac/index.js#L3-L8" %}{% endgithub_embed %}
就这么简单

注意:我已经让它在本地运行(使用
gitbook安装
gitbook服务
),但它在GitBooks上对我不起作用,所以我已经提交了一个问题并进行了修改

(证明它在本地工作)

代表gitbook插件github embed为其不推荐的代码道歉

谢谢大家!!我尝试了这个(在Mac上使用GitBook编辑器),但什么也没有出现。在控制台中,它说:“错误:HTML和模板标记在文档模式下还不受支持。”我想我只需要等到它完全开发出来。我也尝试过JavaScript插件(如菜单等),但大多数插件在Safari、Firefox、Chrome等浏览器上都无法正常工作。