Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for verbatim inline elements #560

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

utzig
Copy link
Contributor

@utzig utzig commented Jul 30, 2020

This extends the current verbatim rST support with a new option "embed:rst:inline", which can be used to generate an inline node, instead of the paragraph node used by other verbatim blocks.

For a bit of perspective, for the Zephyr project (https://docs.zephyrproject.org/) and for Nordic's nRF Connect SDK (http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html), we use the .. option: directive to create an entry for each existing configuration option in the kernel (and apps, libs, etc). For someone not acquainted this is very similar to configuration options in the Linux kernel (CONFIG_*).

We refer a lot to those options over all the documentation. In rST it is straight-forward to do using:

:option:`CONFIG<some_option_name>`

But in Doxygen headers the only way to get those xrefs working was to use a \verbatim, with the side-effect that it results in a <paragraph \> node, so it cannot be used inline.

This PR allows for one to specify an option by using:

\verbatim :embed:rst:inline :option:`CONFIG_<some_option_name>` \endverbatim

or by using a Doxygen alias:

ALIASES += "option{1}=\verbatim embed:rst:inline :option:`\1` \endverbatim"

just @option{CONFIG_<some_option_name>}.

@utzig utzig force-pushed the inline-verbatim branch 2 times, most recently from 1bd2913 to 68890ca Compare August 31, 2020 13:14
@utzig utzig force-pushed the inline-verbatim branch 2 times, most recently from 853952e to d3f9e12 Compare September 4, 2020 18:51
This extends the current verbatim rST support with a new option
"embed:rst:inline", which can be used to generate an inline node,
instead of the paragraph node used by other verbatim blocks.

Signed-off-by: Fabio Utzig <[email protected]>
@utzig utzig changed the title WIP - Add support for verbatim inline elements Add support for verbatim inline elements Sep 4, 2020
* 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 <[email protected]>
@utzig
Copy link
Contributor Author

utzig commented Sep 4, 2020

@vermeeren I believe this PR is also OK now, I will rebuild the Zephyr Project's documentation using this new feature and if I'll let you know afterwards. Btw, I tried to write some unit tests for this PR, but mocking the docutils statemachine soon turned out be not very reasonable! 🤣

@utzig
Copy link
Contributor Author

utzig commented Sep 5, 2020

@vermeeren I believe this PR is also OK now, I will rebuild the Zephyr Project's documentation using this new feature and if I'll let you know afterwards. Btw, I tried to write some unit tests for this PR, but mocking the docutils statemachine soon turned out be not very reasonable!

Just rebuilt the Zephyr documentation with both this PR and #566 enabled and the results look pretty good!

@vermeeren vermeeren self-requested a review September 10, 2020 17:52
@vermeeren vermeeren self-assigned this Sep 10, 2020
@vermeeren vermeeren added code Source code enhancement Improvements, additions (also cosmetics) labels Sep 10, 2020
Copy link
Collaborator

@vermeeren vermeeren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean patchset, thanks a lot @utzig!

@vermeeren vermeeren merged commit afd4475 into breathe-doc:master Sep 10, 2020
vermeeren added a commit that referenced this pull request Sep 10, 2020
@utzig utzig deleted the inline-verbatim branch September 11, 2020 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Source code enhancement Improvements, additions (also cosmetics)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants