Goal
For documentation purposes I would like to export a C++ code snippet from QtCreator as an HTML file and then use CSS to highlight its syntax, for example like that:
Since QtCreator does not have an export option, I am using QDoc
to achieve that.
As per documentation, I use \quotefile
in a qdoc
-file in my project to turn the source code from main.cpp
into an HTML:
/*!
\page index
\quotefile main.cpp
*/
Running qdoc
produces an index.html
and when I open it, there is indeed the marked-up content of main.cpp
.
Note: To demonstrate the issue I am using the code from the documentation:
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
Problem
When I inspect the produced html code in the browser, for the hello(
part for example, I get:
hello(
When I inspect the html code of the documentation however, which I believe is generated with the help of QDoc
as well, for the same part I see:
<span class="pln"> hello</span>
I do not know why in my case the additional markup is missing.
Question
How to setup QDoc so, that I can specify the rules of how each part of the code snippet should be marked up?