You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, you want to define content that is sometimes included in the build outputs, depending on the output. For example:
As a teacher, you define all of the materials for a lecture. You then want to generate "teacher" and "student" copies of the material, and exclude some content based on which you're outputting.
As a researcher, you define some content that only makes sense to include in an HTML setting (e.g. buttons that link to your social network) and you wish to exclude this in the PDF builds of your MyST document.
It would be helpful if content could be tagged and then MyST builds could filter out content based on that tag (e.g. via a user list of tags, or dependent on build output types, etc).
How this works in Sphinx
In Sphinx, they use the {only} directive for this. You specify build output types via {only} and then {only} is used to filter out content accordingly.
Example:
```{only} html
<div>This is only displayed in HTML!</div>
```
And then sphinx-build -b html would include this, while sphinx-build -b pdf would not.
References
This has been often-discussed and requested in Jupyter Book:
Sometimes, you want to define content that is sometimes included in the build outputs, depending on the output. For example:
It would be helpful if content could be tagged and then MyST builds could filter out content based on that tag (e.g. via a user list of tags, or dependent on build output types, etc).
How this works in Sphinx
In Sphinx, they use the
{only}
directive for this. You specify build output types via{only}
and then{only}
is used to filter out content accordingly.Example:
And then
sphinx-build -b html
would include this, whilesphinx-build -b pdf
would not.References
This has been often-discussed and requested in Jupyter Book:
open
directive for conditional content jupyter-book#1290The text was updated successfully, but these errors were encountered: