{0 Cheatsheet}

Quick reference for the odoc language!

{table
  {tr
    {th }
    {th [odoc] syntax}
    {th Render as}}
  {tr
    {th Paragraphs}
    {td
      {@text[
      A first paragraph

      A second paragraph]}}
    {td
      A first paragraph

      A second paragraph}}
  {tr
    {th {{!odoc_for_authors.sections}Headings}}
    {td
      {@text[
      {1 Title}
      {2 Subtitle}
      {3 Subsubtitle}

      {3:my_id Referenceable title}

      See {!my_id}.
      ]}

      Standalone pages must start with a [0] heading:

      {@text[
        {0 Page big title}
      ]}}
    {td
      {%html:<h1>Title</h1>%}
      {%html:<h2>Subtitle</h2>%}
      {%html:<h3>Subsubtitle</h3>%}
      {%html:<h3 id="my_id">Referenceable title</h3>%}

      See {%html:<a href="#my_id">Referenceable title</a>%}}}
  {tr
    {th {{!odoc_for_authors.basics}Bold, italic and emphasis}}
    {td {@text[{b bold} text, {i italic} text, {e emphasized} text]}}
    {td   {b bold} text, {i italic} text, {e emphasized} text}}
  {tr
    {th {{!odoc_for_authors.basics}Subscripts and superscript}}
    {td {@text[H{_ 2}O and 1{^ st}]}}
    {td   H{_ 2}O and 1{^ st}}}
  {tr
    {th {{!odoc_for_authors.links_and_references}Link} }
    {td
      {@text[
      Here is a link: {:https://www.example.com}.

      You can also click {{:https://www.example.com}here}.]}}
    {td
      Here is a link: {:https://www.example.com}.

      You can also click {{:https://www.example.com}here}.}}
  {tr
    {th {{!odoc_for_authors.links_and_references}References} }
    {td
      {@text[
      See {!Odoc_odoc.Compile.compile}.

      See {{!Odoc_odoc.Compile.compile}this function}.

      See {{!/fmt/Fmt.pf}this function from another library}.

      See {{!/cmdliner/tutorial}this page from another package}.

      See {{!odoc_for_authors.links_and_references}this section} for the syntax of references.]}}
    {td
      See {!Odoc_odoc.Compile.compile}.

      See {{!Odoc_odoc.Compile.compile}this function}.

      See {{!/fmt/Fmt.pf}this function from another library}.

      See {{!/cmdliner/tutorial}this page from another package}.

      See {{!odoc_for_authors.links_and_references}this section} for the syntax of references.}}
    {tr
      {th {{!odoc_for_authors.lists}Lists} }
    {td
      {@text[
      - First item
      - Second item

      + First ordered item
      + Second numbered item

      {ul
        {- First item}
        {- Second item}
        {li can also be used}}

      {ol
        {- First numbered item}
        {- Second numbered item}
        {li can also be used}}]}}
    {td
      - First item
      - Second item

      + First ordered item
      + Second numbered item

      {ul
        {- First item}
        {- Second item}
        {li can also be used}}

      {ol
        {- First numbered item}
        {- Second numbered item}
        {li can also be used}}}}
  {tr
    {th {{!odoc_for_authors.code_blocks}Code Blocks} }
    {td
      {example@text[
      Inline [code].

      {[
      let _ = "Block code"
      ]}

      {foo@text[
      Code block with {[inner code block syntax]}
      ]foo}

      {@python[
      [i+1 for i in xrange(2)]
      ]}]example}}
    {td

      Inline [code].

      {[
      let _ = "Block code"
      ]}

      {foo@text[
      Code block with {[inner code block syntax]}
      ]foo}

      {@python[
      [i+1 for i in xrange(2)]
      ]}}}
  {tr
    {th {{!odoc_for_authors.verbatim_blocks}Verbatim} }
    {td
      {example@text[
      {v verbatim text v}]example}}
    {td {v verbatim text v}}}
  {tr
    {th {{!odoc_for_authors.math}Math} }
    {td
      {@text[
      For inline math: {m \sqrt 2}.

      For display math:

      {math \sqrt 2}]}}
    {td
      For inline math: {m \sqrt 2}.

      For display math:

      {math \sqrt 2}}}
  {tr
    {th {{!odoc_for_authors.media}Images} }
    {td
      {@text[
      {image!path/to/file.png}

      {image:https://picsum.photos/200/100}
    ]}}
    {td
      {image!odoc_logo_placeholder.jpg}

      {image:https://picsum.photos/200/100}
    }}
  {tr
    {th {{!odoc_for_authors.tables}Table} }
    {td
      {@text[
      Light syntax:

      {t | Header 1 | Header 2 |
         |----------|----------|
         | Cell 1   | Cell 2   |
         | Cell 3   | Cell 4   |}

      Explicit syntax:

      {table
        {tr
          {th Header 1}
          {th Header 2}}
        {tr
          {td Cell 1}
          {td Cell 2}}
        {tr
          {td Cell 3}
          {td Cell 4}}}]}}
    {td
      Light syntax:

      {t | Header 1 | Header 2 |
         |----------|----------|
         | Cell 1   | Cell 2   |
         | Cell 3   | Cell 4   |}

      Explicit syntax:

      {table
        {tr
          {th Header 1}
          {th Header 2}}
        {tr
          {td Cell 1}
          {td Cell 2}}
        {tr
          {td Cell 3}
          {td Cell 4}}}}}
  {tr
    {th HTML }
    {td
      {example@text[
      {%html:
        <blockquote>
          Odoc language lack support for quotation!
        </blockquote>
      %}]example}}
    {td
      {%html:
        <blockquote>
          Odoc language lack support for quotation!
        </blockquote>
      %}}}
  {tr
    {th {{!page-odoc_for_authors.tags}Tags} }
    {td
      {example@text[
      @since 4.08

      Tags are explained in {{!page-odoc_for_authors.tags}this section}.]example}}
    {td
      Since 4.08.

      Tags are explained in {{!page-odoc_for_authors.tags}this section}.}}}