DOCUMENTATION.md
The documentation on the website (www.antblazor.com) is automatically generated based on XML comments in the code files for the library. The idea is to keep the code and documentation site automatically in sync when changes are made. For this to be the case though, we must maintain the documentation comments in the code, using particular tags and formatting along with some data attributes. More details on this are given below.
For details on XML documentation comments in C# in general, see the Microsoft website.
To mark a component to render a documentation page, tag it with the Documentation attribute, example:
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://fullUrl.com/to/image.jpg")]
Title- use a custom title for the page. This affects URL as well. Default is the component's class name.Columns - the number of columns demos should be in. Default is 2.Subtitle - sub title for the documentation page. Default is null.OutputApi - This one allows turning off outputting the decorated class's API. Default is true (output API).
There are specific tags that the build project looks at the build the documentation of the website. There are a mixture of standard and custom tags we look for in the documentation comments.
something would display in the default column next to the member it is onsee is supported inside summary tags. When provided inside a summary, code style text will be inserted in that spot
seealso is supported at the root level of components/page documentation.
cref will be added, in order, to the API section of the component's documentation page.FAQ sections can be added to documentation by placing markdown files in the proper spot, with the proper naming conventions.
Demos/Components/[COMPONENT_NAME]/
[COMPONENT_NAME] with the name of the component the FAQ should go on the page forfaq.[LANG].md
[LANG] with the language code the file is in. Ex: en-US[Obsolete("Some short description on why and what else to use")]
[Inject] attribute) even if they have documentation comments[CascadingParameter] attribute) even if they have documentation comments_methodNamesToIgnore field in the GenerateDemoJsonCommand)
Dispose, Equals, etc.OnAfterRender, regardless of documentation commentsAll code documentation comments and messages are expected to be in English. Text is automatically translated from English to Chinese to generate the Chinese documentation where it makes sense.
<u>Translated</u>:
<u>Not translated</u>:
There may be cases when an automatic translation is insufficient or invalid. In these cases, there is the ability to specify the translation for <summary> tags by using a custom attribute on the tag. This is currently only supported for summary tags. If a translation is unable to be determined for any reason then the English will be used.
The example below demonstrates the usage:
/// <summary>
/// English summary
/// </summary>
/// <summary xml:lang="zh-CN">
/// Chinese summary
/// </summary>
public string SomeProperty { get; set; }
This property has English and Chinese summaries provided at once. By using the xml:lang attribute you can specify the language the summary is for. If the attribute is not provided then English is assumed.
Documentation will be translated into Chinese with either Google or Azure.
appsettings.private.json file in the Build.CLI folder. This file is gitignored so it will not be committed and reveal your key.To avoid making excessive calls to either translation service, we cache the translations as "known translations" for later use (in the KnownChineseTranslations.json file)
<u>How it works</u>: