Skip to main content

Robot Framework LibTOC

What it does

This tool generates docs using Robot Framework Libdoc for an entire folder (or multiple folders) with Robot Framework resources/libs and creates a TOC (table of contents) file for them.

Why use it

The Robot Framework Libdoc tool normally generates a HTML file for a single keyword library or a resource file. If you have several keyword libraries or resources, you just get several separate HTML files.

This tool collects separate keyword documentation files in one place and creates a TOC (table of contents) page with links to these files.
The result is a folder with several static HTML pages which can be placed somewhere in the intranet or uploaded as CI artifact - so everybody can easily access the keywords docs.

Here is the example screenshot

How it works

  • The tool goes through the specified folders with RF resources and it's direct subfolders

  • It looks for the config files named .libtoc which contain items you would like to create docs for:

    1. Paths to resource/lib files in glob format
    2. RF libraries, installed or available in PYTHONPATH using the provided fully qualified name

      Library import params (if necessary) like described in libdoc user guide Other libdoc CLI options (e.g. version or name of the output file) are not supported

    3. Paths to resource/lib files in glob format inside Python packages, loaded from the PYTHONPATH

      See more about bundling RF resources in Python packages in RF User Guide

  • Then it generates the docs using libdoc - both for files paths, resolved from the glob patterns, and for the installed libraries. The created HTML files are placed in the libtoc output_dir - keeping the original subfolder structure of resources

  • Finally it generates a TOC (Table of Contents) HTML page with links to all the generated HTML files. The navigation tree structure in the TOC repeats the folder tree structure.

Example of a .libtoc config file

[paths]
# Use glob patterns
some-resources/**/*.robot
some-resources/**/*.resource
some-resources/**/*.py

[libs]
# Use RF library names with params - like for libdoc
SeleniumLibrary
Remote::http://10.0.0.42:8270
# Import a library from PYTHONPATH using fully qualified name
some-libs.mylib.mypy
# You can use environment variables in lib params
SomeLib::$some_env_var/somepath

[packages]
# Use package name in python path and glob patterns separated by :
some-package:resources/**/*.resource
some-package:libs/**/*.py

The config file must contain at least one of the sections - [paths], [libs], [packages]

How to install it

System requirements

  • Python >=3.7
  • Robot Framework

Installation using pip

pip install robotframework-libtoc

How to use it

  • Create the .libtoc config files in the root of the resources folder and/or in direct subfolders where you need docs to be created.

  • Run libtoc. The last resources_dirs parameter is mandatory, it takes any number of paths. Other params are optional:

    • -d, --output_dir
    • -P, --pythonpath
    • --config_file
    • --toc_file
    • --toc_template
    • --homepage_template
    • --no_timestamp
    • --tree-label

    Examples:

    libtoc example_resources
    libtoc 'example_resources/SUT X' 'example_resources/SUT Y'
    libtoc --output_dir docs example_resources
    libtoc --output_dir docs --toc_file MY_SPECIAL_NAME_FOR_DOCS.html example_resources
    libtoc --toc_template MY_CUSTOM_TOC.html --homepage_template MY_CUSTOM_HOMEPAGE.html example_resources
    libtoc --tree-label "my_folder=My Display Name" --tree-label "my_lib=My Lib Label" example_resources
    
  • Open the created file, e.g. docs/keyword_docs.html

How to change the TOC and the homepage HTML templates

The default HTML template files are located in the python installation directory (usually something like <python_dir>/lib/site-packages/robotframework_libtoc) and can be changed if necessary.
It's also possible to provide custom HTML template files using the --toc_template and --homepage_template options.

How to set the Python Path

There are two ways to extend the list of paths where the libraries are searched for:

  1. Using the --pythonpath option
  2. Set the PYTHONPATH environment variable

See more in Robot Framework User Guide.

How to customize TOC tree item labels

By default the TOC navigation tree uses the original folder, file and library names.
Use --tree-label KEY=VALUE to replace any folder, library or file name (without extension) with a custom display label — without affecting the actual file paths.

The option can be repeated any number of times:

libtoc --tree-label "sut_x=SUT X (Production)" --tree-label "common=Common Keywords" example_resources
  • Only the visible label in the tree is changed. Folder structure and file paths remain untouched.
  • If the item name is found multiple times in the TOC, all occurrences would be replaced.

Metadata

Release files for robotframework-libtoc 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-libtoc 1.7.0
File Size Uploaded
robotframework_libtoc-1.7.0.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-libtoc 1.7.0
File Interpreter ABI Platform
robotframework_libtoc-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.7 kB

Release files / robotframework_libtoc-1.7.0.tar.gz

Download URL robotframework_libtoc-1.7.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a0bba5ba6af1ddca9b13929a62ba8260e42aba9c8bef61b7d7e0f8476fd3f5d0
BLAKE2b-256 checksum
How to use checksums
9042a37aa50ea3915d73d3096c0d121e14df8bfab7b76328dae6efef1c370227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/25.4.0

Release files / robotframework_libtoc-1.7.0-py3-none-any.whl

Download URL robotframework_libtoc-1.7.0-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90060a8556de7ddbe1d0e32777c6a341633de6a57c13892f8d0c6fdae25cf1f3
BLAKE2b-256 checksum
How to use checksums
0eab76fa29ff0a27cc501822f11e08f31795d5d137814777b5f1f84bd23c31b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/25.4.0

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page