How-to-visualize-docbook-files-in-browser
target audience
This how-to helps people having an existing set of .docbook files who want to see a preview of these files in a browser.
Example: an existing documentation manual has to be updated and the changes must be checked before creating a merge request.
Pre-requisites
- operating system: a Linux distribution or MacOS
- Having a local version of the documentation which needs to be visualized [1]
- Having KDocTools installed[2]. This software is used to:
- check the
.docbookfiles for XML consistency or errors - generate
.htmlfiles out of the.docbookfiles
- check the
You may read the online documentation of KDocTools. It also explains the usage of KDocTools (meinproc6 and checkXML6 commands.)
1) Check .docbook files for XML consistency and errors
Generally, we want to update one single documentation item, i.e. a single .docbook file.
Even if nothing has been changed in the index.docbook file, this is the one we will call in the commands below.
This process checks the technical XML quality within the .docbook files:
- go into the local folder where the manual documentation is stored
- open a terminal
- run this command:
checkXML6 index.docbook
- if the command runs without errors, you are done, there are no XML errors in the files. Else, analyse and fix the errors.
2) Visualize the local .docbook files
The .docbook files must be converted into .html files so that a browser can display them as they will really look like later.
Again, irrespective of the really updated .docbook file, the command needs to target the index.docbook file.
Check the location of KDocTools stylesheets
Depending on the operating system, the KDocTools stylesheets may be stored at different places.
Example for distribution Debian bookworm, the stylesheets are located under:
/usr/share/kf6/kdoctools/customization/:
| Filename |
|---|
| kde-chunk.xsl |
| kde-chunk-common.xsl |
| kde-chunk-online.xsl |
| kde-include-common.xsl |
| kde-include-man.xsl |
| kde-navig.xsl |
| kde-navig-online.xsl |
| kde-nochunk.xsl |
| kde-style.xsl |
| kde-ttlpg.xsl |
| kde-ttlpg-online.xsl |
| kde-web.xsl |
| kde-web-navig.xsl |
Generate the .html files
- go into the local folder where the manual documentation is stored
- open a terminal
- run this command (replace the 6 in
meinproc6by a lower/higher number according to your operating system):meinproc6 --stylesheet /usr/share/kf6/kdoctools/customization/kde-web.xsl index.docbook
- Result: a bunch of
.htmlfiles have been created, one (sometimes more) for each existing.docbookfile. The.htmlfiles are located in the same folder as the.docbookfiles. - open the
index.htmlfile in a browser and navigate to the documentation page you have updated to check its look and feel.
Following tasks
After having tested that all changes are fine, you may create a merge request against the software documentation, supposing it is hosted on KDE Gitlab.
Notes
- ↑ The best way is to make a local clone of the relevant git repository which contains the
.docbookfiles to be edited. You can download the master branch of the software whose user manual you want to update. For this, you may want to set-up your local Gitlab (Wiki instructions):- create a SSH private and public keys.
- update your account on https://invent.kde.org/ with it.
- relate it to the gitlab instance via
ssh -T [email protected]. - if you don’t want to deal with the git command line, you can install one of the many appropriate graphical front ends to manage Gitlab. You can install git-cola for example. In Git-cola,
- Click on "new", choose the directory where you will store all the files of the software you are working on (the one you want to update the documentation manual of)
- in the top menu, use
Branch/Create. - Make sure to select the master branch as start point (1), name your local branch (2) for example :
work/my_KDE_username/...(replace my_KDE_username by your real username) and create the branch (3). - After this, you should see the
/docfolder containing all the.docbookfiles of the software within the directory you created three steps above.
- ↑ Use your distribution’s package manager to install KDocTools6 (example for Debian-based distributions:run the command:
sudo apt install kdoctools6- replace the 6 at the end by a lower/higher number if your distribution packages it)


