Skip to content

[ENHANCEMENT] Support Robot Framework data embedded in Markdown and reStructuredText files (.robot.md, .robot.rst) #651

Description

@d-biehl

Is your enhancement request related to a problem? Please describe.

Robot Framework can run suites and resource files that are embedded in documents: reStructuredText files (.robot.rst, .rst, .rest) for a long time, and since Robot Framework 7.5 also Markdown files (.robot.md suites are parsed by default, Resource file.md / .markdown is a valid import). Only the robotframework code blocks of such files are Robot Framework data, everything else is prose.

RobotCode does not really support these files. reStructuredText was never supported beyond accepting the file extension of a resource import, Markdown is new. What happens today (checked with RF 7.4.2 and 7.5):

  • Editors / language server: only .robot and .resource are Robot Framework documents. A .robot.md or .robot.rst file is a plain Markdown/reST file for VS Code and IntelliJ: no highlighting of the code blocks, no diagnostics, no completion, no navigation, no run/debug code lenses. robotcode analyze code and robotcode discover files skip them as well.
  • Resource imports: Resource keywords.rst is accepted (and keywords.md on RF >= 7.5 once RF 7.5 support lands), but RobotCode tokenizes the whole file text as Robot Framework data instead of extracting the code blocks. For a reST resource this gives a false ResourceEmpty warning on the import and KeywordNotFound for every keyword of that resource. A Markdown resource only works by accident, as long as the fenced block is not indented, and the prose around it ends up in the data.
  • Discovery: robotcode discover tests lists the tests of such suites, because Robot Framework builds the suite, but with wrong line numbers: a test on line 14 of a .robot.md file is reported as lines.robot.md:5. Everything that navigates by this line number goes to the wrong place.
  • Debugger: a breakpoint inside such a suite never hits, the line Robot Framework reports never matches the line in the file.

The wrong line numbers come from Robot Framework itself: it concatenates the code blocks and counts lines relative to them, not to the file. Example (TestSuite.from_file_system(...), RF 7.5; the reST variant behaves the same on RF 7.4.2 and 7.5):

# Suite

Some text.

```robotframework
*** Settings ***
Documentation    Example
```

More text.

```robotframework
*** Test Cases ***
First
    Log    hello
```

First is on line 14 of the file, test.lineno is 5, and output.xml contains <test ... line="5">.

Describe the solution you'd like

Support Robot Framework data embedded in Markdown and reStructuredText files:

  • extract the robotframework code blocks ourselves and keep the positions of the original file, so that diagnostics, semantic highlighting, completion, hover, go to definition and references work inside the code blocks,
  • resource imports of .md, .markdown, .rst and .rest files resolve the keywords and variables of their code blocks,
  • discover, the test explorers of VS Code and IntelliJ, results and the debugger use the real line in the file, which needs a mapping from Robot Framework's block-relative line numbers as long as Robot Framework reports them that way,
  • the editors offer this without taking the Markdown/reST editing experience away for the rest of the document (for example only files named *.robot.md / *.robot.rst become test suites).

Describe alternatives you've considered

  • Documenting these file types as not supported. That is the state today and it is the reason for this issue: until this is implemented they are not supported.
  • Treating the whole file as Robot Framework data (what happens for resource imports today). It produces false diagnostics and cannot work for reST, where the code blocks are indented.

Additional context

  • To decide: report the block-relative line numbers to Robot Framework (https://github.com/robotframework/robotframework/issues). If Robot Framework kept the original line of every code block, the mapping for discovery, results and the debugger would not be necessary and other tools would benefit too. I did not find an existing issue for it there. A reproduction is above.
  • Related: [ENHANCEMENT] Support for RF 6.1 rbt, json, robot.rst, rsrc files  #142 (RF 6.1 file types, the robot.rst/"Rest" items are still open).
  • Design notes exist as OpenSpec change markdown-suites (openspec/changes/markdown-suites/); mapping debugger breakpoints is intentionally a separate step after it.

AI / tooling disclosure

This issue was drafted with Claude Code while working on Robot Framework 7.5 support. The described behaviour was reproduced locally with RF 7.4.2 and 7.5, and I reviewed the text.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions