<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2020</year><year>2021</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>shell_docs</title>
    <prepared>Lukas Larsson</prepared>
    <responsible></responsible>
    <docno>1</docno>
    <approved></approved>
    <checked></checked>
    <date>2020-02-19</date>
    <rev>A</rev>
    <file>shell_docs.xml</file>
  </header>
  <module since="OTP 23.0">shell_docs</module>
  <modulesummary>Functions used to render EEP-48 style documentation for a shell.</modulesummary>
  <description>
    <p>This module can be used to render function and type documentation
      to be printed in a shell. This is the module that is used to render the
      docs accessed through the shell through <seemfa marker="c#h/1"><c>c:h/1,2,3</c></seemfa>.
    Example:</p>
    <code>
1> h(maps,new,0).

  -spec new() -> Map when Map :: #{}.

Since:
  OTP 17.0

  Returns a new empty map.

  Example:

    > maps:new().
    #{}
</code>
    <p>This module formats and renders EEP-48 documentation of
      the format <c>application/erlang+html</c>. For more information about
      this format see <seeguide marker="erl_docgen:doc_storage">Documentation
      Storage</seeguide> in Erl_Docgen's User's Guide. It can also render
      any other format of "text" type, although those will be rendered as is.
    </p>
  </description>

  <datatypes>
    <datatype>
      <name name="docs_v1"/>
      <desc>
        <p>
          The record holding EEP-48 documentation for a module.
          You can use <seemfa marker="kernel:code#get_doc/1">code:get_doc/1</seemfa>
          to fetch this information from a module.
        </p>
      </desc>
    </datatype>
    <datatype>
      <name name="config"/>
      <desc>
        <p>
          The configuration of how the documentation should be rendered.
        </p>
        <taglist>
          <tag>encoding</tag>
          <item>
            Configure the encoding that should be used by
            the renderer for graphical details such as bullet-points.
            By default <c>shell_docs</c> uses the value returned
          by <seemfa marker="io#getopts/0"><c>io:getopts()</c></seemfa>.</item>
          <tag>ansi</tag>
          <item>
            Configure whether <url href="https://en.wikipedia.org/wiki/ANSI_escape_code">
            ansi escape codes</url> should be used to
            render graphical details such as bold and underscore. By default
            <c>shell_docs</c> will try to determine if the receiving shell
            supports ansi escape codes. It is possible to override
            the automated check by setting the kernel configuration parameter
          <c>shell_docs_ansi</c> to a <c>boolean()</c> value.</item>
          <tag>columns</tag>
          <item>
            Configure how wide the target documentation should be rendered.
            By default <c>shell_docs</c> used the value returned by
            <seemfa marker="io#columns/0"><c>io:columns()</c></seemfa>.
          </item>
        </taglist>
      </desc>
    </datatype>
    <datatype>
      <name name="chunk_element_block_type"/>
      <name name="chunk_element_inline_type"/>
      <name name="chunk_element_type"/>
      <desc>
        <p>
          The HTML tags allowed in <c>application/erlang+html</c>.
        </p>
      </desc>
    </datatype>
    <datatype>
      <name name="chunk_element_attr"/>
      <name name="chunk_element_attrs"/>
      <name name="chunk_element"/>
      <name name="chunk_elements"/>
      <desc>
      </desc>
    </datatype>
  </datatypes>

  <funcs>

    <func>
      <name name="render" arity="2" since="OTP 23.0"/>
      <name name="render" arity="3" clause_i="1" since="OTP 23.2"/>
      <name name="render" arity="3" clause_i="2" since="OTP 23.0"/>
      <name name="render" arity="4" clause_i="1" since="OTP 23.2"/>
      <name name="render" arity="4" clause_i="2" since="OTP 23.0"/>
      <name name="render" arity="5" since="OTP 23.2"/>
      <fsummary>Render the documentation for a module or function.</fsummary>
      <desc>
        <p>Render the documentation for a module or function.</p>
      </desc>
    </func>
    <func>
      <name name="render_type" arity="2" since="OTP 23.0"/>
      <name name="render_type" arity="3" clause_i="1" since="OTP 23.2"/>
      <name name="render_type" arity="3" clause_i="2" since="OTP 23.0"/>
      <name name="render_type" arity="4" clause_i="1" since="OTP 23.2"/>
      <name name="render_type" arity="4" clause_i="2" since="OTP 23.0"/>
      <name name="render_type" arity="5" since="OTP 23.2"/>
      <fsummary>Render the documentation of a type in a module.</fsummary>
      <desc>
        <p>Render the documentation of a type in a module.</p>
      </desc>
    </func>
    <func>
      <name name="render_callback" arity="2" since="OTP 23.0"/>
      <name name="render_callback" arity="3" clause_i="1" since="OTP 23.2"/>
      <name name="render_callback" arity="3" clause_i="2" since="OTP 23.0"/>
      <name name="render_callback" arity="4" clause_i="1" since="OTP 23.2"/>
      <name name="render_callback" arity="4" clause_i="2" since="OTP 23.0"/>
      <name name="render_callback" arity="5" since="OTP 23.2"/>
      <fsummary>Render the documentation of a callback in a module.</fsummary>
      <desc>
        <p>Render the documentation of a callback in a module.</p>
      </desc>
    </func>

    <func>
      <name name="validate" arity="1" since="OTP 23.0"/>
      <fsummary>Validate the documentation</fsummary>
      <desc>
        <p>This function can be used to do a basic validation of
          the doc content of <c>application/erlang+html</c> format.</p>
      </desc>
    </func>

    <func>
      <name name="normalize" arity="1" since="OTP 23.0"/>
      <fsummary>Normalize the documentation</fsummary>
      <desc>
        <p>This function can be used to do whitespace normalization
          of <c>application/erlang+html</c> documentation.</p>
      </desc>
    </func>

    <func>
      <name name="supported_tags" arity="0" since="OTP 24.0"/>
      <fsummary>Which tags are supported</fsummary>
      <desc>
        <p>This function can be used to find out which tags are
          supported by <c>application/erlang+html</c> documentation.</p>
      </desc>
    </func>

  </funcs>
</erlref>
