> For the complete documentation index, see [llms.txt](https://swu-forge.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swu-forge.gitbook.io/docs/decks/managing-decks/deck-notes.md).

# Deck Notes

The **Notes** tab on a deck page lets the deck owner write freeform commentary about the deck — strategy, mulligan plan, sideboard guide, matchup notes, anything — using **Markdown**. When the deck is shared via a public link, anyone who can view the deck also sees the rendered notes.

## Where to find it

Open any deck (`/decks/<deckId>`) and click the **Notes** tab in the right column toolbar. It sits between **Metrics** and **Draw Sim**.

The tab is always available; if there are no notes yet, owners see an **Add notes** button and visitors see a placeholder line.

## View vs. Edit

* **Visitors** (anyone with link access, plus the owner by default) see only the rendered markdown.
* **Owners** see the same rendered view plus an **Edit** / **Add notes** button. Clicking it opens the editor.

## The editor

The editor uses a two-pane layout:

* **Left pane** — a markdown textarea where you type. Monospaced font, spell-check on.
* **Right pane** — a live preview that updates as you type, sanitized exactly the way visitors will see it.

Above the panes:

* A **character counter** showing your current length and the cap (50,000 characters). The counter turns red and the **Save Notes** button disables when you exceed the cap.
* A **`?` help button** that opens a quick markdown syntax cheat sheet.
* **Cancel** — discards changes and returns to the read-only view.
* **Save Notes** — persists your changes (`PATCH /api/decks/<deckId>/notes`). The page refreshes data on success and shows a **Notes saved** toast.

## Markdown features supported

The renderer is `marked` with GitHub-Flavored Markdown enabled and `breaks: true` (so a single newline becomes a `<br>`). All HTML output is sanitized through DOMPurify before display.

Supported:

* Headings (`#`, `##`, `###`, `####`)
* Bold (`**bold**`) and italic (`*italic*`)
* Bullet lists (`-`) and numbered lists (`1.`)
* Inline `` `code` `` and fenced code blocks
* Block quotes (`> ...`)
* Links (`[label](https://example.com)`)
* Horizontal rule (`---`)
* Tables (GFM pipe-table syntax)

**Stripped for safety:**

* `<script>`, `<iframe>`, `<form>`, `<object>`, `<embed>` tags
* Inline `style`, `onerror`, `onload`, `onclick` attributes
* `javascript:` URLs

## Length limit

Notes are capped at **50,000 characters**. The cap is enforced both client-side (textarea counter + disabled save button) and server-side (`413 Payload Too Large` if exceeded). 50 KB is plenty for legitimate deck commentary; raising the cap is a one-line change in `src/lib/markdown.ts` (`NOTES_MAX_LENGTH`).

## Storage and versioning

Notes live on the `Deck` row directly (`Deck.notes`), **not** on per-version snapshots. Editing notes does not create a new deck version, and switching versions in the version history doesn't change the notes. They're commentary about the deck as a whole, not part of the card list.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://swu-forge.gitbook.io/docs/decks/managing-decks/deck-notes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
