Special Rendering in Templates
When working with Handlebars templates, most template variables render as plain text using their string representation. However, Kampose automatically applies special rendering for certain documentation entities to create properly formatted output with cross-reference links.
The following entities receive special rendering:
| Entity | Rendering Behavior |
|---|---|
| Code Members | Rendered as clickable links to their documentation pages |
| Attributes | Rendered as they appear in source code with links to attribute types |
| Documentation Comments | Rendered with content transformed to output format |
| Topics | Rendered as formatted content with adjusted cross-references |
This special rendering activates automatically when these entities appear in your template data. Kampose handles the complexity of creating proper links, applying language-specific formatting, and adjusting references to work within your documentation structure.
Code Members
Code members such as namespaces, types, methods, properties, and fields are automatically rendered as links to their documentation pages.
Behavior
Complex member references are broken down into components, with each part linked to its documentation page. The form of these links depends on your chosen output format.
Member names are qualified with their declaring type when appropriate, creating clear navigation paths through your API documentation.
For example, consider this member reference:
ICollection<DateTime>.Add(DateTime item)
Kampose will render it with links for each component:
ICollection<>links to theICollection<T>documentationDateTimelinks to theDateTimedocumentationAddlinks to theAddmethod documentation
The rendered output will look like this:
Usage Examples
{{!-- Renders a link to documentation for the return type --}}
<div class="method-return-value">{{model.metadata.return.type}}</div>
{{!-- Renders a link to documentation of each declared member --}}
<ul>
{{#each model.Members}}
<li>{{this}}</li> {{!-- Each member automatically rendered with links --}}
{{/each}}
</ul>
Attributes
Attributes applied to code elements are rendered as they appear in source code, with links to the attribute type documentation and proper syntax formatting.
Behavior
Constructor parameters and properties are formatted using language-specific syntax. Type references within attribute arguments are automatically linked to their documentation pages.
For example, consider this attribute usage:
[XmlElement(typeof(Manager), ElementName = "Manager", Form = XmlSchemaForm.Qualified)]
public Employee Manager { get; set; }
Kampose will render it with links for the relevant types:
XmlElementlinks to theXmlElementAttributedocumentationManagerlinks to theManagertype documentationXmlSchemaFormlinks to the enumeration documentation
The rendered output will look like this:
XmlElement(typeof(Manager), ElementName = "Manager", Form = XmlSchemaForm.Qualified)
Usage Examples
{{!-- Render attributes applied to a member --}}
{{#if model.metadata.customAttributes}}
<div class="attributes">
<h3>Attributes</h3>
<ul>
{{#each model.metadata.customAttributes}}
<li>{{this}}</li> {{!-- Each attribute automatically rendered with links --}}
{{/each}}
</ul>
</div>
{{/if}}
Documentation Comments
Top-level XML documentation tags (such as <summary>, <remarks>, <returns>) have their content transformed to match your chosen output format.
Behavior
When rendering documentation comment content:
- Special characters are escaped according to the output format (HTML or Markdown)
- Inline XML tags (like
<see>,<paramref>,<c>,<code>) are converted to their equivalent HTML or Markdown elements - Cross-references are adjusted to point to the correct documentation pages
Usage Examples
{{!-- Summary comments --}}
<div class="summary">{{model.doc.summary}}</div>
{{!-- Remarks section --}}
{{#if model.doc.remarks}}
<div class="remarks">
<h3>Remarks</h3>
{{model.doc.remarks}}
</div>
{{/if}}
{{!-- Return value documentation --}}
<h3>Returns</h3>
{{model.metadata.return.type}}
{{#if model.doc.returnDescription}}
<div class="returns">
{{model.doc.returnDescription}}
</div>
{{/if}}
Topics
Custom documentation topics (conceptual content, guides, tutorials) are rendered with proper formatting and working cross-references.
Behavior
Topic content is automatically adjusted to work within your documentation structure. Cross-references are updated to point to the correct pages, and the content is formatted according to your chosen output format.
Usage Examples
{{!-- Topics are usually top-level models --}}
<div class="topic-content">
{{model}} {{!-- Topic content automatically rendered --}}
</div>
