How to use docson widget with Sphinx on ReadTheDocs

社会主义新天地 提交于 2019-12-11 15:28:48

问题


I'm working on the documentation (https://global-coffee-data-standard.readthedocs.io) of my JSON schema (https://raw.githubusercontent.com/andrejellema/GlobalCoffeeDataStandard/master/schema/global-coffee-data-standard.schema.json)

The basics I have working (thanks to a lot of help from this forum) but now I would like to include the docson widget to show my code more beautiful (https://global-coffee-data-standard.readthedocs.io/en/latest/explanation.html#id13)

I've read this page https://threesixtygiving-standard.readthedocs.io/en/latest/_static/docson/README/ and I'm wondering how to install docson locally but more important on ReadTheDocs.

Do I need to run npm i docson localy? If so which files do I commit to my _static folder so ReadTheDocs can work with it as well?
Or can I put some magic in conf.py to let Sphinx handle it?

EDIT
I tried adding the docson files to my _static folder and it seems to work when I add this code to my ReST file:

<script src="_static/docson/js/widget.js" data-schema="https://raw.githubusercontent.com/andrejellema/GlobalCoffeeDataStandard/master/schema/global-unique-id.json"></script>

But only when I add just one docson widget. When I add more I get this error in the console: only one instance of babel-polyfill is allowed. So I'm assuming this is not the correct workflow.

What is the correct workflow to add multiple docson widgets to my page.

来源:https://stackoverflow.com/questions/54706831/how-to-use-docson-widget-with-sphinx-on-readthedocs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!