152 case BlockType::Paragraph:
return u"paragraph"_s;
153 case BlockType::CodeBlock:
return u"code-block"_s;
154 case BlockType::List:
return u"list"_s;
155 case BlockType::ListItem:
return u"list-item"_s;
156 case BlockType::Section:
return u"section"_s;
157 case BlockType::SectionHeading:
return u"section-heading"_s;
158 case BlockType::Note:
return u"note"_s;
159 case BlockType::Warning:
return u"warning"_s;
160 case BlockType::Important:
return u"important"_s;
161 case BlockType::Details:
return u"details"_s;
162 case BlockType::Brief:
return u"brief"_s;
163 case BlockType::Div:
return u"div"_s;
164 case BlockType::Quotation:
return u"quotation"_s;
165 case BlockType::Legalese:
return u"legalese"_s;
166 case BlockType::HorizontalRule:
return u"horizontal-rule"_s;
167 case BlockType::Table:
return u"table"_s;
168 case BlockType::TableRow:
return u"table-row"_s;
169 case BlockType::TableHeaderRow:
return u"table-header-row"_s;
170 case BlockType::TableCell:
return u"table-cell"_s;
171 case BlockType::Raw:
return u"raw"_s;
172 case BlockType::DefinitionList:
return u"definition-list"_s;
173 case BlockType::DefinitionTerm:
return u"definition-term"_s;
174 case BlockType::DefinitionDescription:
return u"definition-description"_s;
252 json[
"type"_L1] = blockTypeId(type);
253 json[
"text"_L1] = plainText();
255 if (!attributes.isEmpty())
256 json[
"attributes"_L1] = attributes;
258 if (!inlineContent.isEmpty()) {
260 for (
const auto &inline_ : inlineContent)
261 arr.append(inline_.toJson());
262 json[
"inlines"_L1] = arr;
267 for (
const auto &child : children)
268 arr.append(child.toJson());
270 if (type == BlockType::Table)
271 json[
"rows"_L1] = arr;
272 else if (type == BlockType::TableRow || type == BlockType::TableHeaderRow)
273 json[
"cells"_L1] = arr;
275 json[
"children"_L1] = arr;
292 if (!inlineContent.isEmpty()) {
293 parts.reserve(inlineContent.size());
294 for (
const auto &inline_ : inlineContent)
295 parts.append(inline_.plainText());
298 if (!children.isEmpty()) {
299 QStringList childParts;
300 for (
const auto &child : children)
301 childParts.append(child.plainText());
302 if (!parts.isEmpty())
303 parts.append(u"\n"_s);
304 parts.append(childParts.join(u"\n"_s));
307 return parts.join(u""_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 content, recursively.
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.