Chapter 4. Writing Documentation: Procedures and Tools

If you're worried about having to learn a lot of new tools and procedures in order to write documentation, you don't need to, because the information we've covered so far is everything you need to know to be able to contribute. Although we do have some tools we use and procedures we follow, it's not vital that everyone knows them in detail, especially when starting out.

For example, all KDE documentation is written in DocBook XML, but we're very happy to receive documentation written in plain text. There are people on the documentation team who are very familiar with DocBook, and can easily add the markup if the content is there.

Another example: if you are starting to document an application from scratch, you don't need to get the sources of the current documentation. But if you are starting from existing documentation, you don't need to know about how to get the sources, there are other means to do that.

Of course, if you want to learn about DocBook, you can. After a little practice, you will probably find that it's not as hard as it looks. And if you learn about dealing with a Git repository, you will be able to integrate yourself to the regular Git development process (upload your changes, work together with other developers, etc.)

Getting the Documentation Sources

Note

If you are starting your document from scratch, you probably do not need to read this section, and may start working right now.

You are welcome to use plain text to contribute to KDE documentation. It is a great way to start, and we strongly encourage it. If you will miss the power of the DocBook format as you improve your documentation skills, then you can learn it. In the mean time, someone will manually edit the plain text to add the DocBook markup and commit it to KDE Git repository, removing the burden of doing most of the more complex stuff covered in this very guide. We'll take a look at writing in DocBook and using Git later in this document, so if you're interested, read on, but if you want to use plain text, you can go directly to the section called “Working with plain text sources”.

Documentation for KDE, like the rest of the source code, is kept in Git repositories. Git provides a way for many developers to work on the same source code (or in our case, the same documentation), and has many useful features to help with this. For example, previous versions of every file are saved so that any mistakes can be quickly backed out, if they can't be easily corrected.

The basic principle behind <span class="application">Git is simple: one server stores a definitive copy of the files making up a project. This is known as the repository. Each developer can clone the repository to work on the code. Using Git, the developers can upload their modifications to the main repository (a process called "committing") or update their own clone to reflect recent changes made by others.

There are two main ways edit the contents of a KDE document you want to improve: using plain text or DocBook.

Working with plain text sources

The docs.kde.org website displays most of the KDE documentation in HTML format, updated weekly from the Git repository. There are two versions available in the website: the stable version based on kdelibs 4 or Frameworks 5 and the development versions based on kdelibs 4 or Frameworks 5. You will always use the latest version of the documentation.

The docs.kde.org website presents a quick and easy method of retrieving the latest version of the KDE documentation. Clicking the name of the application you want to document in the list will open the documentation in your web browser. Simply copy the text from the website to your favorite text editor, edit it , and submit the results in plain text to the KDE Documentation mailing list, . Please note that not all KDE applications are listed there. If you cannot find the documentation of the application you want to work with, then you can request it by sending a message to the KDE Documentation mailing list.

Retrieving the DocBook sources

The latest DocBook sources are located inside the Git repositories. Now you need to find and retrieve them.

To access the repository, you can use the git command line application or browse the KDE repositories.

The site is a web based representation of all Git repositories. It is easy to download files using theProjects page, the operating system or desktop you use does not matter.

Retrieving your own working copy of the repository has many advantages. You will be able to use your working copy to create files containing the changes you made, to update your copy with changes made by other documenters, and if you get a KDE contributor account, to upload your changes directly to the repository. But this is out of the scope of this section. Here we will show you simply how to retrieve the sources using Git the easiest way we can.

Procedure 4.1. Retrieving documentation sources using WebSVN

  1. Go to Projects page using your favorite web browser. Let's suppose you are looking for Lokalize's documentation sources.

  2. Search for lokalize on this page and click on tree to display the repository.

  3. Now click on doc and all Lokalize's documentation files will be displayed, being images or DocBook files.

  4. Now you reached the list of files that are part of Lokalize's documentation, including images and DocBook sources. The DocBook sources are files in the format *.docbook. In this case, there is only one file file in this format: index.docbook. Click this file on the list and the content of that file will be displayed.

  5. . It is the most recent one. Save the file. Repeat this process with all the files you want to download.

We use Lokalize's documentation sources as example in the following procedures.

Procedure 4.2. Retrieving documentation sources using Git

  1. Check if you have the Git client installed (hint: enter git in the terminal screen). If not, install the Git package using the tools provided by your distribution.

  2. Now it is time to download, or clone the sources. Using Git, type in the terminal:

    git clone git://anongit.kde.org/lokalize.git