2 .\" mdoc(5) manual page.
3 .\" (C) 2008 Jonathan Pryor
5 .\" Jonathan Pryor (jpryor@novell.com)
7 .de Sp \" Vertical space (when we can't use .PP)
13 mdoc \- Mono Documentation XML Format
15 The assorted Mono documentation programs generate or manipulate XML files
16 following the mono documentation schema:
19 Creates or updates mono documentation XML for a set of assemblies.
22 Validates the mono documentation XML against the mono documentation XML
26 Converts the mono documentation XML within a directory structure into a set
27 of files for use with \fBmonodoc\fR(1).
30 Converts the mono documentation XML within a directory structure into a set
31 of HTML files that can be viewed with a web browser.
33 All of these tools (and more) use the common XML schema described in this man
35 .SH FILE/DIRECTORY STRUCTURE
36 There are three sets of Mono documentation XML files:
40 contains a list of all assemblies within the containing directory, and all
41 types and namespaces within those assemblies.
45 There is one ns-*.xml file for each namespace within the assembly; these
52 files include: \fIns-System.xml\fR, \fIns-System.Collections.xml\fR, and
53 \fIns-.xml\fR (for the root namespace, though it is recommended to NOT place
54 types into the root namespace, as \fBmonodoc\fR(1) doesn't display them).
58 files contain per-namespace documentation.
61 .B NamespaceName/TypeName.xml:
62 These files are within a dotted
66 is the name of the type.
70 (if the type has no namespace),
71 \fISystem/String.xml\fR,
72 \fISystem.Collections/IEnumerable.xml\fR, and
73 \fISystem.Collections.Generic/List`1+Enumerator.xml\fR
76 is the number of generic type parameters the type accepts, and everything
81 Thus, typical directory contents would resemble:
86 ns-System.Collections.Generic.xml
88 System.Collections.Generic/List`1.xml
90 .SH DOCUMENTATION FORMAT
91 .SS "\fBindex.xml File Format\fR"
95 file contains a list of the assemblies nested under the directory containing
97 and all namespaces and types within those assemblies. It looks something like
103 <Assembly Name="mscorlib" Version="2.0.0.0" />
104 <!-- other <Assembly/> elements... -->
106 <Remarks>To be added.</Remarks>
107 <Copyright>To be added.</Copyright>
109 <Namespace Name="System">
110 <Type Name="String" />
111 <!-- Other <Type/> elements -->
113 <Namespace Name="System.Collections.Generic">
114 <Type Name="List`1" DisplayName="List<T>" />
115 <!-- Other <Type/> elements -->
117 <!-- other <Namespace/> elements -->
119 <Title>DocTest</Title>
123 Most of this is maintained automatically, in particular the
124 .I /Overview/Assemblies
131 attribute corresponds to a directory which contains files named
132 \fI//Type/@Name\fR.xml, while the \fI//Type/@DisplayName\fR attribute contains
133 a C# type name (if \fI//Type/@DisplayName\fR isn't found, then
134 \fI//Type/@Name\fR is used as the display name). There should also be a
135 \fIns-[//Namespace/@Name].xml\fR file.
137 There are three elements of interest to authors:
138 \fI/Overview/Remarks\fR, \fI/Overview/Copyright\fR, and
139 \fI/Overview/Title\fR, which contain assembly-level documentation.
140 These elements can contain any of the following XML elements (documented in
141 the \fBDocumentation XML Elements\fR section):
151 .SS "\fBns-*.xml File Format\fR"
152 The \fIns-*.xml\fR files contain namespace documentation:
155 <Namespace Name="System">
157 <summary>To be added.</summary>
158 <remarks>To be added.</remarks>
163 The \fI/Namespace/Docs/summary\fR and \fI/Namespace/Docs/remarks\fR elements
164 should contain namespace documentation.
166 The \fIremarks\fR and \fIsummary\fR elements are documented in the
167 \fBDocumentation XML Elements\fR section.
168 .SS "\fBNamespaceName/TypeName.xml File Format\fR"
170 .I mono documentation format
171 is similar to the Ecma documentation format, as described
172 in ECMA-335 3rd Edition, Partition IV, Chapter 7.
173 The principal difference from the ECMA format is that each type gets its own
174 file, within a directory identical to the namespace of the type. There is a
175 lot of information that is maintained automatically by \fBmdoc\fR(1);
176 Most of the information within the documentation should
178 be edited. This includes the type name (\fI/Type/@FullName\fR), implemented
179 interfaces (\fI/Type/Interfaces\fR), member information
180 (\fI/Type/Members/Member/@MemberName\fR,
181 \fI/Type/Members/Member/MemberSignature\fR,
182 \fI/Type/Members/Member/MemberType\fR,
183 \fI/Type/Members/Member/Parameters\fR, etc.).
186 <Type Name="DocAttribute" FullName="Mono.DocTest.DocAttribute">
187 <TypeSignature Language="C#" Value="public class DocAttribute : Attribute" />
189 <AssemblyName>DocTest</AssemblyName>
190 <AssemblyVersion>0.0.0.0</AssemblyVersion>
193 <BaseTypeName>System.Attribute</BaseTypeName>
198 <AttributeName>System.AttributeUsage(System.AttributeTargets.All)</AttributeName>
202 <summary>To be added.</summary>
203 <remarks>To be added.</remarks>
206 <Member MemberName=".ctor">
207 <MemberSignature Language="C#" Value="public DocAttribute (string docs);" />
208 <MemberType>Constructor</MemberType>
210 <AssemblyVersion>0.0.0.0</AssemblyVersion>
213 <Parameter Name="docs" Type="System.String" />
216 <param name="docs">To be added.</param>
217 <summary>To be added.</summary>
218 <remarks>To be added.</remarks>
225 The only elements that normally need to be edited are children of the
226 \fI//Docs\fR elements, which usually contain the text
228 The \fI/Type/Docs\fR element contains type-level documentation, while the
229 \fI/Type/Members/Member/Docs\fR element contains per-member documentation.
231 The \fI//Docs\fR elements can contain the following elements:
246 Nested types are not members; they are types, and are documented in their own
247 file. Consequently, the \fINamespaceName/TypeName.xml\fR files are not
248 recursive; you do not store a \fI<Type/>\fR element within a \fI<Type/>\fR
250 .SS "\fBDocumentation XML Elements\fR"
251 The contents of the \fIDocs\fR element is \fIidentical\fR
252 in semantics and structure to the inline C# documentation format, consisting
253 of these elements (listed in ECMA-334 3rd Edition, Annex E, Section 2). The
254 following are used within the element descriptions:
257 Refers to a class (or member) reference, and is a string in the format
258 described below in the \fBCREF FORMAT\fR section.
261 Non-XML text, and XML should not be nested.
265 Only XML elements should be nested (which indirectly may contain text), but
266 non-whitespace text should not be an immediate child node.
269 Free-form text and XML, so that other XML elements may be nested.
271 The following elements are used in documentation:
273 .I <altmember cref="CREF" />
275 is a top-level element, and should be nested directly under the
279 Allows an entry to be generated for the \fISee Also\fR section. Use
280 \fI<see/>\fR to specify a link from within text.
283 <altmember cref="P:System.Exception.Message" />
286 .I <block subset="SUBSET" type="TYPE">XML_TEXT</block>
287 Create a block of text, similar in concept to a paragraph, but is used to
288 create divisions within the text. To some extent, a <block/> is equivalent to
292 should always be the value \fI"none"\fR.
295 specifies the heading and formatting to use. Recognized types are:
298 Creates a section with the heading \fIOperation\fR.
301 Creates a section with the heading \fINote:\fR.
304 Creates a section with the heading \fINote to Inheritors\fR.
307 Creates a section with the heading \fIUsage\fR.
309 The \fIblock\fR element can contain the following elements:
322 Set text in a code-like font (similar to the HTML <tt/> element).
324 The \fIc\fR element can contain the following elements:
331 .I <code lang="LANGUAGE" src="SOURCE">TEXT</code>
332 Display multiple lines of text in a code-like font (similar to the HTML <pre/>
336 is the language this code block is for. For example, if \fILANGUAGE\fR is
337 \fBC#\fR, then \fITEXT\fR will get syntax highlighting for the C# language
338 within the Mono Documentation Browser.
341 is only interpreted by \fBmdoc-update\fR(1). If the \fIsrc\fR attribute is
342 present when \fBmdoc-update\fR(1) is run, then \fISOURCE\fR is a file
343 (relative to \fBmdoc-update\fR(1)'s \fB--out\fR directory) that
344 should be inserted as the value for \fITEXT\fR.
345 The contents of \fITEXT\fR will be ignored by \fBmdoc-update\fR(1)
346 and replaced on every invocation. \fISOURCE\fR can also contain an "anchor",
347 e.g. \fIsrc="path/to/file.cs#RegionMarker"\fR. If an anchor is present,
348 \fIand\fR \fILANGUAGE\fR is \fIC#\fR, then \fI#region RegionMarker\fR will be
349 searched for, and the contents between the \fI#region\fR and the following
350 \fI#endregion\fR will be inserted as the value for \fITEXT\fR element.
352 .I <example>XML_TEXT</example>
353 Indicates an example that should be displayed specially. For example:
357 <para>An introductory paragraph.</para>
360 public static void Main ()
362 System.Console.WriteLine ("Hello, World!");
369 The \fIexample\fR element can contain the following elements:
376 .I <exception cref="CREF">XML_TEXT</exception>
377 Identifies an exception that can be thrown by the documented member.
380 is a top-level element, and should be nested directly under the
385 is the exception type that is thrown, while
387 contains the circumstances that would cause
392 <exception cref="T:System.ArgumentNullException">
393 <paramref name="foo" /> was <see langword="null" />.
397 The \fIexception\fR element can contain the following elements:
405 Create a list or table of items.
407 makes use of nested \fI<item>XML</item>\fR, \fI<listheader>XML</listheader>\fR,
408 \fI<term>XML_TEXT</term>\fR, and \fI<description>XML_TEXT</description>\fR
411 \fILists\fR have the syntax:
414 <list type="bullet"> <!-- or type="number" -->
415 <item><term>Bullet 1</term></item>
416 <item><term>Bullet 2</term></item>
417 <item><term>Bullet 3</term></item>
426 <listheader> <!-- listheader bolds this row -->
427 <term>Column 1</term>
428 <description>Column 2</description>
429 <description>Column 3</description>
432 <term>Item 1-A</term>
433 <description>Item 1-B</description>
434 <description>Item 1-C</description>
437 <term>Item 2-A</term>
438 <description>Item 2-B</description>
439 <description>Item 2-C</description>
444 The \fIitem\fR and \fIdescription\fR elements can each contain text and
445 the following elements:
454 .I <para>XML_TEXT</para>
455 Insert a paragraph of \fIXML_TEXT\fR.
460 This is a paragraph of text.
464 The \fIpara\fR element can contain the following elements:
475 \fItypeparamref\fR, and
478 .I <param name="NAME">XML_TEXT</param>
480 is a top-level element, and should be nested directly under the
484 Describes the parameter \fINAME\fR of the current constructor, method, or
489 A <see cref="T:System.Int32" /> containing the number
490 of widgets to process.
495 The \fIparam\fR element can contain the following elements:
504 .I <paramref name="NAME" />
505 Indicates that \fINAME\fR is a parameter.
507 This usually renders \fINAME\fR as italic text, so it is frequently
508 (ab)used as an equivalent to the HTML <i/> element. See the
509 \fI<exception/>\fR documentation (above) for an example.
512 .I <permission cref="CREF">XML_TEXT</permission>
513 Documents the security accessibility requirements of the current member.
516 is a top-level element, and should be nested directly under the
520 \fICREF\fR is a type reference to the security permission required, while
521 \fIXML_TEXT\fR is a description of why the permission is required.
524 <permission cref="T:System.Security.Permissions.FileIOPermission">
525 Requires permission for reading and writing files. See
526 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" />,
527 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />.
531 The \fIpermission\fR element can contain the following elements:
538 .I <remarks>XML_TEXT</remarks>
539 Contains detailed information about a member.
542 is a top-level element, and should be nested directly under the
548 Insert detailed information here.
552 The \fIremarks\fR element can contain the following elements:
563 .I <returns>XML_TEXT</returns>
566 is a top-level element, and should be nested directly under the
570 Describes the return value of a method:
574 A <see cref="T:System.Boolean" /> specifying whether
575 or not the process can access
576 <see cref="P:Mono.Unix.UnixFileSystemInfo.FullName" />.
580 The \fIreturns\fR element can contain the following elements:
587 \fI<see cref="CREF" />\fR, \fI<see langword="LANGWORD" />\fR
588 Creates a link to the specified member within the current text:
591 <see cref="M:Some.Namespace.With.Type.Method" />
594 or specifies that \fILANGWORD\fR is a language keyword:
597 <see langword="null" />
601 .I <seealso cref="CREF" />
602 Do not use \fIseealso\fR, use \fIaltmember\fR.
604 .I <since version="VERSION" />
607 is a top-level element, and should be nested directly under the
608 \fI<Docs/>\fR element.
610 Permits specification of which version introduced the specified type or
614 <since version="Gtk# 2.4" />
617 This generally isn't required, as the \fI//AssemblyInfo/AssemblyVersion\fR
618 elements track which assembly versions contain type or member.
620 .I <summary>XML_TEXT</summary>
623 is a top-level element, and should be nested directly under the
627 Provides a (brief!) overview about a type or type member.
629 This is usually displayed as part of a class declaration, and should be a
630 reasonably short description of the type/member. Use
632 for more detailed information.
634 The \fIsummary\fR element can contain the following elements:
642 .I <typeparam name="NAME">XML_TEXT</typeparam>
644 is a top-level element, and should be nested directly under the
648 This is used to document a type parameter for a generic type or generic method.
651 is the name of the type parameter, while
653 contains a description of the parameter (what it's used for, what restrictions
658 The type of the underlying collection
662 The \fItypeparam\fR element can contain the following elements:
670 .I <typeparamref name="NAME">
671 Used to indicate that \fINAME\fR is a type parameter.
673 .I <value>XML_TEXT</value>
675 is a top-level element, and should be nested directly under the
679 Allows a property to be described.
683 A <see cref="T:System.String" /> containing a widget name.
687 The \fIvalue\fR element can contain the following elements:
698 String IDs (\fICREF\fRs) are used to refer to a type or member of a type.
699 String IDs are documented in ECMA-334 3rd Edition, Annex E.3.1. They consist
700 of a \fImember type prefix\fR, the full type name (namespace + name, separated
701 by \fI.\fR), possibly followed by the member name and other information.
703 Member type prefixes:
706 The CREF refers to a constructor. The (optional) parameter list is
707 enclosed in parenthesis and follows the type name:
708 \fIC:System.String(System.Char,System.Int32)\fR.
711 The CREF refers to an event. The event name follows the type name:
712 \fIE:System.AppDomain.AssemblyLoad\fR.
715 The CREF refers to a field. The field name follows the type name:
716 \fIF:System.Runtime.InteropServices.DllImportAttribute.SetLastError\fR.
719 Refers to a constructor or method. Constructors may append
721 to the type name (instead of using the above
723 constructor format), while methods append the method name and an (optional)
724 count of the number of generic parameters. Both constructors and methods
725 may append the method parameter list enclosed in parenthesis.
728 \fIM:System.Object..ctor\fR,
729 \fIM:System.String..ctor(System.Char[])\fR,
730 \fIM:System.String.Concat(System.Object)\fR,
731 \fIM:System.Array.Sort``1(``0[])\fR,
732 \fIM:System.Collections.Generic.List`1..ctor\fR,
733 \fIM:System.Collections.Generic.List`1.Add(`0)\fR.
736 Refers to a namespace, e.g. \fIN:System\fR.
739 Refers to a property. If the property is an indexer or takes parameters,
740 the parameter types are appended to the property name and enclosed with
742 \fIP:System.String.Length\fR,
743 \fIP:System.String.Chars(System.Int32)\fR.
746 The CREF refers to a type, with the number of generic types appended:
747 \fIT:System.String\fR,
748 \fIT:System.Collections.Generic.List`1\fR,
749 \fIT:System.Collections.Generic.List`1.Enumerator\fR.
751 To make matters more interesting, generic types & members have two
752 representations: the "unbound" representation (shown in examples above), in
753 which class names have the count of generic parameters appended to their name.
754 There is also a "bound" representation, in which the binding of generic
755 parameters is listed within '{' and '}' or '<' and '>'.
756 (Use of '<' and '>' is less common, as within an XML document their escaped
757 character entities must instead be used, leading to '<' and '>'.)
762 .I T:System.Collections.Generic.List`1
765 .I T:System.Collections.Generic.Dictionary`2
770 .I T:System.Collections.Generic.List{System.Int32}
773 .I T:System.Collections.Generic.List<System.Int32>
776 .I T:System.Collections.Generic.List<System.Int32>
779 .I T:System.Predicate{System.Action{System.String}}
781 As you can see, bound variants can be arbitrarily complex (just like
784 Furthermore, if a generic parameter is bound to the generic parameter of a
785 type or method, the "index" of the type/method's generic parameter is used
786 as the binding, so given
790 public static void Foo<T> (System.Predicate<T> predicate)
796 The CREF for this method is
797 \fIM:FooType.Foo``1(System.Predicate{``0})\fR,
799 is the 0th generic parameter index which is bound to
800 \fISystem.Predicate<T>\fR.
802 mdoc(1), monodocer(1)
805 Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details.
807 Visit http://www.mono-project.com for details