sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Set conditional tags for use during inclusion

Open nedbat opened this issue 4 months ago • 2 comments

I would like to have a common file that will be included in multiple places in my docs. I want to be able to use .. only:: directives in that common file, and have tags set differently by different .. include: directives so that the content is customize for each place it is included.

For example (with invented :tags: syntax):

.. common.rst

This is for everyone

.. only:: red

    Hello red team!

.. only:: blue

    Hello blue team!
Red team
========

This is for red team.

.. include:: common.rst
   :tags: red

nedbat avatar Oct 15 '24 10:10 nedbat