Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/commands/inlines.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ MrDocs reads the usual Markdown spans, with Doxygen and HTML equivalents alongsi
* xref:commands/reference.adoc#cmd-code-span[Code span]: `+`text`+`.
* xref:commands/reference.adoc#cmd-strikethrough[Strikethrough]: `+~~text~~+`.
* xref:commands/reference.adoc#cmd-highlight[Highlight]: `+==text==+`.
* xref:commands/reference.adoc#cmd-subscript[Subscript]: `+~text~+` or `+<sub>text</sub>+`.
* xref:commands/reference.adoc#cmd-superscript[Superscript]: `+^text^+` or `+<sup>text</sup>+`.

.Text formatting
[source,cpp]
Expand Down
14 changes: 8 additions & 6 deletions docs/modules/ROOT/partials/commands-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@
"<sup>text</sup>"
],
"partial": "commands/superscript.adoc",
"examples": [],
"examples": [
"commands/superscript"
],
"see_also": [
"Subscript"
],
Expand All @@ -692,8 +694,7 @@
"type": "Text",
"description": "The text to raise as superscript."
}
],
"planned": true
]
},
{
"node_type": "SubscriptInline",
Expand All @@ -704,7 +705,9 @@
"<sub>text</sub>"
],
"partial": "commands/subscript.adoc",
"examples": [],
"examples": [
"commands/subscript"
],
"see_also": [
"Superscript"
],
Expand All @@ -715,8 +718,7 @@
"type": "Text",
"description": "The text to lower as subscript."
}
],
"planned": true
]
}
],
"math": [
Expand Down
3 changes: 3 additions & 0 deletions include/mrdocs/Metadata/DocComment/Inline/HighlightInline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct HighlightInline final
: InlineCommonBase<InlineKind::Highlight>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct StrikethroughInline final
: InlineCommonBase<InlineKind::Strikethrough>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
3 changes: 3 additions & 0 deletions include/mrdocs/Metadata/DocComment/Inline/SubscriptInline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct SubscriptInline final
: InlineCommonBase<InlineKind::Subscript>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct SuperscriptInline final
: InlineCommonBase<InlineKind::Superscript>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~{{> @partial-block }}~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^{{> @partial-block }}^
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/em }}{{> doc/inline-container }}{{/ markup/em }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/sub }}{{> doc/inline-container }}{{/ markup/sub }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/sup }}{{> doc/inline-container }}{{/ markup/sup }}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<sub>{{> @partial-block }}</sub>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<sup>{{> @partial-block }}</sup>
30 changes: 30 additions & 0 deletions src/lib/AST/ExtractDocComment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,36 @@ class DocCommentVisitor
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "strong")
{
emplaceInline<doc::StrongInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "mark")
{
emplaceInline<doc::HighlightInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "sub")
{
emplaceInline<doc::SubscriptInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "sup")
{
emplaceInline<doc::SuperscriptInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "del" || comps.tag == "s")
{
emplaceInline<doc::StrikethroughInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else
{
report::warn(
Expand Down
38 changes: 38 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
= Reference
:mrdocs:

[#index]
== Global namespace

=== Functions

[cols="1,4"]
|===
| Name| Description
| link:#f[`f`]
| Exercise the inline markup kinds (HTML and Markdown forms)&colon; subscript, superscript, highlight, strikethrough&period;
|===

[#f]
== f

Exercise the inline markup kinds (HTML and Markdown forms)&colon; subscript, superscript, highlight, strikethrough&period;

=== Synopsis

Declared in `&lt;inline&hyphen;markers&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
f();
----

=== Description

HTML form (works in tight notation)&colon; H~2~O is water&semi; x^2^ is x squared&period; *Bold*, #highlighted#, [.line-through]#struck&hyphen;through#, and [.line-through]#also struck# text&period;

Markdown form (requires whitespace flanks)&colon; Subscript&colon; ~i~ indicates an index&period; Superscript&colon; raise to the ^n^ power&period; Strong&colon; *bold*&period; Highlight&colon; #highlighted#&period; Strikethrough&colon; [.line-through]#struck&hyphen;through#&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
15 changes: 15 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** Exercise the inline markup kinds (HTML and Markdown forms):
subscript, superscript, highlight, strikethrough.

HTML form (works in tight notation):
H<sub>2</sub>O is water; x<sup>2</sup> is x squared.
<strong>Bold</strong>, <mark>highlighted</mark>,
<del>struck-through</del>, and <s>also struck</s> text.

Markdown form (requires whitespace flanks):
Subscript: ~i~ indicates an index. Superscript: raise to the
^n^ power.
Strong: **bold**. Highlight: ==highlighted==.
Strikethrough: ~~struck-through~~.
*/
void f();
48 changes: 48 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<html lang="en">
<head>
<title>Reference</title>
<meta charset="utf-8">
</head>
<body>
<div>
<h1>Reference</h1>
<div class="symbol">
<div class="header">
<h2 id="index">Global namespace</h2>
</div><!-- /header -->
<h3>Functions</h3>
<table style="table-layout: fixed; width: 100%;">
<thead>
<tr><th>Name</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><a href="#f"><code>f</code></a> </td><td>Exercise the inline markup kinds (HTML and Markdown forms): subscript, superscript, highlight, strikethrough.</td></tr>
</tbody>
</table>

</div><!-- /symbol -->
<div class="symbol">
<div class="header">
<h2 id="f">f</h2>
<div class="brief">
<p>Exercise the inline markup kinds (HTML and Markdown forms): subscript, superscript, highlight, strikethrough.</p></div><!-- /brief -->
</div><!-- /header -->
<div class="synopsis">
<h3>Synopsis</h3>
<p>Declared in <code>&lt;inline-markers.cpp&gt;</code></p>
<pre><code class="source-code cpp">void
f();</code></pre>
</div><!-- /synopsis -->
<div class="description">
<h3>Description</h3>
<p>HTML form (works in tight notation): H<sub>2</sub>O is water; x<sup>2</sup> is x squared. <strong>Bold</strong>, <mark>highlighted</mark>, <del>struck-through</del>, and <del>also struck</del> text.</p>
<p>Markdown form (requires whitespace flanks): Subscript: <sub>i</sub> indicates an index. Superscript: raise to the <sup>n</sup> power. Strong: <strong>bold</strong>. Highlight: <mark>highlighted</mark>. Strikethrough: <del>struck-through</del>.</p>
</div><!-- /description -->
</div><!-- /symbol -->

</div>
<footer class="mrdocs-footer">
<span>Created with <a href="https://www.mrdocs.com">MrDocs</a></span>
</footer>
</body>
</html>
Loading
Loading