Skip to content

Support Markdown in suite and test/task documentation #5602

Description

@pekkaklarck

Currently suite and test documentation only supports Robot's own custom documentation format. We are planning to add Markdown support to Libdoc in RF 7.5 (#5304) and I believe we should support Markdown also in test and suite documentation. Because Markdown is so ubiquitous, we can also consider making it the default format in the future.

There are some design decisions to be made related to this. I'll cover them in separate comments.

Activity

  1. added this to the v7.5 milestone on Jan 20, 2026
  2. pekkaklarck commented on Jan 20, 2026

    @pekkaklarck
    MemberAuthor

    The first decision to be made is how to specify that documentation is Markdown. It would be easy to just switch from the Robot format to Markdown, but it would also be badly backwards incompatible. Somehow automatically detecting the format would be great, but I don't think that is possible reliably. That basically means that we need to allow configuring the format. This is what I propose we do:

    1. Allow specifying the documentation format on a file level using doc format: Markdown before the first test data section. This is the same syntax we support when specifying localization language (e.g. language: Finnish).
      • This information should be available in the parsing model and added to the execution and result TestSuite objects.
      • TestCase objects can query the doc format from their parent suite.
      • This will also require storing the doc format in XML and JSON outputs.
    2. Consider supporting the doc format: configuration in suite initialization files so that it is applied also to child suites. This would make it easier specify the format to larger suites. Child suites should naturally be able to override the configuration with their own doc format:. If this is done, we probably should make the language: configuration recursive as well, but that requires a separate issue.
    3. Support --doc-format when running tests for specifying the default documentation format. Per-file configuration should have precedence over it.
    4. Support the doc format: configuration also in resource file to allow specifying the documentation format for user keywords without needing --doc-format with Libdoc.

    This is an example how this would look in data:

    doc format: markdown
    
    *** Settings ***
    Documentation    Hello, [Robot](http://robotframework.org)! This is *Markdown*!

    The exact spelling of the doc format marker can still be discussed. Alternatives include doc_format, doc-format, documentation format, etc. I kind of like the shorter version doc format over documentation format because we already use --doc-format and in the code we'd use doc_format to match existing doc. The marker will be case-insensitive and ignoring spaces and possibly also underscores and hyphens can be considered.

  3. pekkaklarck commented on Jan 21, 2026

    @pekkaklarck
    MemberAuthor

    With Libdoc (#5304) we decided to use Python Markdown as the underlying Markdown module and we certainly want to use the same Markdown implementation everywhere with Robot. We nevertheless need to decide should Python Markdown be an optional dependency, mandatory dependency or should we include it in Robot source (i.e. "vendor" it).

    Libdoc could easily have Python Markdown as an optional dependency similarly as it requires docutils if you want to use reStructuredText. I wouldn't like that too much with test and suite documentation, though, and it certainly isn't an option if we want to make Markdown the default documentation format later. We also don't want Robot to have mandatory external dependencies, because it would make installation without an Internet connection harder. We thus probably should vendor Python Markdown, but we don't necessarily need to do that in RF 7.5 yet. Having it as an optional dependency is probably fine initially.

  4. changed the title [-]Support Markdown in suite and test documentatoin[/-] [+]Support Markdown in suite and test/task documentation[/+] on Jan 21, 2026
  5. MarvKler commented on Jan 21, 2026

    @MarvKler
    Contributor

    I am currently working on a mkdocs integration in the new robotframework-testdoc tool - do you think changing the doc format in RF will have any impact or can be even better interpreted in the new testdoc tool ?

  6. pekkaklarck commented on Jan 21, 2026

    @pekkaklarck
    MemberAuthor

    Markdown support in Robot should make Mkdocs integration easier. With the Robot format you probably need to convert the text to HTML and feed that to Mkdocs, but with Markdown you can pass the text to it directly. Mkdocs also Python Markdown internally, so there shouldn't be problems with Markdown dialects either.

  7. pekkaklarck commented on Mar 3, 2026

    @pekkaklarck
    MemberAuthor

    Older issue #2549 has proposed adding HTML support to suite and test documentation and we just got PR #5624 implementing. A problem is that the design now to configure the documentation format discussed in that issues is different to the design discussed here. I believe a file level switch like doc format: HTML is better than prefixing all docs with a marker like *HTML* This is <b>HTML</b>! and thus we should go with the design discussed here. We could consider making it possible to use such a prefix to override the default documentation format, though.

    One point discussed in #2549 that I had missed earlier here is using Set Suite/Test Documentation keywords. I believe the best way to handle them is adding a separate argument like doc_format or just format to these keywords.

  8. added a commit that references this issue on Apr 21, 2026
  9. seto commented on May 12, 2026

    @seto
    Contributor

    Hello @pekkaklarck and all,

    I’d like to take a stab at implementing this and continue my work on Markdown integration started with #5603.

    After studying the codebase, I have a clear picture of what's involved.
    The Language: config mechanism is already a perfect blueprint, my proposed approach is to start by “preparing the ground” for the feature:

    1. statementlexers.py: extend ImplicitCommentLexer.input() with a new branch alongside the existing language one:
    if config == "language":
        self._handle_language(statement, value)
    elif config == "doc format":
        self._handle_doc_format(statement, value)
    1. statements.py: Add a doc_format property to the existing Config class, reusing _get_value():
    @property
    def doc_format(self) -> "str | None":
        return self._get_value("doc format")
    1. parser.py: Extend ConfigParser.visit_Config() to populate a new doc_format attribute on File, mirroring how languages is populated today:
    def visit_Config(self, node: Config):
        if language := node.language:
            self.model.languages.append(language.code)
        if doc_format := node.doc_format:
            self.model.doc_format = doc_format
    1. blocks.py: Add doc_format to File._attributes and constructor, defaulting to ”ROBOT” for backwards compatibility.

    From File the value would then propagate to the running TestSuite model, and eventually to the XML/JSON output, the same path languages already travels.

    For the rendering layer, I'd suggest introducing a thin DocFormatter abstraction (initially a passthrough for ROBOT, stub for MARKDOWN), decoupling the architectural changes from the vendoring decision entirely.

    Does this roadmap align with your vision for RF 7.5?
    Happy to discuss any design concerns before start drafting a PR.

  10. pekkaklarck commented on May 13, 2026

    @pekkaklarck
    MemberAuthor

    Thanks for the offer! I already prototyped this some time ago, but I got distracted by other issues and haven't been able to finish my work. Your plan looks a lot like what I've done, but it was only the beginning and I remember there being some surprises making the final implementation harder than I expected.

    Because I already have a local branch with some working code, I believe it's better that I continue that work and we see could you help once I get the prototype sorted out. i may have time to look at this today evening and can then update the status here.

  11. seto commented on May 13, 2026

    @seto
    Contributor

    Ok, sounds great! I’m glad the roadmap aligns with your prototype. I’m definitely curious about those “surprises”.
    I'll stay tuned for your update, and I'd be happy to take a look and contribute where I can once you have something to share.

  12. modified the milestones: v7.5, v7.6 on Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions