# Write in Markdown

Draft with familiar Markdown and produce a PDF or an editable document for collaborators.

Markdown works well for research notes, reports, and early drafts. Oleafly gives it a dedicated formatting toolbar and a Pandoc build path, with source files you can use outside the app.

## Make a report

1. Choose **New project → Use a template → Blank Markdown document**.
2. Name the project **Field notes** and open `main.md`.
3. Paste this example, then choose **Recompile** or press **⌘Enter / Ctrl+Enter**.
4. If Oleafly offers to set up a required engine, complete that setup and compile again.

```markdown title="main.md"
---
title: "Field notes"
author: "Alex Chen"
date: ""
---

# Question

Does the revised procedure reduce measurement time?

## Method

1. Prepare the sample.
2. Repeat the measurement three times.
3. Record the elapsed time.

## Observations

| Run | Time (s) | Note |
| --- | --- | --- |
| 1 | 12 | First pass |
| 2 | 10 | Repeated pass |

The **mean time** will be compared with the baseline.
```

The PDF should include a title, headings, a numbered list, and a table. The metadata between the first pair of `---` lines controls the document title and author.

## Source and Visual editing

Enable **Visual editor** in **Settings → Experimentation** to make the **Code / Visual** switch available. Code edits the Markdown directly. Visual provides formatted editing for supported headings, paragraphs, lists, links, images, and tables.

Underline, highlight, superscript, and subscript are Pandoc formatting controls in Code mode. Their buttons are hidden in Visual mode. Use Code when working with metadata, citation syntax, or other source constructs.

[Download the example source](/examples/writing-example.md)

## Every toolbar tool

Select text before clicking a formatting control. In Code mode, most tools wrap the selection or insert a placeholder. Open **More formatting options** (`…`) to reach controls that do not fit in the bar.

### Code / Visual

Switch editing surfaces when the Visual editor experiment is enabled. The document remains Markdown source.

### Undo

Reverse the last edit. ⌘Z / Ctrl+Z.

### Redo

Restore an undone edit. **⌘Shift+Z / Ctrl+Shift+Z**.

### Heading → Title

Choose **Title** from the heading menu to insert `# Title`. Replace the heading text with your own title.

### Heading → Section

Choose **Section** from the heading menu to insert `## Section`. Replace the heading text with your own title.

### Heading → Subsection

Choose **Subsection** from the heading menu to insert `### Subsection`. Replace the heading text with your own title.

### Heading → Subsubsection

Choose **Subsubsection** from the heading menu to insert `#### Subsubsection`. Replace the heading text with your own title.

### Heading → Minor heading

Choose **Minor heading** from the heading menu to insert `##### Minor heading`. Replace the heading text with your own title.

### Heading → Paragraph heading

Choose **Paragraph heading** from the heading menu to insert `###### Paragraph heading`. Replace the heading text with your own title.

### Bulleted list

Start an unordered list. `- Item`.

### Numbered list

Start a sequence. `1. Item`.

### Task list

In Code mode, add a task and change `[ ]` to `[x]` when complete. `- [ ] Task`.

### Blockquote

Place a quotation on its own line. `> quoted text`.

### Bold

Emphasize selected text. `**text**`; ⌘B / Ctrl+B.

### Italic

Emphasize a term. `*text*`; ⌘I / Ctrl+I.

### Strikethrough

Mark text as superseded. `~~text~~`.

### Inline code

Format a filename, command, or identifier. Text enclosed in backticks.

### Underline

Select a phrase in Code mode. `[text]{.underline}`.

### Highlight

Select a phrase in Code mode. `[text]{.mark}`.

### Superscript

Select the exponent in Code mode. `^text^`.

### Subscript

Select the subscript in Code mode. `~text~`.

Underline and highlight use Pandoc attributes so formatting can travel into the PDF. Use these controls instead of adding raw HTML tags to the manuscript.

### Insert link

In **Code** mode: Inserts `[link text](url)`. Replace both placeholders.

In **Visual** mode: Opens **Link URL**. Enter the address and apply it to your selection. Use **Remove link** to keep the text without the link.

### Insert image

In **Code** mode: Inserts `![caption](image-filename)`. Replace the path and caption.

In **Visual** mode: Opens **Image file**. Enter a project path such as `figures/plot.png` and apply it.

### Insert table

In **Code** mode: Inserts three columns, a header, and two data rows. Replace the column names and cells.

In **Visual** mode: Inserts an editable table with the same starting dimensions.

### Project information

In **Code** mode: Shows project statistics and selection information.

In **Visual** mode: Shows statistics for the visual editing surface.

### Find

In **Code** mode: Opens the active file's search with ⌘F / Ctrl+F.

In **Visual** mode: The source toolbar's Find button is hidden.

Import the image through the file tree before referencing it. Keep image paths relative to the manuscript, so the source archive works on another computer.

## Equations and code blocks

Write inline mathematics as `$x^2$`. Put a display equation between two pairs of dollar signs:

```markdown
$$
\bar{x} = \frac{1}{n}\sum_{i=1}^{n}x_i
$$
```

For a code sample, enclose the code in triple backticks and put its language after the opening fence. These are source constructs; the Markdown toolbar does not have a separate equation or fenced-code-block button.

## Citations and bibliography

Import or create `references.bib`, add `bibliography: references.bib` to the YAML metadata, and cite an existing key with `[@citation-key]`. Pandoc uses the bibliography to produce formatted citations and a reference list.

[Find and manage references →](/docs/citations/)

## Import and export

To keep an existing draft in Markdown, create a Blank Markdown document, paste the draft into `main.md`, and import its images and bibliography. The library's separate **Markdown document** import currently converts a draft to LaTeX. [Import routes](/docs/import-project/) explains both paths.

Compile for PDF, or use **Export** to create Word, HTML, or plain text. Use a source ZIP to share the original Markdown and its assets. [Export your work](/docs/export/) covers the sequence and the checks to make in the converted file.
