Markdown 參考指南

Fuchsia.dev 支援本指南中記錄的 Markdown 元素。

引用文字

Markdown 會使用大於字元 (>) 將文字算繪為區塊引用 (即引號文字)。

Markdown

This is a Markdown paragraph.

> This is a blockquote with two paragraphs. The first line of a blockquote
> paragraph has to have a greater-than character (`>`), but for readability
> in the source file, add a greater-than character to every subsequent line
> of the paragraph like this example. Though this isn't a requirement as
> shown in the second blockquote paragraph below.
>
> This is a second blockquote paragraph that only has a greater-than
character (`>`) for the first line. Donec sit amet nisl. Aliquam semper
ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus
adipiscing. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec,
fringilla in, laoreet vitae, risus.

已轉譯

這是 Markdown 段落。

這是包含兩個段落的引用文字。引用段落的第一行必須包含大於符號 (>);但為了方便閱讀來源檔案,請在段落的後續每一行都加上大於符號,如以下範例所示。不過,這並非必要條件,如下方第二個引用段落所示。

這是第二個段落的引用文字,第一行只有大於符號 (>)。Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

程式碼區塊

程式碼區塊可用於提供程式輔助範例或標記原始碼。程式碼區塊中的內容不會像一般 Markdown 段落一樣經過剖析,而是會照原樣顯示。

您可以使用程式碼區塊指定要以哪種程式設計語言呈現程式碼,以便醒目顯示。

三個倒引號 (```) 前後都必須有空白行。最終輸出內容不會顯示倒引號。 不過,程式碼區塊內的空白行會在最終輸出內容中顯示。

Markdown

Example 1: Uses Java syntax highlighting

```java
public class Hello {

  public static void main(String arg[]) {

    System.out.println("Hello.");
  }
}
```

Example 2: Prevents syntax highlighting

```none {:.devsite-disable-click-to-copy}
Some pseudo-code doesn't need syntax highlighting.
```

Example 3: Includes a replacement variable

```none {:.devsite-disable-click-to-copy}
Hello, my name is {{ '<var>' }}your-name{{ '</var>' }}.
```

產生的 HTML

<p>Example 1: Uses Java syntax highlighting</p>
<pre class="prettyprint lang-java"><code>public class Hello {<br/>public
static void main(String arg[]) {<br/>System.out.println("Hello.");<br/>}
<br/>}<br/></code></pre>
<p>Example 2: Prevents syntax highlighting</p>
<pre class="click-to-copy"><code><br/><p>Some pseudo-code doesn't need
syntax highlighting.</p><br/>
</code></pre>
<p>Example 3: Includes a replacement variable</p>
<pre class="no-prettyprint"><code><br/><p>Hello, my name is <var>your-name</var>.
</p><br/></code></pre>

已轉譯

範例 1:使用 Java 語法醒目顯示

public class Hello {

  public static void main(String arg[]) {

    System.out.println("Hello.");
  }
}

範例 2:禁止語法醒目顯示

Some pseudo-code doesn't need syntax highlighting.

範例 3:包含替換變數

Hello, my name is your-name.

在程式碼區塊中使用可替換的變數

如要在程式碼區塊中使用 <var> 標記,請使用 Jinja 運算式括號,如下所示:

{{ '<var>' }}PORT{{ '</var>' }}

上述範例會產生下列內容:

PORT

留言

Fuchsia.dev 支援 Markdown 和 HTML 中的單行和多行註解。 留言不會顯示在已發布的頁面上。如果文件包含 includecodeMathJax,這些註解有助於提醒協作者。

單行註解

{# This is a single line comment #}

多行註解

如要在 fuchsia.dev 上使用多行註解,請按照下列步驟操作:

使用 {# ... #} 包住每一行。這適用於 HTML 和 Markdown:

{# I wonder how drivers are doing? #}
{# I hear they are awesome! #}

自訂屬性

您可以在 Fuchsia.dev 的 Markdown 檔案中設定自訂 HTML 屬性 (例如 classidattribute='value')。

支援的 Markdown 元素

下列元素支援自訂屬性:

  • 程式碼範圍
  • 程式碼區塊
  • 標題
  • 連結
  • 清單
  • 段落
  • 表格和多行表格

格式

語法 說明
{} 自訂屬性的開始和結束時間。
: 在 fuchsia.dev 中,Markdown 自訂屬性為必填。
. 句號 (.) 後方的字詞會設定元素的 class
# 雜湊符號 (#) 後方的字詞會設定元素的 id
attribute='value' 為元素設定屬性名稱和值配對;使用半形空格分隔配對。

Markdown

This is a Markdown paragraph.
{:.customClass #custom_id attribute='value'}

產生的 HTML

<p class="customClass" id="custom_id" attribute="value">This is a Markdown paragraph.</p>

定義清單

如要在 Markdown 中建立定義清單,請在單行中列出詞彙,然後在定義下方的每一行開頭加上半形冒號 (:)。

Markdown

Apple
: A fruit
: A tech company

Orange
: A citrus fruit

    A definition can also contain other block or inline elements. This is a
    paragraph within the same definition as "A citrus fruit". Elements
    within must be indented four spaces to be recognized as part of the
    preceding definition.

: A color

產生的 HTML

<dl>
  <dt>Apple</dt>
  <dd>A fruit</dd>
  <dd>A tech company</dd>

  <dt>Orange</dt>
  <dd>
    <p>A citrus fruit</p>
    <p>
      A definition can also contain other block or inline elements. This is
      a paragraph within the same definition as "A citrus fruit". Elements
      within must be indented four spaces to be recognized as part of the
      preceding definition.
    </p>
  </dd>
  <dd>
    <p>A color</p>
  </dd>
</dl>

已轉譯

Apple
水果
科技公司
Orange

柑橘類水果

定義也可以包含其他區塊或行內元素。這是與「柑橘類水果」定義相同的段落。元素 必須縮排四個半形空格,才能視為前述定義的一部分。

顏色

強調和強烈

Markdown 會使用星號 (*) 和底線 (_) 進行強調和粗體格式設定。

強調效果

以一個星號 (*) 或底線 (_) 括住的文字會顯示為斜體。

Markdown

*single asterisks*

_single underscores_

supercali*fragilistic*expialidocious

supercali_fragilistic_expialidocious                 // won't format

產生的 HTML

<em>single asterisks</em>

<em>single underscores</em>

supercali<em>fragilistic</em>expialidocious

supercali_fragilistic_expialidocious

已轉譯

單一星號

單一底線

supercalifragilisticexpialidocious

supercali_fragilistic_expialidocious

以兩個星號 (**) 或底線 (__) 括住的文字會以粗體顯示。

Markdown

**double asterisks**

__double underscores__

supercali**fragilistic**expialidocious

supercali__fragilistic__expialidocious

產生的 HTML

<strong>double asterisks</strong>

<strong>double underscores</strong>

supercali<strong>fragilistic</strong>expialidocious

supercali<strong>fragilistic</strong>expialidocious

已轉譯

雙星號

雙底線

supercalifragilisticexpialidocious

supercalifragilisticexpialidocious

逸出

Markdown 中有保留語法,如要使用特殊字元,請使用反斜線逸出 (\) 來顯示下列字元:

\   backslash
`   backtick
*   asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+   plus sign
-   minus sign (hyphen)
.   dot
!   exclamation mark

註腳

如要加入額外或補充內容,但不想打斷網頁流程,附註就是實用的工具。語法與參照連結類似:

In the main text, include a label[^1] that starts with a caret.

[^1]: The footnote content goes here.

[^2]: Longer footnote content can be span multiple lines
    by indenting the continuation 4 spaces.

只要附註標籤以插入號 ^ 開頭,就可以是任意字串。

標題

Markdown 支援 atx 樣式標題,在行開頭使用一到六個雜湊字元 (#),分別對應到第一到第六層標題。

Markdown

# This is an H1

## This is an H2

###### This is an H6

已轉譯

This is an H1

這是 H2

This is an H6

標頭 ID

Fuchsia.dev 支援每個標題的自訂 HTML id 屬性。如要覆寫預設 id,請在 Markdown 標題結尾新增自訂屬性 {#user_defined_name}

Markdown

# Working with contacts {#working-with-contacts}
## Contact Entry
### Contacts are working

產生的 HTML

<h1 id="working-with-contacts">Working with contacts</h1>
<h2 id="contact-entry">Contact Entry</h2>
<h3 id="contacts-are-working">Contacts are working</h3>

目錄

對於每個第二和第三層級的標題,fuchsia.dev 會自動產生網頁的目錄 (TOC)。如要從目錄中隱藏標題,請在標題結尾新增自訂屬性 {:.hide-from-toc}

Markdown

## Hidden in TOC {:.hide-from-toc}             // try to find it!

已轉譯

隱藏在目錄中

水平規則

如要產生水平規則標記 (<hr>),請在一行中加入三個以上的連字號、星號或底線。

下列每一行都會產生水平規則:

* * *

***

*****

- - -

---------------------------------------

圖片

Markdown 使用的圖片語法旨在模仿連結語法,共有兩種樣式可用:內嵌和參照。

每張圖片都有下列屬性:

  • 開頭驚嘆號:!
  • 一組方括號,內含 alt 屬性文字。
  • 一組括號,內含圖片的網址或路徑,以及以雙引號或單引號括住的選用 title 屬性。
  • 使用自訂屬性語法的選用類別集 {: .my-custom-css-class}

如需圖表相關指南,請參閱「在說明文件中加入圖表」。

內嵌語法

以下是有效的內嵌圖片語法:

![Alt text](/docs/images/benchmarking/test_suite_example.png)

![Alt text](/docs/images/benchmarking/test_suite_example.png "Optional title")

![Alt text](/docs/images/benchmarking/test_suite_example.png "Optional title"){: .my-custom-css-class} 

參考語法

以下是參照樣式圖片語法:

![Alt text][ID]

其中 ID 是指已定義圖片參照的名稱。 圖片參照則是使用類似於連結參照的語法來定義。

[ID]: docs/images/benchmarking/test_suite_example.png  "Optional title attribute"

自訂語法

你可以使用下列語法指定 Markdown 圖片的寬度:

![Alt text](/docs/images/benchmarking/test_suite_example.png){: width="123"} 

包含程式碼

includecode 標記包含來自其他檔案的文字區域,尤其是原始碼區域。標記也可以在文字中產生可下載的檔案,而非將文字納入文件中。

您可以使用這個標記,將部分原始碼插入文件,並將該原始碼保留為可執行的檔案。

gerrit_repo+path 參數是指 Gerrit 或 Git 上託管的存放區和路徑。repo 的格式為 instance or repositorypath 的格式為 path/to/file

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" %}

包括檔案的一部分

指定要納入的檔案區域有三種方式:區域標記、規則運算式和縮排區塊。

區域標記

您可以在來源檔案中加入區域標記,指出區域的第一行和最後一行,並提供標記名稱。

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" region_tag="consts" %}

已轉譯:

const BOARD_SIZE uint8 = 9;
const NAME string = "Tic-Tac-Toe";

規則運算式

您也可以使用規則運算式,透過 regexp 參數定義要擷取的區域。 例如:

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" regexp="WRITE = 0b010;" %}

已轉譯:

WRITE = 0b010;

模式會使用 Python 規則運算式語法。詳情請參閱官方 Python 說明文件

縮排區塊

您可以納入函式或類別定義中的程式碼,而不必定義區域標記。使用 indented_block 參數:

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" indented_block="type User" %}

已轉譯:

type User = table {
    1: age uint8;
    2: name string:MAX_STRING_LENGTH;
};

模式會使用 Python 規則運算式語法。詳情請參閱官方 Python 說明文件

參數

以下是 includecode 的選用參數:

Markdown

參數
highlight 選用
您可以使用 highlight 參數,特別標示程式碼的特定部分。 使用半形逗號分隔值,指出要醒目顯示的行。行號是相對於所選區域,而非整個檔案。

範例
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" region_tag="bits" highlight="2,3,4" %}
adjust_indentation 選用
根據預設,includecode 會傳回原始碼的指定區段,包括空白字元。您可以使用 adjust_indentation 選項調整程式碼的縮排。

adjust_indentation 可採用兩個可能的值:
  • number - 整數。這表示每行要取消縮排的空格數。 舉例來說,值為 4 會將行縮排 4 個空格,而 -2 則會將行縮排 2 個空格。
  • 「auto」- 字串 auto。發布工具會根據區域中找到的最少前置空格數,取消所選程式碼的縮排。換句話說,系統會移除程式碼片段中所有行共有的前置空格。
範例
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" region_tag="bits" adjust_indentation="-2" %}
html_escape 選用
根據預設,includecode所有程式碼都會經過 HTML 逸出處理。 您可以將 html_escape 設為 False,取消逸出 HTML。

範例
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/echo.test.fidl" region_tag="launcher" html_escape="False" %}
exclude_regexp 選用
您可以根據規則運算式移除特定行。這項功能可移除留言或其他不相關的內容。您無法使用多行規則運算式。

範例
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/types.test.fidl" region_tag="bits" exclude_regexp="READ" %}

已轉譯

參數
highlight highlight="2,3,4"前:
        bits FileMode : uint16 {
          READ = 0b001;
          WRITE = 0b010;
          EXECUTE = 0b100;
        };
變更後 highlight="2,3,4"
        bits FileMode : uint16 {
          READ = 0b001;
          WRITE = 0b010;
          EXECUTE = 0b100;
        };
adjust_indentation adjust_indentation="-2"前:
        bits FileMode : uint16 {
          READ = 0b001;
          WRITE = 0b010;
          EXECUTE = 0b100;
        };
變更後 adjust_indentation="-2"
            bits FileMode : uint16 {
              READ = 0b001;
              WRITE = 0b010;
              EXECUTE = 0b100;
            };
html_escape html_escape="False"前:
MAX_STRING_LENGTH echo_prefix, request<Echo> request);
變更後 html_escape="True"
MAX_STRING_LENGTH echo_prefix, request request);
exclude_regexp exclude_regexp="READ"前:
      bits FileMode : uint16 {
        READ = 0b001;
        WRITE = 0b010;
        EXECUTE = 0b100;
      };
變更後 exclude_regexp="READ"
      bits FileMode : uint16 {
        WRITE = 0b010;
        EXECUTE = 0b100;
      };

包括 Markdown 片段

您可以使用 << >> 指令 (並附上必要檔案路徑),將 Markdown 檔案納入目前的 Markdown 檔案,以進行正常處理。路徑必須與目前的 .md 來源檔案相對,不得使用絕對路徑。<< >> 指令是區塊指令,因此必須單獨出現在一行。

舉例來說,如果目前的 en/time-travel/example.md 檔案想納入 en/time-travel/_samples/_sample.md 檔案,則應指定:

<<_samples/_sample.md>>

內嵌程式碼

如要在 Markdown 段落中指出程式碼,請使用反引號 (`) 包住文字。

Markdown

Use the `printf()` function. Code for the `printf()` function is located in the `system\ ` directory.

This sentence has inline `  {code}    ` with a lot of spaces but none are rendered.

產生的 HTML

<p>Use the <code>printf()</code> function. Code for the <code>printf()</code>
function is located in the <code>system\</code> directory.</p>
<p>This sentence has inline <code>{code}</code>with a lot of spaces but none
are rendered.</p>

已轉譯

使用 printf() 函式。printf() 函式的程式碼位於 system\ 目錄。

This sentence has inline {code} with a lot of spaces but none are rendered.

內嵌 HTML

Markdown 語法不像 HTML 那樣功能齊全,但 Markdown 支援內嵌 HTML。您可以將文字包裝在 HTML 元素標記中,例如:

Markdown

This sentence is in Markdown with a <b>bold inline HTML tag</b>.

已轉譯

這句話是使用 Markdown 撰寫,並加上粗體內嵌 HTML 代碼

Fuchsia.dev 支援三種連結樣式:內嵌參照外部。 在這兩種樣式中,連結文字會以 [] (方括號) 分隔。

如要建立內嵌連結,請在連結文字結尾方括號後方接著加入一組一般括號。在括號內加入你希望連結指向的網址,以及連結標題 (選擇性),並使用引號括住,例如:

Markdown

This is [an example](https://fuchsia.dev/ "Title") inline link.

[This link](https://fuchsia.dev/) has no title attribute.

產生的 HTML

<p>This is <a href="https://fuchsia.dev/" title="Title">
an example</a> inline link.</p>

<p><a href="fuchsia.dev">This link</a> has no
title attribute.</p>

已轉譯

這是 內嵌連結的範例。

這個連結沒有 title 屬性。

如果要參照本機資源 (例如來源樹狀結構中的檔案),可以使用相對路徑。如需範例,請參閱 docs README

參照樣式連結會使用第二組方括號,在這組方括號內,你必須提供標籤來識別連結:

This is [an example][id] reference-style link.

你可以自行選擇使用空格來分隔括號組:

This is [an example] [id] reference-style link.

接著,你可以在文件底部的某一行中定義連結,就像這樣:

[id]: https://{{example_url}}/  "Optional Title Here"

隱性參照連結可讓你省略連結名稱,此時連結文字本身會當做名稱使用,如要使用隱含參照連結,請使用一組方括號。舉例來說,如要將「Fuchsia」一詞連結至 fuchsia.dev 網站:

[Fuchsia]

接著再定義連結:


連結名稱可以包含空格,因此這也適用於連結文字包含多個字詞的情形:

Visit the [Fuchsia developer site] for more information.

接著再定義連結:


您可以在語法中加入 {: .external},提醒讀者連結會將他們帶往外部網站。例如:

See the [official documentation](https://my_external_website){: .external} for details.

Fuchsia 原始碼或變更的連結不屬於外部連結。

無論在內容中建立 Markdown 連結的方式為何,你都可以連結至 Fuchsia.dev 的各種內容類型:

  • 貢獻者建立的內容,位於 Fuchsia 原始碼樹狀結構的 //docs 目錄中。

    範例:這是連結到 //docs/get-started/learn-fuchsia.md

    [Learn Fuchsia](/docs/get-started/learn-fuchsia.md)
    
  • 自動產生的內容,例如 Fuchsia 來源樹狀結構中不存在的 fuchsia.dev/reference

    範例:這是生成的 API 參考說明文件連結:fuchsia.bluetooth

    [`fuchsia.bluetooth`](https://fuchsia.dev/reference/fidl/fuchsia.bluetooth)
    

    Fuchsia 也有非產生的參考內容,位於 //docs/reference/ 目錄。這類內容可使用 Fuchsia 來源樹狀結構內容語法連結。

  • 連結至網址。這類連結必須標示為「外部」

    範例:這是 google.com 的連結:

    [`google.com`](https://google.com){: .external} 
    

清單

使用 Markdown 語法,即可輕鬆建立項目符號或編號清單。 這類清單通常稱為無序 (即項目符號) 或有序 (即編號) 清單,因為它們是指產生的 (<ul>) 和 (<ol>) HTML 標記。

未排序的清單

未排序清單可以使用星號 (*)、加號 (+) 或破折號 (-) 做為清單標記。無論使用哪個標記,清單的顯示方式都相同。

Markdown

This is a Markdown paragraph:
                                             // required blank line
* Red
* Green
* Blue

This is another Markdown paragraph:
                                            // required blank line
+ Red
+ Green
+ Blue

This is yet another Markdown paragraph:
                                            // required blank line
- Red
- Green
- Blue

產生的 HTML

<p>This is a Markdown paragraph:</p>
<ul>
  <li>Red</li>
  <li>Green</li>
  <li>Blue</li>
</ul>
<p>This is another Markdown paragraph:</p>
<ul>
  <li>Red</li>
  <li>Green</li>
  <li>Blue</li>
</ul>
<p>This is yet another Markdown paragraph:</p>
<ul>
  <li>Red</li>
  <li>Green</li>
  <li>Blue</li>
</ul>

已轉譯

這是 Markdown 段落:

  • 紅色
  • Green
  • Blue

這是另一個 Markdown 段落:

  • 紅色
  • Green
  • Blue

這是另一個 Markdown 段落:

  • 紅色
  • Green
  • Blue

多層未排序清單

在多層級未排序清單中,你可以使用星號 (*)、加號 (+) 或破折號 (-) 做為清單標記。第二層標記必須至少有四個前置空格,且每個層級都必須保持一致。請參考以下範例:

Markdown

This is a Markdown paragraph:
                              // required blank line before parent list
 * Bird
     * Celtics
     * Retired
       * Larry                // extra space; not consistent w/ "Celtics"
 * Magic
     * Lakers

產生的 HTML

<p>This is a Markdown paragraph:</p>
<ul>
  <li>Bird
    <ul>
      <li>Celtics</li>
      <li>Retired</li>
      <ul>
        <li>Larry</li>
      </ul>
    </ul>
  </li>
  <li>Magic
    <ul>
      <li>Lakers</li>
    </ul>
  </li>
</ul>

已轉譯

這是 Markdown 段落:

  • Bird
    • 塞爾提克
    • 已淘汰
      • Larry
  • 魔術
    • 湖人隊

已排序的清單

已排序的清單會在清單項目前使用數字和句號。您可以在有序清單中定義自己的序數,也可以使用 1. 自動編號。請參考以下範例:

Markdown

This is a Markdown paragraph:
                                   // required blank line
1. Bird                            // recommended numbering
1. McHale
1. Parish

This is another Markdown paragraph:
                                   // required blank line
1. Bird                            // sequential numbering is allowed,
2. McHale                          // but not recommended
3. Parish

This is yet another Markdown paragraph:
                                   // required blank line
3. Bird                            // non-sequential numbering is allowed,
1. McHale                          // but not recommended
8. Parish

產生的 HTML

<p>This is a Markdown paragraph:</p>
<ol>
  <li>Bird</li>
  <li>McHale</li>
  <li>Parish</li>
</ol>
<p>This is another Markdown paragraph:</p>
<ol>
  <li>Bird</li>
  <li>McHale</li>
  <li>Parish</li>
</ol>
<p>This is yet another Markdown paragraph:</p>
<ol>
  <li>Bird</li>
  <li>McHale</li>
  <li>Parish</li>
</ol>

已轉譯

這是 Markdown 段落:

  1. Bird
  2. McHale
  3. 教區

這是另一個 Markdown 段落:

  1. Bird
  2. McHale
  3. 教區

這是另一個 Markdown 段落:

  1. Bird
  2. McHale
  3. 教區

多層級已排序清單

您可以建立多層級的編號清單,第二層級的標記必須以至少四個空格開頭。

Markdown

 1. Bird
     1. Lakers
 1. McHale
     1. Celtics

產生的 HTML

<ol>
  <li>Bird
    <ol>
      <li>Lakers</li>
    </ol>
  </li>
  <li>McHale
    <ol>
      <li>Celtics</li>
    </ol>
  </li>
</ol>

已轉譯

  1. Bird
    1. 湖人隊
  2. 阿海
    1. 塞爾提克

MathJax

<devsite-mathjax> 自訂元素可讓您使用 MathJax 2.7,在 fuchsia.dev 內容中顯示數學符號。MathJax 會使用 LaTeX 語法建立數學概念。詳情請參閱 LaTeX 語法指南

用量

如要在文件中使用 MathJax,您必須在文件中加入一次自訂元素:

  {# To see the fully rendered MathJax equations on this page,
  see the published page at https://fuchsia.dev/<PATH_TO_YOUR_DOCUMENT>#}
  <devsite-mathjax config="TeX-AMS-MML_SVG"></devsite-mathjax>

加入自訂元素後,您可以在 $$ block or $ inline.

Standalone block

Markdown

<!-- <devsite-mathjax config="TeX-AMS-MML_SVG"></devsite-mathjax> -->

<div>
  $$
  R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}+\Lambda{g_{\mu\nu}} = \frac{8\pi{G}}{c^4}{T_{\mu\nu}}
 $$
</div>

Rendered

$$ R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}+\Lambda{g_{\mu\nu}} = \frac{8\pi{G}}{c^4}{T_{\mu\nu}} $$ 中撰寫數學概念

Inline

Markdown

<!--Included only one time previously-->
<devsite-mathjax config="TeX-AMS-MML_SVG"></devsite-mathjax>

The area of a circle can be computed using the equation $ A = \pi{r^2} $,
where $ r $ is the radius of the circle, and $ \pi $ is the mathematical
constant that is approximately equal to 3.14159.

Rendered

The area of a circle can be computed using the equation $ A = \pi{r^2} $, where $ r $ is the radius of the circle, and $ \pi $ is the mathematical constant that is approximately equal to 3.14159.

Paragraphs

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line -- a line containing nothing but spaces or tabs is considered blank.) You do not need to indent normal paragraphs with spaces or tabs.

Tables

Markdown makes it easy to format tables with pipes (|) and hyphens (-). Deliminate text with pipes to create columns; a header row is defined when the following row has at least three hyphens for each column header.

Markdown

Lesson                     | Description
------------------------   | ---------------------------------------
What is Fuchsia?           | An open source effort to create a production-grade operating system
What is FIDL?              | Fuchsia Interface Definition Language
Getting Started            | Download the Fuchsia source code

Generated HTML

<table>
  <thead>
    <tr>
      <th>Lesson</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>What is Fuchsia?</td>
      <td>An open source effort to create a production-grade operating system</td>
    </tr>
    <tr>
      <td>What is FIDL?</td>
      <td>Fuchsia Interface Definition Language</td>
    </tr>
    <tr>
      <td>Getting Started</td>
      <td>Download the Fuchsia source code</td>
    </tr>
  </tbody>
</table>

Rendered

Lesson Description
What is Fuchsia? An open source effort to create a production-grade operating system
What is FIDL? Fuchsia Interface Definition Language
Getting Started Download the Fuchsia source code

Formatting text in a table

You can use Markdown syntax to format text within a table (that is, *emphasis*, **strong**, `code`). To align text within a column, add a colon : in the dash --- row to indicate direction (that is, left, center, right) as in the example below:

Markdown

Left-aligned     | Center-aligned | Right-aligned
:---             |     :---:      |          ---:
info             | info           | info
more info        | more info      | more info
even *more* info | some `code`    | **not** code

Rendered

Left-aligned Center-aligned Right-aligned
info info info
more info more info more info
even more info some code not code