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 the Edit on GitHub 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/continental/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 between 3.6 and 3.9 and make sure it is added to the PATH

    Important

    Python 3.10 and up will not work at the moment, as we are still using Sphinx 3.5.

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

    Note

    Python virtual environments are not supported

    • Windows:

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

      sudo pip3 install -r requirements.txt
      sudo pip3 install esbonio
      
  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