Edit the documentation

Edit the documentation#

This documentation is created with Sphinx. Sphinx uses the reStructuredText (RST) markup format and adds some features like cross-referencing.

In this tutorial we will teach you how to edit the documentation locally on your PC. For that we will use Visual Studio Code with the reStructuredText extension, that will give you a (somewhat) live preview.

Hint

For small changes you can click /suggest edit button in the top right corner. GitHub however will only render the files as plain RST and miss all features that Sphinx adds.

  1. Checkout the eCAL git repository:

    git clone https://github.com/eclipse-ecal/ecal.git
    
  2. Download and install Visual Studio Code on your PC (it is available for Windows, Linux and macOS).

    https://code.visualstudio.com/

  3. Download and install any Python (3.7 and up) and make sure it is added to the PATH

  4. Navigate to the eCAL directory and install the python requirements with pip:

    • Windows:

      pip install wheel esbonio
      pip install -r doc/requirements.txt
      
    • Ubuntu:

      sudo pip3 install -r doc/requirements.txt
      sudo pip3 install esbonio
      

      Tip

      You can use a python venv if you like. Just (later) make sure to launch VS Code from the venv and set your python interpreter to the interpreter from the venv. To check that, press Ctrl + Shift + P, search for Python Interpreter and select the proper one.

  5. Install the VS Code Extensions:

    • Python by Microsoft

    • reStructuredText by LeXStudio Inc.

      VS Code reStructuredText extension
  6. Create the doc/rst/.vscode/settings.json and paste the following code:

    {
        "esbonio.sphinx.buildDir" : "${workspaceFolder}/_build/html",
        "esbonio.sphinx.confDir"  : "${workspaceFolder}",
        "esbonio.sphinx.srcDir"   : "${workspaceFolder}"
    }
    
  7. Open the doc/rst/ directory in VS Code and click on an .rst file of your choice. Make sure that the statusbar displays “Sphinx” (not docutils). If is doesn’t, click on it and select “Sphinx”. Wait for esbonio to finish building.

    VS Code Statusbar with Sphinx and Esbonio

    Important

    The reStructuredText extension may warn you about Syntax highlighting not being available. Install the extenstion and discard any warning it presents you (also check the bell icon in the statusbar).

    It sometimes happens that the extension will not launch, unless you have discarded all warnings.

  8. Click the preview button in the upper right corner. The preview will be updated every time you save the .rst file.

    VS Code Preview buttonVS Code Preview