Writing syntax

Plain Markdown works as is. These additions give you colors, merged cells, numbered equations, cover pages and more.

Plain Markdown works as is. These are the extra things md-to-pdf-word understands; PDF and Word output look the same.

Document information

At the very top of the file (optional):

---
title: Report title
subtitle: Subtitle
author: Author / team
date: today          # replaced by today's date
abstract: A short summary.
page-size: A4        # A4 / A5 / B5 / 16K / letter / 17x24cm
number-sections: true
header: none         # no running header
heading-color: 365F91          # heading color (one per level: 365F91,4F81BD)
title-color: 17365D            # title-size: 26
caption-color: 4F81BD          # caption-size: 9  caption-bold: true
---

Without a title, no title block is printed.

Headings

# level 1 … ##### level 5. For automatic numbering set Heading numbers → Numbered under More options (AI assistants use the parameter number_sections=true); then don't type numbers like “1.1” yourself.

Text styles

Effect Write
Bold / italic / strikethrough **bold** *italic* ~~struck~~
Underline [text]{.underline} or <u>text</u>
Double / wavy underline [text]{.double-underline} / [text]{.wave}
Box [text]{.frame}
Small caps [Small Caps]{.smallcaps}
Highlight ==text== or [text]{bg=yellow}
Color [text]{color=red}, [text]{color="#C00000"}, [text]{color=primary} (style color)
Background [text]{bg=green} / bg="#FFE0B2"
Size [text]{size=14pt}, size=large, Chinese sizes such as size=四号
Font [text]{font=serif} (serif / sans / mono, or Chinese 宋体 / 黑体 / 楷体 / 仿宋)
Combined [text]{color=red size=12pt font=sans .bold .underline}
Superscript / subscript E=mc^2^, H~2~O
Inline code `code`
  • Color names: red blue green orange purple gray black yellow pink brown cyan teal navy, or #RRGGBB, rgb(…).
  • Sizes: 12pt, 16px, 1.2em, or Chinese sizes 初号 小初 一号 小一 二号 小二 三号 小三 四号 小四 五号 小五 六号.
  • Switches can be written plainly: underline strike bold italic.
  • HTML works too: <span style="color:#c00;font-size:16px;font-weight:bold">…</span>, <font color="red">, <mark>, <br>.
  • Nested spans inherit: [a blue sentence, [with a larger red part]{color=red size=16pt}, then blue again]{color=blue}.

Paragraph styles

::: {align=center}
A centered paragraph (right / left / justify likewise)
:::

::: {align=center size=16pt color=primary font=sans}
One style for the whole block
:::

<div style="text-align:center">…</div> also works. An image on its own line is centered automatically.

Callouts

> [!NOTE]
> Something to note (also TIP / IMPORTANT / WARNING / CAUTION)

::: warning
A callout with several paragraphs.
:::

::: {.tip title="Custom title"}
Content
:::

Tables

  • Regular tables | a | b |, aligned with :--- :---: ---:; a line : Table title under the table adds a numbered caption.
  • Header rows are bold; column widths follow the content and long text wraps inside the page; long tables continue across pages.
  • Merged cells: use an HTML table:
<table>
  <caption>Table title</caption>
  <tr><th rowspan="2">Product</th><th colspan="2">Figures</th></tr>
  <tr><th>Revenue</th><th>Profit</th></tr>
  <tr><td>A</td><td>1</td><td>2</td></tr>
</table>

Grid tables (+---+---+) also support merged cells. - Cells may contain colors, bold text, links and inline code.

Images

![Caption (numbered “Figure N”)](images/chart.png){width=70%}
![](https://example.com/a.jpg){width=50%}
  • png / jpg / gif / svg / webp / bmp / tiff. Upload local images together with the document (dropping the whole folder is easiest); web images are downloaded automatically.

  • With a caption → numbered figure; without → just the image. A missing image becomes gray placeholder text instead of breaking the conversion.

  • A caption that already has a number (![Figure 3-1 Architecture](a.png)) keeps it.

  • Sub-figures side by side with (a) (b) labels:

    ::: {#fig:pair .subfigures}
    ![Left](a.png){width=45%} ![Right](b.png){width=45%}
    
    Caption for both
    :::

Equations

Inline $E=mc^2$ or \(…\); display $$…$$ or \[…\] — the full standard math notation (matrices, integrals, sums…). In Word they become editable equations. Prices like “$100 and $200” are not mistaken for math.

Footnotes, quotes, lists, code

  • Footnotes: text[^1] + [^1]: the note, or inline ^[the note].
  • Quotes: > quoted text.
  • Lists: - / 1., nestable; task lists - [x]; no blank line needed before a list.
  • Code blocks: ```python; long lines wrap.

Page breaks and contents

  • Page break: a line with only \newpage, <!-- pagebreak -->, or ::: pagebreak + :::.
  • Table of contents: a line with only [TOC] where you want it; or tick Table of contents under More options (AI assistants: toc=true) to place it after the title.

Advanced layout

  • Landscape pages: put wide tables or figures between ::: landscape and :::.
  • Numbered equations: $$ V=\frac{a}{r} $$ {#eq:yield} is numbered (1), (2)…; [@eq:yield] in the text prints “Eq. (1)” as a link.
  • Table, figure and section references: : Caption {#tbl:name}, ![Caption](a.png){#fig:name}, ## Heading {#sec:name}; [@tbl:name] → “Table 1”.
  • References: add bibliography: refs.bib to the document information (upload the .bib too); cite with [@key] or [@a; @b] → [1], [2,3]; the reference list is generated in GB/T 7714—2015 style.
  • Part contents: a line [本部分目录] under a part heading lists only that part's sections.
  • Restart page numbers: a line [页码重置] where a new part begins.
  • Page references: see page [@page:sec:name] → “see page 5”; a missing target is marked in red and reported.
  • Appendices: a line [附录] starts the appendices; each level-1 heading after it becomes “Appendix A …” on a new page, with numbers such as Table A.1, Figure B.1, (A.1).

Cover page

Add cover: to the document information; the cover is its own page and body page numbers start at 1:

title: Property valuation report
cover:
  logo: logo.png                     # optional
  number: Report No. 2026-0123       # optional
  items:                             # optional: aligned labels, underlined values
    - Client: Example Bank
    - Valuer: Jane Doe
  org: Example Valuation Ltd.
  date: today

cover: true alone makes a simple cover from title / subtitle / author / date.

Chinese official documents (GB/T 9704)

A gongwen: block switches to the official document layout (or choose the “Gov. document” style): 156 × 225 mm text block, size-3 Fangsong, 22 lines × 28 characters, page numbers “— 1 —” right on odd and left on even pages. The keys are in Chinese, as in the standard:

title: 关于做好2026年度安全生产工作的通知
gongwen:
  份号: "000123"             # all optional; missing elements are left out
  密级: 机密★1年              # classification
  紧急程度: 特急              # urgency
  发文机关标志: 某某市人民政府文件   # red header
  发文字号: 某政发〔2026〕12号      # issue number
  签发人: 张三                # signer (upward documents)
  主送机关: 各区县人民政府,市政府各部门:   # recipients
  发文机关署名: 某某市人民政府     # issuing authority (signature)
  成文日期: 2026-10-24       # date, written as 2026年10月24日; today works
  印章: 是                   # 是 = sealed layout, 否 = unsealed
  附注: (此件公开发布)       # note
  抄送: 市委各部门。          # copies to
  印发机关: 某某市人民政府办公室   # printed by
  印发日期: 2026-10-24       # printing date
  • Heading levels: # 一、… (Heiti), ## (一)… (Kaiti), ### 1. …, #### (1)… (Fangsong); with heading numbers on, the numerals are added for you.
  • Attachments: wrap each in ::: 附件 … :::; its first heading is the attachment's title. They start on new pages and are listed after the body text.
  • In Word, a bold Song typeface replaces FZXiaoBiaoSong for titles; if your readers have it installed, add heading-font: 方正小标宋简体.

Good to know

  • Don't wrap the whole document in a ```markdown code block (if you do, the wrapper is removed).
  • Emoji and rare symbols use fallback fonts in the PDF; Word keeps the original characters.

Writing syntax

Open as a page

Loading…

Send feedback

Tell us what went wrong or what would make this better. We read every message.

Prefer another way? Email · GitHub