Quick Start

../_images/local_link.gif

Three steps to quickly run CodeLinks to achieve the above:

  • Configure Sphinx

  • Apply One-line comment for a Sphinx-Needs need item

  • Use src-trace directive

Sphinx Config

conf.py
extensions = [
    'sphinx_needs',
    'sphinx_codelinks'
]
src_trace_config_from_toml = "src_trace.toml"
src_trace.toml
[src_trace.projects.src]
src_dir = "../tests/doc_test/minimum_config"
remote_url_pattern = "https://github.com/useblocks/sphinx-codelinks/blob/{commit}/{path}#L{line}"

One-line comment

dummy_src.cpp
#include <iostream>

// @ title here, IMPL_1, impl
void singleLineExample()
{
    std::cout << "Single-line comment example" << std::endl;
}

Directive

index.rst
.. src-trace:: dummy src
   :project: src

Example

Src-Trace: dummy src ST_670E3
project: src
Implementation: title here IMPL_1

Note

local-url is not working on the website as it only supports local browse

Section Directive provides more adavanced usage.