<var>
元素允许读者将占位符变量替换为自己的变量
值。
常规用法
Markdown 点击复制代码块中可修改的占位符变量为 默认可修改。
Edit the name of this PROJECT_ID.
启用编辑功能
将 edit
类添加到 <var>
元素中,以创建具有以下特征的变量:
EDITABLE
。
停用编辑功能
This example adds the `readonly` class to the <var> element to create an
UNEDITABLE_VARIABLE.
This example adds the `readonly` class to the code block to disable editability
of both VARIABLE_1 and VARIABLE_2.
提示
This EDITABLE variable has a tooltip that defaults to the
name of its original placeholder text.
This EDITABLE variable uses a `label`
attribute to create a custom tooltip named
Edit me.
同步
具有相同范围的可修改占位符变量会与每个变量同步 其他,并立即更新以反映新值。
停用同步功能
This variable synchronizes by default because it is in a click-to-copy code
block. It has a `label` attribute named `variable with scope`:
VARIABLE
This variable adds the `no-scope` class so that it does not synchronize with the
other variables and has a `label` attribute named `variable without scope`:
VARIABLE
This variable also synchronizes by default and has a `label` attribute named
`variable with scope`:
VARIABLE
启用同步
此占位符 VARIABLE
为
在代码块外部进行设置,并使用 scope
属性与
上文“停用同步”部分中的变量。