有用的DocBook标记

这些是在编写代码文档时非常有用处的DocBook标记。

To link to another section in the GTK docs:

<link linkend="glib-Hash-Tables">Hash Tables</link>
The linkend is the SGML/XML id on the top item of the page you want to link to. For most pages this is currently the part ("gtk", "gdk", "glib") and then the page title ("Hash Tables"). For widgets it is just the class name. Spaces and underscores are converted to '-' to conform to SGML/XML.

引用一个外部函数,比如一个标准 C 函数:

<function>...</function>

要包含示例代码:

<example>
  <title>Using a GHashTable.</title>
  <programlisting>
      ...
  </programlisting>
</example>
或类似的,很短的不需要标题的代码段:
<informalexample>
  <programlisting>
  ...
  </programlisting>
</informalexample>
对后者,GTK-Doc 还支持一种缩写方式:|[ ... ]|

要包含符号列表:

<itemizedlist>
  <listitem>
    <para>
      ...
    </para>
  </listitem>
  <listitem>
    <para>
      ...
    </para>
  </listitem>
</itemizedlist>

要包含一条文字中突出显示的注解:

<note>
  <para>
    Make sure you free the data after use.
  </para>
</note>

要引用一个类型:

<type>unsigned char</type>

引用一个外部结构(不是在GTK 文档中描述的):

<structname>XFontStruct</structname>

要引用一个结构字段:

<structfield>len</structfield>

要引用一个类的名字,你可能会使用:

<classname>GtkWidget</classname>
但是你可能正在使用#GtkWidget(要自动创建一个到GtkWidget 页面的链接-请参阅缩写)。

要强调文本:

<emphasis>This is important</emphasis>

对于文件名,使用:

<filename>/home/user/documents</filename>

要引用键值,使用:

<keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo>