244 Q_ASSERT(inlineContent.isEmpty() || children.isEmpty());
247 json[
"type"_L1] = blockTypeId(type);
248 json[
"text"_L1] = plainText();
250 if (!attributes.isEmpty())
251 json[
"attributes"_L1] = attributes;
253 if (!inlineContent.isEmpty()) {
255 for (
const auto &inline_ : inlineContent)
256 arr.append(inline_.toJson());
257 json[
"inlines"_L1] = arr;
260 if (!children.isEmpty()) {
262 for (
const auto &child : children)
263 arr.append(child.toJson());
264 json[
"children"_L1] = arr;
280 Q_ASSERT(inlineContent.isEmpty() || children.isEmpty());
281 if (!inlineContent.isEmpty()) {
283 parts.reserve(inlineContent.size());
284 for (
const auto &inline_ : inlineContent)
285 parts.append(inline_.plainText());
286 return parts.join(u""_s);
289 if (!children.isEmpty()) {
291 parts.reserve(children.size());
292 for (
const auto &child : children)
293 parts.append(child.plainText());
294 return parts.join(u"\n"_s);
Represents a structural block element in documentation.
QJsonObject toJson() const
Converts the ContentBlock to a QJsonObject for template rendering.
QString plainText() const
Returns the concatenated plain text of this block's inline content or child blocks,...
Represents inline content within a documentation block.
QJsonObject toJson() const
Converts the InlineContent to a QJsonObject for template rendering.
QString plainText() const
Returns the concatenated plain text of this inline element and all its children, recursively.