Markdown

    此处的“内联”指可以在段落中找到的元素。包括下面的元素。

    用两个 包围来将其内部的文本显示为粗体。

    斜体

    用单个 * 包围来将其内部的文本显示为斜体。

    1. A paragraph containing an *italicized* word.

    文字

    用一个重音符号 ` 包围的文本将会原封不动地显示出来。

    1. A paragraph containing a `literal` word.

    当文本指代变量名、函数名或者 Julia 程序的其他部分时,应当使用字面量。

    Tip

    为了在字面量中包含一个重音符,需要使用三个重音符而不是一个来包围文本。

    1. A paragraph containing ``` `backtick` characters ```.

    通过扩展,可以使用任何奇数个反引号来包围较少数量的反引号。

    $\LaTeX$

    使用两个重音符的 $\LaTeX$ 语法来包围那些是数学表达式的文本, `` .

    1. A paragraph containing some ``\LaTeX`` markup.

    Tip

    As with literals in the previous section, if literal backticks need to be written within double backticks use an even number greater than two. Note that if a single literal backtick needs to be included within $\LaTeX$ markup then two enclosing backticks is sufficient.

    Note

    The \ character should be escaped appropriately if the text is embedded in a Julia source code, for example, "``\\LaTeX`` syntax in a docstring.", since it is interpreted as a string literal. Alternatively, in order to avoid escaping, it is possible to use the raw string macro together with the @doc macro:

    1. @doc raw"``\LaTeX`` syntax in a docstring." functionname

    Links to either external or internal targets can be written using the following syntax, where the text enclosed in square brackets, [ ], is the name of the link and the text enclosed in parentheses, ( ), is the URL.

    1. A paragraph containing a link to [Julia](http://www.julialang.org).

    It’s also possible to add cross-references to other documented functions/methods/variables within the Julia documentation itself. For example:

    1. """
    2. tryparse(type, str; base)
    3. Like [`parse`](@ref), but returns either a value of the requested type,
    4. or [`nothing`](@ref) if the string does not contain a valid number.
    5. """

    This will create a link in the generated docs to the documentation (which has more information about what this function actually does), and to the nothing documentation. It’s good to include cross references to mutating/non-mutating versions of a function, or to highlight a difference between two similar-seeming functions.

    Note

    The above cross referencing is not a Markdown feature, and relies on , which is used to build base Julia’s documentation.

    1. A paragraph containing a numbered footnote [^1] and a named one [^named].

    Note

    The text associated with a footnote can be written anywhere within the same page as the footnote reference. The syntax used to define the footnote text is discussed in the Footnotes section below.

    The following elements can be written either at the “toplevel” of a document or within another “toplevel” element.

    Paragraphs

    A paragraph is a block of plain text, possibly containing any number of inline elements defined in the section above, with one or more blank lines above and below it.

    A document can be split up into different sections using headers. Headers use the following syntax:

    1. # Level One
    2. ## Level Two
    3. ### Level Three
    4. #### Level Four
    5. ##### Level Five
    6. ###### Level Six

    A header line can contain any inline syntax in the same way as a paragraph can.

    Tip

    Try to avoid using too many levels of header within a single document. A heavily nested document may be indicative of a need to restructure it or split it into several pages covering separate topics.

    Source code can be displayed as a literal block using an indent of four spaces as shown in the following example.

    1. This is a paragraph.
    2. function func(x)
    3. # ...
    4. end
    5. Another paragraph.

    Additionally, code blocks can be enclosed using triple backticks with an optional “language” to specify how a block of code should be highlighted.

    1. A code block without a "language":
    2. ```
    3. function func(x)
    4. # ...
    5. end
    6. ```
    7. and another one with the "language" specified as `julia`:
    8. function func(x)
    9. # ...
    10. end
    11. ```

    Note

    “Fenced” code blocks, as shown in the last example, should be preferred over indented code blocks since there is no way to specify what language an indented code block is written in.

    Text from external sources, such as quotations from books or websites, can be quoted using > characters prepended to each line of the quote as follows.

    1. Here's a quote:
    2. > Julia is a high-level, high-performance dynamic programming language for
    3. > technical computing, with syntax that is familiar to users of other
    4. > technical computing environments.

    Note that a single space must appear after the > character on each line. Quoted blocks may themselves contain other toplevel or inline elements.

    The syntax for images is similar to the link syntax mentioned above. Prepending a ! character to a link will display an image from the specified URL rather than a link to it.

    1. ![alternative text](link/to/image.png)

    Unordered lists can be written by prepending each item in a list with either *, +, or -.

    1. A list of items:
    2. * item one
    3. * item two
    4. * item three

    Note the two spaces before each * and the single space after each one.

    Lists can contain other nested toplevel elements such as lists, code blocks, or quoteblocks. A blank line should be left between each list item when including any toplevel elements within a list.

    1. Another list:
    2. * item one
    3. * item two
    1. f(x) = x
    2. ```
      • sub-item one
      • sub-item two ```

    Note

    The contents of each item in the list must line up with the first line of the item. In the above example the fenced code block must be indented by four spaces to align with the i in item two.

    Ordered lists are written by replacing the “bullet” character, either *, +, or -, with a positive integer followed by either . or ).

    An ordered list may start from a number other than one, as in the second list of the above example, where it is numbered from five. As with unordered lists, ordered lists can contain nested toplevel elements.

    Large $\LaTeX$ equations that do not fit inline within a paragraph may be written as display equations using a fenced code block with the “language” math as in the example below.

    1. ```math
    2. f(a) = \frac{1}{2\pi}\int_{0}^{2\pi} (\alpha+R\cos(\theta))d\theta
    3. ```

    This syntax is paired with the inline syntax for Footnote references. Make sure to read that section as well.

    Footnote text is defined using the following syntax, which is similar to footnote reference syntax, aside from the : character that is appended to the footnote label.

    1. [^1]: Numbered footnote text.
    2. [^note]:
    3. * item one
    4. * item two
    5. * item three
    6. ```julia
    7. function func(x)
    8. # ...
    9. end
    1. Note
    2. No checks are done during parsing to make sure that all footnote references have matching footnotes.
    3. ### [Horizontal rules](#Horizontal-rules)
    4. The equivalent of an `<hr>` HTML tag can be achieved using three hyphens (`---`). For example:

    Text above the line.


    And text below the line.

    1. ### [Tables](#Tables)
    2. Basic tables can be written using the syntax described below. Note that markdown tables have limited features and cannot contain nested toplevel elements unlike other elements discussed above only inline elements are allowed. Tables must always contain a header row with column names. Cells cannot span multiple rows or columns of the table.
    1. Note
    2. As illustrated in the above example each column of `|` characters must be aligned vertically.
    3. A `:` character on either end of a column's header separator (the row containing `-` characters) specifies whether the row is left-aligned, right-aligned, or (when `:` appears on both ends) center-aligned. Providing no `:` characters will default to right-aligning the column.
    4. ### [Admonitions](#Admonitions)
    5. Specially formatted blocks, known as admonitions, can be used to highlight particular remarks. They can be defined using the following `!!!` syntax:

    !!! note

    1. This is the content of the note.

    !!! warning “Beware!”

    1. And this is another one.
    2. This warning admonition has a custom title: `"Beware!"`.
    1. The first word after `!!!` declares the type of the admonition. There are standard admonition types that should produce special styling. Namely (in order of decreasing severity): `danger`, `warning`, `info`/`note`, and `tip`.

    !!! terminology “julia vs Julia”

    ```

    However, unless the code rendering the Markdown special-cases that particular admonition type, it will get the default styling.

    A custom title for the box can be provided as a string (in double quotes) after the admonition type. If no title text is specified after the admonition type, then the type name will be used as the title (e.g. "Note" for the note admonition).

    Admonitions, like most other toplevel elements, can contain other toplevel elements (e.g. lists, images).

    Julia’s markdown supports interpolation in a very similar way to basic string literals, with the difference that it will store the object itself in the Markdown tree (as opposed to converting it to a string). When the Markdown content is rendered the usual show methods will be called, and these can be overridden as usual. This design allows the Markdown to be extended with arbitrarily complex features (such as references) without cluttering the basic syntax.

    In principle, the Markdown parser itself can also be arbitrarily extended by packages, or an entirely custom flavour of Markdown can be used, but this should generally be unnecessary.