#**
This template is used for including rule definitions as top-level sections in generated stardoc docstrings.
*#
#*
Workaround for markdownCellFormat() not allowing HTML (specifically lists) to be rendered in attribute table cells.

TODO: Once https://github.com/bazelbuild/bazel/pull/14230 is merged, remove this macro and replace with call to
      util.markdownCellFormatWithHtml($attribute.docString, true)
*#
#macro( markdownCellFormatNoEscapeHtml $docString )#*
  *##if ($docString.contains("<ul>"))#*
      *#${docString.trim().replaceAll("\n(\\s*\n)+", "<br><br>").replaceAll("\n", " ")}#*
  *##else#*
      *#${util.markdownCellFormat($docString)}#*
  *##end#*
*##end

<a id="#${ruleName}"></a>

#[[##]]# ${ruleName}

<pre>
${util.ruleSummary($ruleName, $ruleInfo)}
</pre>

${ruleInfo.docString}

#[[###]]# **Attributes**

#if (!$ruleInfo.getAttributeList().isEmpty())

| Name  | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
#foreach ($attribute in $ruleInfo.getAttributeList())
| <a id="${ruleName}-${attribute.name}"></a>$attribute.name | #if(!$attribute.docString.isEmpty()) #markdownCellFormatNoEscapeHtml( $attribute.docString ) #else - #end  | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | $attribute.defaultValue |
#end
#end
