šŸ“œ ā¬†ļø ā¬‡ļø

Using asciidoc to document a project

When our freelance team was faced with the task of documenting the project, the following requirements were formulated:


As a result, having studied the existing solutions, I stayed on the AsciiDoc system. This is a utility that converts plain text files (using very simple and intuitive markup) to almost anything (html, docbook, man, etc.). The reasons for choosing AsciiDoc are as follows:
  1. Very simple and intuitive markup language. In fact, looking at a text file with AsciiDoc markup, you do not even immediately guess that this is not just a plain text file, but a ā€œfile with markupā€ - it looks like a regular, neatly structured text file. In fact, before AsciiDoc was discovered, for many years I wrote ordinary text files in about the same style, without any thought to convert them into other formats later! The absence of explicit ā€œmarkupā€ makes it very easy to read and edit text in a regular text editor.
  2. In general, the ā€œcorrectā€ format for technical documentation is DocBook . But write documentation in this format, with pens, with the help of special utilities ... brrr! And AsciiDoc can convert to DocBook format as well. Thus, it is possible to write the main part of the documentation in a simple and convenient AsciiDoc text format, and then convert it to DocBook and ā€œcombā€ using specific DocBook features that are not in AsciiDoc - this should speed up and simplify the writing of documentation many times, even if It must be submitted in the DocBook format.
  3. AsciiDoc can itself convert besides docbook to man and html formats, and if you need something else, you can convert it to any other format from docbook.
  4. The appearance of the generated html is configured via css (however, while the default settings are fine with me).
  5. AsciiDoc is quite small, smart, and at the same time incredibly extensible utility (however, I have not yet had the need to expand it).

Next, I quickly scrolled CGIshka, which, when I called, found inside the project a .txt file with the documentation corresponding to the requested url, converted it using asciidoc to html (with caching the html pages until the original .txt file was changed) and returned the resulting html.

As a result, the system now works as follows:
  1. write regular .txt files in the documentation directory, locally, in your favorite text editor
  2. between the developers these files are scrambled just like the source code of the project (patches or svn)
  3. immediately after editing the text file, you can go to the corresponding url, and see it in html-format (html will be regenerated on the fly and cached until the next change in .txt)
  4. we haven’t done it yet, but in fact, the asciidoc format is not fundamentally different from the markup used on the wiki, so providing an opportunity to edit documentation via the web a la wiki should not be a problem

References:

')

Source: https://habr.com/ru/post/12903/


All Articles