Tagging code exhibits

Last Updated : Jul 11, 2012 |

When you include code in a DITA topic, the way you tag the content depends on the context in which the code is being included.

Commands or text entries in task steps

When you are authoring a task and you are explicitly telling the user what to enter in a step, tag the text/command they enter in userinput and tag any variables in the command with varname. Do not tag the command name or parameter names. In this context, it is important for the variables to be clear as such but the semantics of the other lower-level elements aren’t key to the purpose of the content.

If you need to provide a where statement to define variables that are part of a command:

  • When there is one variable, include the complete where statement in the cmd and tag the variable with varname.

  • When there is more than one variable, include the text where at the end of the cmd. Then provide the definitions of the variable in a ul in an info tag. Tag each variable name with varname.

Command reference topics

When you're authoring a command reference topic, where the purpose of the topic is to define the command and its syntax, then you do use the more detailed semantic elements, like cmdname, parmname, varname because, in this particular context, the more detailed semantics are important to the purpose of the content.

General code samples

When you're presenting a code exhibit in any other context, tag the code with the most semantically appropriate element, like msgblock, codeph, systemoutput, etc. But do not tag the lower-level elements, such as the command names and parameters, because calling out those lower-level elements isn’t key to the purpose in this context.