github.com/bazelbuild/rules_go@v0.47.2-0.20240515105122-e7ddb9ea474e/docs/rule_body.vm (about)

     1  #**
     2  This template is used for including rule definitions as top-level sections in generated stardoc docstrings.
     3  *#
     4  #*
     5  Workaround for markdownCellFormat() not allowing HTML (specifically lists) to be rendered in attribute table cells.
     6  
     7  TODO: Once https://github.com/bazelbuild/bazel/pull/14230 is merged, remove this macro and replace with call to
     8        util.markdownCellFormatWithHtml($attribute.docString, true)
     9  *#
    10  #macro( markdownCellFormatNoEscapeHtml $docString )#*
    11    *##if ($docString.contains("<ul>"))#*
    12        *#${docString.trim().replaceAll("\n(\\s*\n)+", "<br><br>").replaceAll("\n", " ")}#*
    13    *##else#*
    14        *#${util.markdownCellFormat($docString)}#*
    15    *##end#*
    16  *##end
    17  
    18  <a id="#${ruleName}"></a>
    19  
    20  #[[##]]# ${ruleName}
    21  
    22  <pre>
    23  ${util.ruleSummary($ruleName, $ruleInfo)}
    24  </pre>
    25  
    26  ${ruleInfo.docString}
    27  
    28  #[[###]]# **Attributes**
    29  
    30  #if (!$ruleInfo.getAttributeList().isEmpty())
    31  
    32  | Name  | Description | Type | Mandatory | Default |
    33  | :------------- | :------------- | :------------- | :------------- | :------------- |
    34  #foreach ($attribute in $ruleInfo.getAttributeList())
    35  | <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 |
    36  #end
    37  #end