Code blocks present commands, scripts, filenames and paths, code, and similar information in a structured, readable format. They're a standard convention in software documentation. Commvault documentation offers a valuable innovation in this documentation standard: interactive code blocks.
Important
-
Carefully review any code before you run it, whether it's from an interactive or static code block.
-
When you refresh a page after changing placeholders in an interactive code block, all changed placeholders revert to their default values.
Interactive code blocks
Interactive code blocks make placeholders easy to identify—and to customize for your environment—without even leaving the documentation page. In addition, interactive code blocks use visual cues and behaviors that show you how placeholders are updated.
Practical Example
db2 update db cfg for $[Primary_Database_Name] using TRACKMOD on
db2 update db cfg for $[Primary_Database_Name] using LOGARCHMETH1 "'VENDOR:$[Software_installation_location]/Base/libDb2Sbt.so'"
db2 update db cfg for $[Primary_Database_Name] using LOGARCHOPT1 "'CvClientName=$[Cluster Server Name],CvInstanceName=$[Instance001]'"
db2 update db cfg for $[Primary_Database_Name] using VENDOROPT "'CvClientName=$[Cluster Server Name],CvInstanceName=$[Instance001]'"
db2 update db cfg for $[Primary_Database_Name] using LOGINDEXBUILD on
db2 update db cfg for $[Primary_Database_Name] using INDEXREC RESTART
Conceptual Example
Late at night, $[user] logged into $[server] after hearing whispers of $[threat].
Inside the logs, $[user] checked $[database] to confirm that $[action] was ready.
With one command, $[user] launched $[action] on $[database] through $[server].
The console replied: $[database] was safe, $[trait] as ever, and $[user] could rest.
By morning, $[user] reviewed the report: every $[server] had completed $[action].
Each $[database] stood $[trait], prepared to withstand $[threat] again.
Later that week, $[user] ran another test across $[server] clusters.
The process showed that $[action] worked seamlessly, no matter the scale.
Every $[database] responded the same way, $[trait] and ready.
In the end, $[user] knew that no matter how often $[threat] appeared, $[server] and $[database] would endure.
$[trait] was not just a promise—it was a practice, proven again and again.
Placeholder functions and behaviors
-
A. Block-level placeholders
Block-level placeholders appear in a toolbar above the code block. Editing block-level placeholders is ideal for values—such as
client_nameandbackupset_name—that must be the same in the entire code block.When you edit a block-level placeholder, all matching placeholders in the code block are updated.
-
B. Snippet-level placeholders
Snippet-level placeholders appear inside code blocks.
To change only one instance of a placeholder, edit only that snippet-level placeholder.
-
C. Snippet-level overrides
When you edit a snippet-level placeholder that was previously updated by a block-level value, the snippet-level placeholder is unlinked from the block-level placeholder. This behavior preserves your block-level changes in connected fields while you change one field without affecting the other, linked placeholders.
Placeholder shading
Placeholder shading indicates the following:
-
Blue: Unedited
-
Yellow:
-
Block-level placeholders: Edited
-
Snippet-level placeholders: Updated by and linked to its matching block-level placeholder
-
-
Orange (snippet-level only): Edited to a different value and unlinked from its matching block-level placeholder
Static code blocks
Static (non-interactive) code blocks also often—but not always—contain placeholders that need to be replaced.
Examples of static code blocks that don't require placeholders:
-
A code block that shows commands you can copy, paste, and run as-is:
qlist schedule -
A code block that displays the results of a command, such as example logs or errors:
TIME BACKUPJOBS RESTOREJOBS ADMINJOBS Sun 12:30:45 0 0 4 Mon 12:30:45 0 0 4 Tue 12:30:45 0 0 4 Wed 12:30:45 0 0 4 Thu 12:30:45 0 0 4 Fri 12:30:45 0 0 4 Sat 12:30:45 0 0 4