{% macro paramList(params, truncateLines) -%}
  {%- if params -%}
    ({%- for param in params -%}
      {$ param | escape | truncateCode(truncateLines) $}{% if not loop.last %}, {% endif %}
    {%- endfor %})
  {%- endif %}
{%- endmacro -%}


{% macro returnType(returnType) -%}
  {%- if returnType %}: {$ returnType | escape $}{% endif -%}
{%- endmacro -%}

{%- macro renderParameters(parameters, containerClass, parameterClass, showType) -%}
{%- if parameters.length -%}
<table class="is-full-width list-table parameters-table {$ containerClass $}">
  <tbody>
  {% for parameter in parameters %}
    <tr class="{$ parameterClass $}">
      <td class="param-name">
        <a id="{$ parameter.anchor or parameter.name $}"></a>
        <code>{$ parameter.name $}</code>
      </td>
      {% if showType %}<td class="param-type"><code>{$ parameter.type | escape $}</code></td>{% endif %}
      <td class="param-description">
      {% marked %}
        {% if parameter.isOptional or parameter.defaultValue !== undefined %}Optional. Default is `{$ parameter.defaultValue === undefined and 'undefined' or parameter.defaultValue $}`.{% endif %}

        {% if parameter.description | trim %}{$ parameter.description $}
        {% elseif not showType and parameter.type %}<p>Type: <code>{$ parameter.type | escape $}</code>.</p>
        {% endif %}
      {% endmarked %}
      </td>
    </tr>{% endfor %}
  </tbody>
</table>
{%- else -%}
<p>There are no parameters.</p>
{%- endif -%}
{%- endmacro -%}
