The introduction

As a developer, checking documents has become a daily necessity. However, because the knowledge and tools used are different, almost every time we need to re-open the documents on the official website for search, and we also need to switch browser labels to browse the documents of different knowledge and tools, which is very inconvenient. Further, in our work, some accounts, passwords and some small knowledge points used in daily life, if summarized, may only be put in Word or TXT, it is not convenient to consult.

Is there a tool that makes it easy to access documents and store everything that you use on a daily basis? Let’s take a look at Zeal as an offline document tool.

Introduction of Zeal

Zeal is a free offline documentation software that makes it easy for developers to access API documentation. Currently available for Windows, MAC and Linux, the software has over 200 documents, covering almost all the libraries, frameworks and languages used in program development, making it a very useful software.

Zeal website

Zeal to download

Once the download is complete, there are no documents on the screen because you need to download the documents (the format of the document in Zeal is called Docsets). Click Docsets or Tools -> Docsets on the home page and select the document you want to download. After downloading, you can see the document you need.

In addition to downloading the Docsets on the Zeal website, you can Add them via the Add Feed. We need to open the Docsets we need, copy the XML address into the Add Feed, and then we can download the corresponding Docsets.

Once you have downloaded the Docsets you need, you can use offline documents for your daily work. In daily use, the following points need to be paid attention to:

  • Zeal works by opening HTML pages, so it acts like a browser. Make it a habit to close documents periodically
  • Zeal allows you to set up a shortcut to open it, and when you do that you can quickly open Zeal and look up the document
  • The upper left corner of Zeal has a search function, preceded by “Document name: Content” to search for the specified document

Zeal creates its own document project

After the above steps, the documentation system can serve our daily development well, but in addition to downloading the common API documentation, can we write our own documentation?

Zeal officially writes a document that tells us how to write our own Docsets, but it is simple and complicated without detailed instructions.

After experimenting, the Docsets of Zeal are actually collections of HTML, so we can use the documentation tool to generate some static HTML documents. Then through the official Docsets provided by the Docsets generator to generate HTML Docsets, so that we can generate our own Docsets.

Suitable document generator

There are document generators in various development languages. Node.js generators that I’m familiar with include dozens like Gitbook, Docsify, Vuepress, and so on. Not all of them are suitable for making Docsets, for example:

Docsify is a great generator, but it can be problematic with Docsets. The reason is that Docsify is implemented by reading Markdown with JS and Zeal is a browser with no static server inside, so Docsets can have cross-domain issues.

I ended up using Gitbook to make Docsets, which generate static Html files that can be opened locally with double click and blend nicely with Zeal.

Written document

Gitbook: NPM install Gitbook -cli -g

Then, create the project using Gitbook: Gitbook init

Once created, you should see the following directory structure:

School exercises ── Class exercises ── Class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ class exercises ─ Class exercises ─ Class exercises ─ Class exercises ─ Class exercises ─ Class exercises README.mdCopy the code

Once created, you can see what the document looks like by running the gitbook serve command:

The next step is for each developer to write their own Markdown file and modify summary.md to suit their needs. Since documents are offline, there is no need to worry about others stealing them. You can categorize your account passwords, code snippets, and commonly used information.

When you’re done, generate the HTML file with the command gitbook build. You’ll see a _book directory with all your HTML files in it, and the document will be written.

Generate Docsets from HTML

Once you have the HTML for the document, you need to generate the Docsets from the HTML. I used node.js for generation and found a plugin called docset-Generator on NPM. The corresponding Docsets can be generated with the following code:

let DocSetGenerator = require("docset-generator").DocSetGenerator;
let docSetGenerator = new DocSetGenerator({
  destination: "./output/",
  name: "Season",
  documentation: "./personal-doc/_book",
  icon: './icon.png', entries: [// entries can be set to a category of Docsets, usually a category corresponding to a HTML {name:"Personal Data".type: "Guide",
      path: "./index.html"},... ] }); docSetGenerator.create();Copy the code

Here I combine Gitbook and docset-generator into a project using the npm-run-all plugin, which calls Gitbook to generate HTML and then generates Docsets:

."scripts": {
  "start": "gitbook build ./personal-doc && node index.js"},...Copy the code

Once you’ve generated it, you’ll have a folder with xxx. docsets. The final step is to put this folder inside Zeal.

Inside Zeal there is a folder called Docsets. If you go inside, you’ll see that all the docsets you’ve downloaded are in there. Put the docsets you’ve just generated in there, and if you restart Zeal, you’ll see the document that Zeal has.

conclusion

The above is my work in the process, according to their own development habits to make a small document, if you have other convenient tools, you can discuss it together, there is any problem welcome harassment ~