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:
404 .I <format type="TYPE">XML_TEXT</format>
405 The \fI<format/>\fR element is an "escape hatch," for including (possibly XML)
406 content that is not valid \fBmdoc\fR(5) content. It's the moral equivalent of
407 \fBperlpod\fR(1) \fI=begin format\fR blocks.
409 \fITYPE\fR is the mime type of \fIXML_TEXT\fR. \fBmdoc\fR(5) processors may
410 skip \fIformat/>\fR blocks of they use a type that isn't supported.
415 <format type="text/html">
417 <tr><td style="color:red">Hello, world!</td></tr>
422 would cause the embedded HTML \fI<table/>\fR element to be inserted inline
423 into the resulting HTML document when \fBmdoc-export-html\fR(1) processes the
424 file. (Likewise, it may be skipped if processed by another program.)
426 \fIformat/>\fR is intended to simplify importing documentation from existing
427 documentation sources. It should not be relied upon, if at all possible.
430 Create a list or table of items.
432 makes use of nested \fI<item>XML</item>\fR, \fI<listheader>XML</listheader>\fR,
433 \fI<term>XML_TEXT</term>\fR, and \fI<description>XML_TEXT</description>\fR
436 \fILists\fR have the syntax:
439 <list type="bullet"> <!-- or type="number" -->
440 <item><term>Bullet 1</term></item>
441 <item><term>Bullet 2</term></item>
442 <item><term>Bullet 3</term></item>
451 <listheader> <!-- listheader bolds this row -->
452 <term>Column 1</term>
453 <description>Column 2</description>
454 <description>Column 3</description>
457 <term>Item 1-A</term>
458 <description>Item 1-B</description>
459 <description>Item 1-C</description>
462 <term>Item 2-A</term>
463 <description>Item 2-B</description>
464 <description>Item 2-C</description>
469 The \fIitem\fR and \fIdescription\fR elements can each contain text and
470 the following elements:
479 .I <para>XML_TEXT</para>
480 Insert a paragraph of \fIXML_TEXT\fR.
485 This is a paragraph of text.
489 The \fIpara\fR element can contain the following elements:
500 \fItypeparamref\fR, and
503 .I <param name="NAME">XML_TEXT</param>
505 is a top-level element, and should be nested directly under the
509 Describes the parameter \fINAME\fR of the current constructor, method, or
514 A <see cref="T:System.Int32" /> containing the number
515 of widgets to process.
520 The \fIparam\fR element can contain the following elements:
529 .I <paramref name="NAME" />
530 Indicates that \fINAME\fR is a parameter.
532 This usually renders \fINAME\fR as italic text, so it is frequently
533 (ab)used as an equivalent to the HTML <i/> element. See the
534 \fI<exception/>\fR documentation (above) for an example.
537 .I <permission cref="CREF">XML_TEXT</permission>
538 Documents the security accessibility requirements of the current member.
541 is a top-level element, and should be nested directly under the
545 \fICREF\fR is a type reference to the security permission required, while
546 \fIXML_TEXT\fR is a description of why the permission is required.
549 <permission cref="T:System.Security.Permissions.FileIOPermission">
550 Requires permission for reading and writing files. See
551 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" />,
552 <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />.
556 The \fIpermission\fR element can contain the following elements:
563 .I <remarks>XML_TEXT</remarks>
564 Contains detailed information about a member.
567 is a top-level element, and should be nested directly under the
573 Insert detailed information here.
577 The \fIremarks\fR element can contain the following elements:
588 .I <returns>XML_TEXT</returns>
591 is a top-level element, and should be nested directly under the
595 Describes the return value of a method:
599 A <see cref="T:System.Boolean" /> specifying whether
600 or not the process can access
601 <see cref="P:Mono.Unix.UnixFileSystemInfo.FullName" />.
605 The \fIreturns\fR element can contain the following elements:
612 \fI<see cref="CREF" />\fR, \fI<see langword="LANGWORD" />\fR
613 Creates a link to the specified member within the current text:
616 <see cref="M:Some.Namespace.With.Type.Method" />
619 or specifies that \fILANGWORD\fR is a language keyword:
622 <see langword="null" />
626 .I <seealso cref="CREF" />
627 Do not use \fIseealso\fR, use \fIaltmember\fR.
629 .I <since version="VERSION" />
632 is a top-level element, and should be nested directly under the
633 \fI<Docs/>\fR element.
635 Permits specification of which version introduced the specified type or
639 <since version="Gtk# 2.4" />
642 This generally isn't required, as the \fI//AssemblyInfo/AssemblyVersion\fR
643 elements track which assembly versions contain type or member.
645 .I <summary>XML_TEXT</summary>
648 is a top-level element, and should be nested directly under the
652 Provides a (brief!) overview about a type or type member.
654 This is usually displayed as part of a class declaration, and should be a
655 reasonably short description of the type/member. Use
657 for more detailed information.
659 The \fIsummary\fR element can contain the following elements:
667 .I <typeparam name="NAME">XML_TEXT</typeparam>
669 is a top-level element, and should be nested directly under the
673 This is used to document a type parameter for a generic type or generic method.
676 is the name of the type parameter, while
678 contains a description of the parameter (what it's used for, what restrictions
683 The type of the underlying collection
687 The \fItypeparam\fR element can contain the following elements:
695 .I <typeparamref name="NAME">
696 Used to indicate that \fINAME\fR is a type parameter.
698 .I <value>XML_TEXT</value>
700 is a top-level element, and should be nested directly under the
704 Allows a property to be described.
708 A <see cref="T:System.String" /> containing a widget name.
712 The \fIvalue\fR element can contain the following elements:
723 String IDs (\fICREF\fRs) are used to refer to a type or member of a type.
724 String IDs are documented in ECMA-334 3rd Edition, Annex E.3.1. They consist
725 of a \fImember type prefix\fR, the full type name (namespace + name, separated
726 by \fI.\fR), possibly followed by the member name and other information.
728 Member type prefixes:
731 The CREF refers to a constructor. The (optional) parameter list is
732 enclosed in parenthesis and follows the type name:
733 \fIC:System.String(System.Char,System.Int32)\fR.
736 The CREF refers to an event. The event name follows the type name:
737 \fIE:System.AppDomain.AssemblyLoad\fR.
740 The CREF refers to a field. The field name follows the type name:
741 \fIF:System.Runtime.InteropServices.DllImportAttribute.SetLastError\fR.
744 Refers to a constructor or method. Constructors may append
746 to the type name (instead of using the above
748 constructor format), while methods append the method name and an (optional)
749 count of the number of generic parameters. Both constructors and methods
750 may append the method parameter list enclosed in parenthesis.
753 \fIM:System.Object..ctor\fR,
754 \fIM:System.String..ctor(System.Char[])\fR,
755 \fIM:System.String.Concat(System.Object)\fR,
756 \fIM:System.Array.Sort``1(``0[])\fR,
757 \fIM:System.Collections.Generic.List`1..ctor\fR,
758 \fIM:System.Collections.Generic.List`1.Add(`0)\fR.
761 Refers to a namespace, e.g. \fIN:System\fR.
764 Refers to a property. If the property is an indexer or takes parameters,
765 the parameter types are appended to the property name and enclosed with
767 \fIP:System.String.Length\fR,
768 \fIP:System.String.Chars(System.Int32)\fR.
771 The CREF refers to a type, with the number of generic types appended:
772 \fIT:System.String\fR,
773 \fIT:System.Collections.Generic.List`1\fR,
774 \fIT:System.Collections.Generic.List`1.Enumerator\fR.
776 To make matters more interesting, generic types & members have two
777 representations: the "unbound" representation (shown in examples above), in
778 which class names have the count of generic parameters appended to their name.
779 There is also a "bound" representation, in which the binding of generic
780 parameters is listed within '{' and '}' or '<' and '>'.
781 (Use of '<' and '>' is less common, as within an XML document their escaped
782 character entities must instead be used, leading to '<' and '>'.)
787 .I T:System.Collections.Generic.List`1
790 .I T:System.Collections.Generic.Dictionary`2
795 .I T:System.Collections.Generic.List{System.Int32}
798 .I T:System.Collections.Generic.List<System.Int32>
801 .I T:System.Collections.Generic.List<System.Int32>
804 .I T:System.Predicate{System.Action{System.String}}
806 As you can see, bound variants can be arbitrarily complex (just like
809 Furthermore, if a generic parameter is bound to the generic parameter of a
810 type or method, the "index" of the type/method's generic parameter is used
811 as the binding, so given
815 public static void Foo<T> (System.Predicate<T> predicate)
821 The CREF for this method is
822 \fIM:FooType.Foo``1(System.Predicate{``0})\fR,
824 is the 0th generic parameter index which is bound to
825 \fISystem.Predicate<T>\fR.
827 mdoc(1), monodocer(1)
830 Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details.
832 Visit http://www.mono-project.com for details