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">TEXT</code>
332 Display multiple lines of text in a code-like font (similar to the HTML <pre/>
335 is the language this code block is for. For example, if \fILANGUAGE\fR is
336 \fBC#\fR, then \fITEXT\fR will get syntax highlighting for the C# language
337 within the Mono Documentation Browser.
339 .I <example>XML_TEXT</example>
340 Indicates an example that should be displayed specially. For example:
344 <para>An introductory paragraph.</para>
347 public static void Main ()
349 System.Console.WriteLine ("Hello, World!");
356 The \fIexample\fR element can contain the following elements:
363 .I <exception cref="CREF">XML_TEXT</exception>
364 Identifies an exception that can be thrown by the documented member.
367 is a top-level element, and should be nested directly under the
372 is the exception type that is thrown, while
374 contains the circumstances that would cause
379 <exception cref="T:System.ArgumentNullException">
380 <paramref name="foo" /> was <see langword="null" />.
384 The \fIexception\fR element can contain the following elements:
392 Create a list or table of items.
394 makes use of nested \fI<item>XML</item>\fR, \fI<listheader>XML</listheader>\fR,
395 \fI<term>XML_TEXT</term>\fR, and \fI<description>XML_TEXT</description>\fR
398 \fILists\fR have the syntax:
401 <list type="bullet"> <!-- or type="number" -->
402 <item><term>Bullet 1</term></item>
403 <item><term>Bullet 2</term></item>
404 <item><term>Bullet 3</term></item>
413 <listheader> <!-- listheader bolds this row -->
414 <term>Column 1</term>
415 <description>Column 2</description>
416 <description>Column 3</description>
419 <term>Item 1-A</term>
420 <description>Item 1-B</description>
421 <description>Item 1-C</description>
424 <term>Item 2-A</term>
425 <description>Item 2-B</description>
426 <description>Item 2-C</description>
431 The \fIitem\fR and \fIdescription\fR elements can each contain text and
432 the following elements:
441 .I <para>XML_TEXT</para>
442 Insert a paragraph of \fIXML_TEXT\fR.
447 This is a paragraph of text.
451 The \fIpara\fR element can contain the following elements:
462 \fItypeparamref\fR, and
465 .I <param name="NAME">XML_TEXT</param>
467 is a top-level element, and should be nested directly under the
471 Describes the parameter \fINAME\fR of the current constructor, method, or
476 A <see cref="T:System.Int32" /> containing the number
477 of widgets to process.
482 The \fIparam\fR element can contain the following elements:
491 .I <paramref name="NAME" />
492 Indicates that \fINAME\fR is a parameter.
494 This usually renders \fINAME\fR as italic text, so it is frequently
495 (ab)used as an equivalent to the HTML <i/> element. See the
496 \fI<exception/>\fR documentation (above) for an example.
499 .I <permission cref="CREF">XML_TEXT</permission>
500 Documents the security accessibility requirements of the current member.
503 is a top-level element, and should be nested directly under the
507 \fICREF\fR is a type reference to the security permission required, while
508 \fIXML_TEXT\fR is a description of why the permission is required.
511 <permission cref="T:System.Security.Permissions.FileIOPermission">
512 Requires permission for reading and writing files. See
513 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" />,
514 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />.
518 The \fIpermission\fR element can contain the following elements:
525 .I <remarks>XML_TEXT</remarks>
526 Contains detailed information about a member.
529 is a top-level element, and should be nested directly under the
535 Insert detailed information here.
539 The \fIremarks\fR element can contain the following elements:
550 .I <returns>XML_TEXT</returns>
553 is a top-level element, and should be nested directly under the
557 Describes the return value of a method:
561 A <see cref="T:System.Boolean" /> specifying whether
562 or not the process can access
563 <see cref="P:Mono.Unix.UnixFileSystemInfo.FullName" />.
567 The \fIreturns\fR element can contain the following elements:
574 \fI<see cref="CREF" />\fR, \fI<see langword="LANGWORD" />\fR
575 Creates a link to the specified member within the current text:
578 <see cref="M:Some.Namespace.With.Type.Method" />
581 or specifies that \fILANGWORD\fR is a language keyword:
584 <see langword="null" />
588 .I <seealso cref="CREF" />
589 Do not use \fIseealso\fR, use \fIaltmember\fR.
591 .I <since version="VERSION" />
594 is a top-level element, and should be nested directly under the
595 \fI<Docs/>\fR element.
597 Permits specification of which version introduced the specified type or
601 <since version="Gtk# 2.4" />
604 This generally isn't required, as the \fI//AssemblyInfo/AssemblyVersion\fR
605 elements track which assembly versions contain type or member.
607 .I <summary>XML_TEXT</summary>
610 is a top-level element, and should be nested directly under the
614 Provides a (brief!) overview about a type or type member.
616 This is usually displayed as part of a class declaration, and should be a
617 reasonably short description of the type/member. Use
619 for more detailed information.
621 The \fIsummary\fR element can contain the following elements:
629 .I <typeparam name="NAME">XML_TEXT</typeparam>
631 is a top-level element, and should be nested directly under the
635 This is used to document a type parameter for a generic type or generic method.
638 is the name of the type parameter, while
640 contains a description of the parameter (what it's used for, what restrictions
645 The type of the underlying collection
649 The \fItypeparam\fR element can contain the following elements:
657 .I <typeparamref name="NAME">
658 Used to indicate that \fINAME\fR is a type parameter.
660 .I <value>XML_TEXT</value>
662 is a top-level element, and should be nested directly under the
666 Allows a property to be described.
670 A <see cref="T:System.String" /> containing a widget name.
674 The \fIvalue\fR element can contain the following elements:
685 String IDs (\fICREF\fRs) are used to refer to a type or member of a type.
686 String IDs are documented in ECMA-334 3rd Edition, Annex E.3.1. They consist
687 of a \fImember type prefix\fR, the full type name (namespace + name, separated
688 by \fI.\fR), possibly followed by the member name and other information.
690 Member type prefixes:
693 The CREF refers to a constructor. The (optional) parameter list is
694 enclosed in parenthesis and follows the type name:
695 \fIC:System.String(System.Char,System.Int32)\fR.
698 The CREF refers to an event. The event name follows the type name:
699 \fIE:System.AppDomain.AssemblyLoad\fR.
702 The CREF refers to a field. The field name follows the type name:
703 \fIF:System.Runtime.InteropServices.DllImportAttribute.SetLastError\fR.
706 Refers to a constructor or method. Constructors may append
708 to the type name (instead of using the above
710 constructor format), while methods append the method name and an (optional)
711 count of the number of generic parameters. Both constructors and methods
712 may append the method parameter list enclosed in parenthesis.
715 \fIM:System.Object..ctor\fR,
716 \fIM:System.String..ctor(System.Char[])\fR,
717 \fIM:System.String.Concat(System.Object)\fR,
718 \fIM:System.Array.Sort``1(``0[])\fR,
719 \fIM:System.Collections.Generic.List`1..ctor\fR,
720 \fIM:System.Collections.Generic.List`1.Add(`0)\fR.
723 Refers to a namespace, e.g. \fIN:System\fR.
726 Refers to a property. If the property is an indexer or takes parameters,
727 the parameter types are appended to the property name and enclosed with
729 \fIP:System.String.Length\fR,
730 \fIP:System.String.Chars(System.Int32)\fR.
733 The CREF refers to a type, with the number of generic types appended:
734 \fIT:System.String\fR,
735 \fIT:System.Collections.Generic.List`1\fR,
736 \fIT:System.Collections.Generic.List`1.Enumerator\fR.
738 To make matters more interesting, generic types & members have two
739 representations: the "unbound" representation (shown in examples above), in
740 which class names have the count of generic parameters appended to their name.
741 There is also a "bound" representation, in which the binding of generic
742 parameters is listed within '{' and '}' or '<' and '>'.
743 (Use of '<' and '>' is less common, as within an XML document their escaped
744 character entities must instead be used, leading to '<' and '>'.)
749 .I T:System.Collections.Generic.List`1
752 .I T:System.Collections.Generic.Dictionary`2
757 .I T:System.Collections.Generic.List{System.Int32}
760 .I T:System.Collections.Generic.List<System.Int32>
763 .I T:System.Collections.Generic.List<System.Int32>
766 .I T:System.Predicate{System.Action{System.String}}
768 As you can see, bound variants can be arbitrarily complex (just like
771 Furthermore, if a generic parameter is bound to the generic parameter of a
772 type or method, the "index" of the type/method's generic parameter is used
773 as the binding, so given
777 public static void Foo<T> (System.Predicate<T> predicate)
783 The CREF for this method is
784 \fIM:FooType.Foo``1(System.Predicate{``0})\fR,
786 is the 0th generic parameter index which is bound to
787 \fISystem.Predicate<T>\fR.
789 mdoc(1), monodocer(1)
792 Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details.
794 Visit http://www.mono-project.com for details