File tree Expand file tree Collapse file tree 8 files changed +62
-46
lines changed
reference/restructuredtext
packages/guides-restructured-text/src/RestructuredText/TextRoles Expand file tree Collapse file tree 8 files changed +62
-46
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -10,6 +10,19 @@ You can also :doc:`add your own custom text roles </extension/text-roles>`.
10
10
11
11
Currently the following text roles are implemented:
12
12
13
+ .. phpdoc :class-list :: [?(@.interfacesIncludingInherited contains "\phpDocumentor\Guides\RestructuredText\TextRoles\TextRole")]
14
+
15
+ .. phpdoc :name ::
16
+ :title: true
17
+ :level: 2
18
+
19
+ .. phpdoc :summary ::
20
+ .. phpdoc :description ::
21
+
22
+
23
+ Examples
24
+ ========
25
+
13
26
:ref: `Reference somewhere <basic-text-role >`
14
27
15
28
:doc: `Reference to document </extension/text-roles >`
Original file line number Diff line number Diff line change 21
21
use function preg_match ;
22
22
use function trim ;
23
23
24
+ /**
25
+ * Role to create an abbreviation.
26
+ *
27
+ * Example:
28
+ *
29
+ * ```rest
30
+ * :abbreviation:`term (some term definition)`
31
+ * ```
32
+ */
24
33
final class AbbreviationTextRole extends BaseTextRole
25
34
{
26
35
protected string $ name = 'abbreviation ' ;
Original file line number Diff line number Diff line change 17
17
use phpDocumentor \Guides \Nodes \Inline \DocReferenceNode ;
18
18
use phpDocumentor \Guides \RestructuredText \Parser \Interlink \InterlinkParser ;
19
19
20
+ /**
21
+ * Role to create a reference to a document.
22
+ *
23
+ * Example:
24
+ *
25
+ * ```rest
26
+ * :doc:`doc/index`
27
+ * ```
28
+ */
20
29
final class DocReferenceTextRole extends AbstractReferenceTextRole
21
30
{
22
31
final public const NAME = 'doc ' ;
Original file line number Diff line number Diff line change 15
15
16
16
use phpDocumentor \Guides \Nodes \SectionNode ;
17
17
18
+ /**
19
+ * Role to create references to link targets.
20
+ *
21
+ * Example:
22
+ *
23
+ * ```rest
24
+ * :ref:`label`
25
+ * ```
26
+ */
18
27
final class GenericLinkProvider
19
28
{
20
29
/** @var array<string, string> */
Original file line number Diff line number Diff line change 16
16
use phpDocumentor \Guides \Nodes \Inline \GenericTextRoleInlineNode ;
17
17
use phpDocumentor \Guides \RestructuredText \Parser \DocumentParserContext ;
18
18
19
+ /**
20
+ * Role to create a literal block.
21
+ *
22
+ * A literal block is a block of text that is displayed as-is, without any formatting.
23
+ *
24
+ * Example:
25
+ *
26
+ * ```rest
27
+ * :literal:`code`
28
+ * ```
29
+ */
19
30
final class LiteralTextRole extends BaseTextRole
20
31
{
21
32
protected string $ name = 'literal ' ;
Original file line number Diff line number Diff line change 16
16
use phpDocumentor \Guides \Nodes \Inline \GenericTextRoleInlineNode ;
17
17
use phpDocumentor \Guides \RestructuredText \Parser \DocumentParserContext ;
18
18
19
+ /**
20
+ * Role to create a math block.
21
+ *
22
+ * A math block is a block of text that is displayed as-is, without any formatting.
23
+ *
24
+ * Example:
25
+ *
26
+ * ```rest
27
+ * :math:`code`
28
+ * ```
29
+ */
19
30
final class MathTextRole extends BaseTextRole
20
31
{
21
32
protected string $ name = 'math ' ;
Original file line number Diff line number Diff line change 16
16
use phpDocumentor \Guides \Nodes \Inline \GenericTextRoleInlineNode ;
17
17
use phpDocumentor \Guides \RestructuredText \Parser \DocumentParserContext ;
18
18
19
- /**
20
- * This text role is extended by custom text roles that do not feature a base text role:
21
- *
22
- * ```
23
- * .. role:: custom
24
- * :class: special
25
- *
26
- * :custom:`interpreted text`
27
- *
28
- * ```
29
- */
30
19
final class SpanTextRole extends BaseTextRole
31
20
{
32
21
protected string $ name = 'span ' ;
You can’t perform that action at this time.
0 commit comments