You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Markdown in suite and test/task documentation #5602
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.
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:
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.
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.
Support --doc-format when running tests for specifying the default documentation format. Per-file configuration should have precedence over it.
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.
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.
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 ?
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.
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.
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:
statementlexers.py: extend ImplicitCommentLexer.input() with a new branch alongside the existing language one:
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.
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.
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.
Activity
pekkaklarck commentedon Jan 20, 2026
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:
doc format: Markdownbefore the first test data section. This is the same syntax we support when specifying localization language (e.g.language: Finnish).TestSuiteobjects.TestCaseobjects can query the doc format from their parent suite.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 owndoc format:. If this is done, we probably should make thelanguage:configuration recursive as well, but that requires a separate issue.--doc-formatwhen running tests for specifying the default documentation format. Per-file configuration should have precedence over it.doc format:configuration also in resource file to allow specifying the documentation format for user keywords without needing--doc-formatwith Libdoc.This is an example how this would look in data:
The exact spelling of the
doc formatmarker can still be discussed. Alternatives includedoc_format,doc-format,documentation format, etc. I kind of like the shorter versiondoc formatoverdocumentation formatbecause we already use--doc-formatand in the code we'd usedoc_formatto match existingdoc. The marker will be case-insensitive and ignoring spaces and possibly also underscores and hyphens can be considered.pekkaklarck commentedon Jan 21, 2026
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
docutilsif 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.[-]Support Markdown in suite and test documentatoin[/-][+]Support Markdown in suite and test/task documentation[/+]MarvKler commentedon Jan 21, 2026
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 ?
pekkaklarck commentedon Jan 21, 2026
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.
pekkaklarck commentedon Mar 3, 2026
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: HTMLis 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 Documentationkeywords. I believe the best way to handle them is adding a separate argument likedoc_formator justformatto these keywords.Refactor
seto commentedon May 12, 2026
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:
ImplicitCommentLexer.input()with a new branch alongside the existing language one:doc_formatproperty to the existingConfigclass, reusing_get_value():ConfigParser.visit_Config()to populate a newdoc_formatattribute onFile, mirroring how languages is populated today:doc_formattoFile._attributesand constructor, defaulting to”ROBOT”for backwards compatibility.From
Filethe 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
DocFormatterabstraction (initially a passthrough forROBOT, stub forMARKDOWN), 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.
pekkaklarck commentedon May 13, 2026
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.
seto commentedon May 13, 2026
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.