Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
ubCode 0.38.0 documentation
Light Logo Dark Logo

Start here

  • What is ubCode?
  • Installation
  • Quickstart
  • Your first traced project

Choose your path

  • Requirements & traceability
  • Publish HTML & PDF
  • Sphinx & Sphinx-Needs
  • Engineer with AI agents

How-to guides

  • Trace source code
  • Build variants
  • Write reports
  • Run ubc in CI
  • Use another editor
  • Build an HTML site
  • Build a PDF
    • Page classes at work
  • Migrate from Sphinx-Needs

AI agents

  • AI agents, checked by the engine
  • Pharaoh agentic engineer
    • Quick start
    • Configuring the workflow
    • Reviews and quality analysis
    • Recovering intent from code
    • Changing what is already specified
    • The ubc agent command
    • In VS Code
  • MCP server
  • Chat participant

Writing and configuration

  • Writing content
    • reStructuredText basics
      • The basics in MyST
    • reStructuredText tables
      • Tables in MyST
    • References and links
      • References and links in MyST
    • Roles
      • Roles in MyST
    • Markdown (MyST)
      • MyST core syntax
      • MyST extensions
    • Needs
      • Writing needs
        • Writing needs in MyST
      • Need roles
        • Need roles in MyST
      • Need views
        • Need views in MyST
      • Importing and extending needs
        • Importing and extending needs in MyST
      • Dynamic functions and filters
        • Dynamic functions and filters in MyST
    • Variants
      • Variants in MyST
    • Test reports: the directives
      • Test reports in MyST
    • Traced source code
    • Directives
      • Admonitions
        • Admonitions in MyST
      • Code and includes
        • Code and includes in MyST
      • Images, figures and video
        • Images, figures and video in MyST
      • Version markers
        • Version markers in MyST
      • Glossary, index, confval and envvar
        • Glossary, index, confval and envvar in MyST
      • Structure and layout
        • Structure and layout in MyST
      • Conditional content
        • Conditional content in MyST
      • Page state
        • Page state in MyST
      • Math
        • Math in MyST
      • Todos
        • Todos in MyST
      • Directives in MyST
    • Layout components
      • Layout components in MyST
    • Diagrams
      • Diagrams in MyST
    • Unsupported syntax
    • Differences from a Sphinx build
    • Writing content in MyST
  • Configuration
    • Needs
    • Card designs with [needs.card_layouts]
    • Field links with [needs.string_links]
    • Schema validation
    • Derived fields
    • Deprecated needs options
    • Codelinks (source code tracing)
    • Test reports
    • Intersphinx
    • Link checking
    • Parsing
    • Linting
    • Formatting
    • Server
    • Project, source & scripts
    • HTML site
    • PDF document
    • Workflow
    • Quality Analysis

Reference

  • Feature matrix
  • Command line (ubc)
  • Configuration keys
    • [agent]
    • [build.highlight]
    • [build.html]
    • [build.mermaid]
    • [build.pdf]
    • [build.plantuml]
    • [codelinks]
    • [format_rst]
    • [intersphinx]
    • [linkcheck]
    • [lint]
    • [needs]
    • [needs_json]
    • [parse]
    • [project]
    • [quality]
    • [reports]
    • [rst_lint]
    • [scripts]
    • [server]
    • [source]
    • [test_reports]
    • [variants]
    • [workflow]
  • VS Code
  • MCP tools
  • Diagnostic codes
  • VS Code features
    • Home view
    • Linting
    • RST preview
    • Realtime index
    • Needs filtering
    • Needs graph view
    • Navigation
    • Site Map
    • Commands
    • Diff & impact analysis
    • needs.json view
  • Query language
  • Languages
  • Supported toolchain
  • What works in imported needs

Concepts

  • Key concepts
    • Glossary
  • Maturity levels

ubCode for teams

  • ubCode for teams
  • Request a license
  • Troubleshooting
  • Report an issue

Development

  • Roadmap
  • Changelog
    • 0.38.x
    • 0.37.x
    • 0.36.x
    • 0.35.x
    • 0.34.x
    • 0.33.x
    • 0.32.x
    • 0.31.x
    • 0.30.x
    • 0.29.x
    • 0.28.x
    • 0.27.x
    • 0.26.x
    • 0.25.x
    • 0.24.x
    • 0.23.x
    • 0.22.x
    • 0.21.x
    • 0.20.x
    • 0.19.x
    • 0.18.x
    • 0.17.x
    • 0.16.x
    • 0.15.x
    • 0.14.x
    • 0.13.x
    • 0.12.x
    • 0.11.x
    • 0.10.x
    • 0.9.x
    • 0.8.x
    • 0.7.x
    • 0.6.x
    • 0.5.x
    • 0.4.x
    • 0.3.x
    • 0.2.x
Back to top
View this page
Edit this page

[codelinks]¶

Codelinks configuration (source-code marker extraction).

Guide: Codelinks (source code tracing).

codelinks.local_url_field¶
Type:
string
Default:
"local-url"

Field name for local URL.

codelinks.outdir¶
Type:
string

Optional output directory for standalone use.

codelinks.projects¶
Type:
table of tables
Default:
{}

Per-project configurations keyed by project name.

Each entry: Per-project configuration.

codelinks.projects.<name>.analyse¶
Type:
table

Analysis settings.

codelinks.projects.<name>.analyse.get_multiline_needs¶
Type:
boolean
Default:
false

Whether to extract multi-line needs: a need written across the lines of a comment, from an open line (@need[<markup>] <type>: <title> by default) to a close line (@endneed).

When enabled, the lines of each such block are no longer read for one-line needs or need-id references.

codelinks.projects.<name>.analyse.get_need_id_refs¶
Type:
boolean
Default:
true

Whether to extract need-id references.

codelinks.projects.<name>.analyse.get_oneline_needs¶
Type:
boolean
Default:
true

Whether to extract one-line needs.

codelinks.projects.<name>.analyse.git_root¶
Type:
string

Optional explicit git root (relative to TOML file).

codelinks.projects.<name>.analyse.multiline_needs¶
Type:
table

Multi-line need configuration: the open and close words and the markups a block’s body may declare.

codelinks.projects.<name>.analyse.multiline_needs.default_markup¶
Type:
string
Default:
"rst"

The markup of a block whose open line names none (or an unknown one). Must be a key of markups.

codelinks.projects.<name>.analyse.multiline_needs.end_sequence¶
Type:
string
Default:
"@endneed"

The word that closes a multi-line need, alone on its line.

codelinks.projects.<name>.analyse.multiline_needs.markups¶
Type:
table of strings
Default:
{ md = ".md", rst = ".rst" }

The markups a block may declare (@need[<markup>] ...), each mapped to the need’s doctype (a non-empty suffix). A table given here replaces the default one.

codelinks.projects.<name>.analyse.multiline_needs.start_sequence¶
Type:
string
Default:
"@need"

The word that opens a multi-line need, at the start of a comment line.

codelinks.projects.<name>.analyse.need_id_refs¶
Type:
table
Default:
{ markers = ["@need-ids:"] }

Need-id reference marker configuration.

codelinks.projects.<name>.analyse.need_id_refs.markers¶
Type:
array of strings
Default:
["@need-ids:"]

Marker strings that identify need-id references.

codelinks.projects.<name>.analyse.oneline_comment_style¶
Type:
table

One-line comment style configuration.

codelinks.projects.<name>.analyse.oneline_comment_style.end_sequence¶
Type:
string
Default:
"\n"

Character sequence that ends a one-line marker.

codelinks.projects.<name>.analyse.oneline_comment_style.field_split_char¶
Type:
string
Default:
","

Character used to split fields.

codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields¶
Type:
array of tables

Ordered list of field definitions.

Each entry: A single field definition in the one-line comment style.

codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].default¶
Type:
string or array of strings

Default value applied when the field is omitted from the marker. None means the field is required (no default).

Forms:

  • a string: A string default value.

  • an array of strings: A list-of-strings default value.

codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].name¶
Type:
string

Field name (e.g., “title”, “id”, “type”).

codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].type¶
Type:
string
Default:
"str"

Field type. Defaults to Str if omitted.

Values:

  • "str": A plain string field.

  • "list[str]": A list of strings.

codelinks.projects.<name>.analyse.oneline_comment_style.start_sequence¶
Type:
string
Default:
"@"

Character sequence that starts a one-line marker.

codelinks.projects.<name>.analyse.preprocessor¶
Type:
table

Preprocessor-aware extraction for C/C++ source files.

Configuring this table — even with no keys inside it — switches C/C++ extraction from the default tree-sitter engine to the preprocessor-aware libclang engine, so only markers in active preprocessor branches are extracted.

codelinks.projects.<name>.analyse.preprocessor.compile_commands¶
Type:
string

Path to the compile_commands.json to read compiler flags from. When unset, it is discovered by walking up from each source file, stopping at the project root.

codelinks.projects.<name>.analyse.preprocessor.defines¶
Type:
array of strings
Default:
[]

Fallback preprocessor defines, each NAME or NAME=VALUE, applied as -D. Used for files that no compile_commands.json entry applies to.

codelinks.projects.<name>.analyse.preprocessor.includes¶
Type:
array of strings
Default:
[]

Fallback include directories, applied as -I. Used together with defines for files that no compile_commands.json entry applies to.

codelinks.projects.<name>.analyse.preprocessor.std¶
Type:
string
Default:
"c++17"

The C/C++ standard used for the standalone parse path, e.g. c++17, c++20 or c11; it also selects the language the file is parsed as. Files matched by a compile_commands.json entry use that entry’s own flags instead. Defaults to c++17 when unset.

codelinks.projects.<name>.ref_url_field¶
Type:
string
Default:
"code_url"

Need field that @need-ids: reference markers back-attach their URL to.

When a source file carries a @need-ids: REQ_X marker, the resolved remote/local URL of that marker is written onto the already existing need REQ_X under this field name (default code_url). Point a tests/-scoped project at a different field (e.g. test_url) to keep test-code links separate from implementation-code links.

codelinks.projects.<name>.remote_url_pattern¶
Type:
string

URL pattern for remote links (e.g., GitHub blob URLs).

codelinks.projects.<name>.source_discover¶
Type:
table

Source file discovery settings.

codelinks.projects.<name>.source_discover.comment_type¶
Type:
string

Language/comment type for this project.

Values:

  • "cpp": C++ language.

  • "python": Python language.

  • "rust": Rust language.

  • "csharp": C# language.

  • "yaml": YAML language.

  • "go": Go language.

  • "bash": Bash / POSIX shell.

  • "typescript": TypeScript language.

  • "ts": Alias for typescript, accepted so a configuration written for sphinx-codelinks keeps validating.

codelinks.projects.<name>.source_discover.exclude¶
Type:
array of strings

Glob patterns for files to exclude.

Unset, a TypeScript project (comment_type = "typescript", alias "ts", which discovers JavaScript too) excludes **/node_modules/**, **/dist/**, **/build/**, **/out/** and **/coverage/**; any other project excludes nothing. An explicit list, [] included, replaces that default; it is never merged with it.

codelinks.projects.<name>.source_discover.follow_links¶
Type:
boolean
Default:
false

If true, follow symbolic links when traversing source directories.

codelinks.projects.<name>.source_discover.gitignore¶
Type:
boolean
Default:
true

Whether to respect .gitignore files.

codelinks.projects.<name>.source_discover.include¶
Type:
array of strings
Default:
[]

Glob patterns for files to include.

codelinks.projects.<name>.source_discover.src_dir¶
Type:
string
Default:
"."

Source directory (absolute or relative).

codelinks.remote_url_field¶
Type:
string
Default:
"remote-url"

Field name for remote URL.

codelinks.set_local_url¶
Type:
boolean
Default:
false

Whether to compute local file URLs.

codelinks.set_remote_url¶
Type:
boolean
Default:
false

Whether to compute remote (git) URLs.

Next
[format_rst]
Previous
[build.plantuml]
Copyright © 2026, team useblocks
Made with Sphinx and @pradyunsg's Furo
On this page
  • [codelinks]
    • codelinks.local_url_field
    • codelinks.outdir
    • codelinks.projects
    • codelinks.projects.<name>.analyse
    • codelinks.projects.<name>.analyse.get_multiline_needs
    • codelinks.projects.<name>.analyse.get_need_id_refs
    • codelinks.projects.<name>.analyse.get_oneline_needs
    • codelinks.projects.<name>.analyse.git_root
    • codelinks.projects.<name>.analyse.multiline_needs
    • codelinks.projects.<name>.analyse.multiline_needs.default_markup
    • codelinks.projects.<name>.analyse.multiline_needs.end_sequence
    • codelinks.projects.<name>.analyse.multiline_needs.markups
    • codelinks.projects.<name>.analyse.multiline_needs.start_sequence
    • codelinks.projects.<name>.analyse.need_id_refs
    • codelinks.projects.<name>.analyse.need_id_refs.markers
    • codelinks.projects.<name>.analyse.oneline_comment_style
    • codelinks.projects.<name>.analyse.oneline_comment_style.end_sequence
    • codelinks.projects.<name>.analyse.oneline_comment_style.field_split_char
    • codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields
    • codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].default
    • codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].name
    • codelinks.projects.<name>.analyse.oneline_comment_style.needs_fields[].type
    • codelinks.projects.<name>.analyse.oneline_comment_style.start_sequence
    • codelinks.projects.<name>.analyse.preprocessor
    • codelinks.projects.<name>.analyse.preprocessor.compile_commands
    • codelinks.projects.<name>.analyse.preprocessor.defines
    • codelinks.projects.<name>.analyse.preprocessor.includes
    • codelinks.projects.<name>.analyse.preprocessor.std
    • codelinks.projects.<name>.ref_url_field
    • codelinks.projects.<name>.remote_url_pattern
    • codelinks.projects.<name>.source_discover
    • codelinks.projects.<name>.source_discover.comment_type
    • codelinks.projects.<name>.source_discover.exclude
    • codelinks.projects.<name>.source_discover.follow_links
    • codelinks.projects.<name>.source_discover.gitignore
    • codelinks.projects.<name>.source_discover.include
    • codelinks.projects.<name>.source_discover.src_dir
    • codelinks.remote_url_field
    • codelinks.set_local_url
    • codelinks.set_remote_url