Search code examples
functionmkdocs

how to write a function syntax in mkdocs


what syntax of markdown do I need to write the api like below. enter image description here

the html code is below:
link

<dl class="function">
<dt id="create_bootstrap_script">
<code class="descname">create_bootstrap_script</code><span class="sig-paren">(</span><em>extra_text</em><span class="sig-paren">)</span><a class="headerlink" href="#create_bootstrap_script" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a bootstrap script from <code class="docutils literal"><span class="pre">extra_text</span></code>, which is like
this script but with extend_parser, adjust_options, and after_install hooks.</p>
</dd></dl>

<p>This returns a string that (written to disk of course) can be used
as a bootstrap script with your own customizations. The script
will be the standard virtualenv.py script, with your extra text
added (your extra text should be Python code).</p>
<p>If you include these functions, they will be called:</p>

I've tried to use syntax like this, but turn out to be just like but not the same.

    Orange(a, b)
:   The fruit of an evergreen tree of the genus Citrus.

enter image description here

Every answer will be appreciated.


Solution

  • In the first example the dt is a codespan which has had syntax highlighting applied.

    In the second example, the dt only contains plain text. You can get closer by using a code span as well:

    `Orange(a, b)`
    :   The fruit of an evergreen tree of the genus Citrus.
    

    Notice that the first line is wrapped in backticks (`) which makes it a code span. Of course, you still need syntax highlighting to get an exact match, but MkDocs does not currently support syntax highlighting for code spans, only code blocks. Presumably the virtualenv docs were built using Sphinx rather than MkDocs. While MkDocs comes close to matching Sphinx in looks, it does not match feature for feature and this is one of the differences. That said, it may be possible with a custom theme and/or using some custom Markdown Extensions.