内容简介:从
rxjs6.docset 成品下载地址
代码仓库
https://github.com/xinshangshangxin/dash-rxjs-6
原理
从 官方文档 Any HTML Documentation 可知, 只要有 HTML, 就可以轻松构建 Dash 文档
步骤
创建文件夹 <docset name>.docset/Contents/Resources/Documents/
创建 Info.plist 文件 和 icon.png
Info.plist 的模板 在 https://kapeli.com/resources/Info.plist
从 https://rxjs-dev.firebaseapp.com/api 解析有哪些 API
从 Network 中可以 看到 一个 /generated/docs/api/api-list.json 的请求, 里面有每个 API 内容, 如下图
创建 SQLite Index
将上面 api-json 的内容 创建到 SQLite Index
CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);
创建 每个 API 的 html 界面
- 从
api-json的内容中 有path属性, 可以请求每个界面的详细内容(content属性)
- 从
ReactiveX/rxjs的仓库中 发现 用了assets/js/prettify.js来格式化代码, 所以相同的, 在我们创建的 html 界面中需要 prettify 来格式化代码显示, 代码如下
let codeEleList = document.querySelectorAll('body code-example');
[...codeEleList].forEach((ele) => {
let html = window.prettyPrintOne(ele.innerHTML, 'javascript', false);
ele.innerHTML = `<aio-code>
<pre class="prettyprint lang-javascript">
<code class="animated fadeIn">${html}
</code>
</pre>
</aio-code>`;
});
- 由于是离线文档, 所以在 html 中所有的地址都要转化成相对路径, 代码如下
let depth = location.href.replace(/.*\/api\//, '').split('/').length;
let aEleList = document.querySelectorAll('a');
[...aEleList].forEach((ele) => {
let href = ele.href;
if (/\/api\//.test(href)) {
let depthStr = new Array(depth).fill('..').join('/');
let [preUrl, anchor = ''] = href.split('#');
ele.href = preUrl.replace(/.*\/api\//, `${depthStr}/api/`) + '.html' + '#' + anchor;
}
});
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 觅道文档 v0.6.0 发布,在线文档系统
- 一个适合程序员的 Markdown 文档编辑和文档管理方案
- 【微服务】如何优雅的写文档(文档自动化swagger)
- 利用Python3内置文档资源高效学习及官方中文文档
- 什么是 API 文档工具?附带 6 款好用的 API 文档工具介绍
- VirAPI 接口文档导出功能上线,可分享并离线查看接口文档啦!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Design and Analysis of Distributed Algorithms (Wiley Series on P
Nicola Santoro / Wiley-Interscience / 2006-10-27 / USD 140.95
This text is based on a simple and fully reactive computational model that allows for intuitive comprehension and logical designs. The principles and techniques presented can be applied to any distrib......一起来看看 《Design and Analysis of Distributed Algorithms (Wiley Series on P》 这本书的介绍吧!