Skip to content

Commit

Permalink
Add verbatim inline documentation and examples
Browse files Browse the repository at this point in the history
* Update rst.h example with a function that includes an inline
  rST cpp domain link to another function using a verbatim
* Update markups.rst with an inline verbatim section
* Add Doxygen ALIAS to for an inline verbatim element

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
  • Loading branch information
utzig committed Aug 31, 2020
1 parent 14631f8 commit 68890ca
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions breathe/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
GENERATE_XML = YES
ALIASES = "rst=\verbatim embed:rst"
ALIASES += "endrst=\endverbatim"
ALIASES += "inlinerst=\verbatim embed:rst:inline"
{extra}
""".strip()

Expand Down
32 changes: 32 additions & 0 deletions documentation/source/markups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@ This will appropriately handle the leading slashes and render as:

----

Inline rST
~~~~~~~~~~

.. cpp:namespace:: @ex_markups_inline

Normal verbatim elements result in block elements. But sometimes you'll want
to generate rST references where they need to be rendered inline with the text.
For example::

/// Some kind of method
///
/// @param something a parameter
/// @returns the same value provided in something param
///
/// @verbatim embed:rst:inline some inline text @endverbatim

For these kinds of references, you can use an **embed:rst:inline** tag as
shown in the above example.

This will appropriately handle the leading slashes and render as:

----

.. doxygenfunction:: TestClass::rawInlineVerbatim
:project: rst

.. doxygenfunction:: TestClass::rawVerbatim
:project: rst
:outline:

----

Aliases
~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions examples/specific/rst.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ GENERATE_XML = YES

ALIASES = "rst=\verbatim embed:rst"
ALIASES += "endrst=\endverbatim"
ALIASES += "inlinerst=\verbatim embed:rst:inline"
8 changes: 7 additions & 1 deletion examples/specific/rst.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestClass
This is some funky non-XML compliant text: <& !><
.. note::
This reStructuredText has been handled correctly.
\endrst
Expand Down Expand Up @@ -67,6 +67,12 @@ class TestClass
//////////////////////////////////////////////////////////////
virtual void rawLeadingSlashesVerbatim(int something) const = 0;

/*!
Inserting an inline reStructuredText snippet.
Linking to another function: \inlinerst :cpp:func:`TestClass::rawVerbatim` \endrst
*/
virtual void rawInlineVerbatim() const = 0;

//! Brief description
virtual void testFunction() const {};
};

0 comments on commit 68890ca

Please sign in to comment.