Skip to Content
API DocumentMarkdown editor

Markdown Editor

In the API Repository, you can add both API Specs and markdown files, which are organized in the same way. Markdown files use the .md or .mdx extension. To add one, click the plus icon at the top of the file tree and choose the Markdown Document tab.

Beyond standard markdown syntax, we’ve built in dozens of commonly used components like Tabs, Admonitions, Cards, and more to help you build interactive documentation.

Open a Markdown file and click the pencil to edit it. The editor has four tabs in the upper right:

  • Visual: The page as it is rendered, editable in place. This is the default.
  • Code: The Markdown source, with a preview next to it that updates while you type. Use Toggle Preview in the toolbar to show or hide the preview.
  • Diff: Your changes compared with the file before them
  • Preview: The rendered document

The editor opens in Visual, or in Code when that is the tab you chose last in this browser. Both tabs have the same toolbar, and you can switch between them at any time: they edit the same file. Commit your changes from the Changes tab, as for API specs.

A guide open in the Visual tab, with the toolbar, a callout and numbered steps

Writing in your own editor instead? In a clone of the repository, apigit preview renders the same components on your machine and reloads the page when you save.

The Visual tab

In the Visual tab you write the page as readers will see it. Headings, lists, tables, code blocks, callouts and the other components are shown rendered, and you type into them.

Insert a block

On an empty line, type /. A menu lists the blocks you can insert, in groups, with a preview of the selected one. Type a few letters to filter the list, move with the arrow keys and press Enter. Escape closes the menu.

The slash menu with its list of blocks and a preview of the selected one

The more menu of the toolbar holds the same list. An empty line shows the hint Start typing or press "/" for blocks.

Format text

Select text to get a small bar with Bold, Italic, Strikethrough, Inline code and Link. The toolbar at the top has the same commands, plus headings, quotes, lists and tables.

Move, duplicate and delete blocks

Point at a block to see its handle at the left:

  • Drag the grip to move the block.
  • Click the grip for the Block actions menu: Move up, Move down, Duplicate, Delete.
  • Click + to add an empty block below.

The Block actions menu of a heading

From the keyboard, Alt + ↑ or ↓ moves the block the caret is in, and Ctrl + / (Cmd + / on a Mac) opens its menu.

Tables

With the caret in a table, a bar above it adds and deletes rows and columns, moves a row, sets the alignment of a column and deletes the table. A table has one header row. A cell holds one line of text: a line break or a list typed into a cell is joined into that line, because that is what a Markdown table can store.

Images

Use the image button of the toolbar, paste an image from the clipboard, or drop an image file onto the page. Before a pasted or dropped image is uploaded, a dialog shows the file with its size, the branch and the folder. On Upload the file is committed to assets/images/ on that branch and the image is inserted where you pasted or dropped it.

  • Accepted: PNG, JPEG, GIF, WebP, BMP and SVG, up to 5 MB each.
  • The file name is made safe for an address. When a file of that name exists already, the upload is given a name with the date and time.
  • The file stays in the repository if you later delete the image from the page.

Components

Callouts, Tabs, Steps, Cards, Accordions, Code Groups, Columns, Image Frames, Expandables and Containers are edited as boxes: type into a title or a body, add a tab or a step, and change a component’s properties with the gear in its corner. Which tab of a set is showing is only a view; it is not saved.

Components that have no box of their own, such as Field, Mermaid or Video, are shown rendered, with Edit source to change their Markdown and Done to return. Markup the editor does not recognise is shown as source text, which you can edit in place.

What is written to the file

The Visual tab is built to keep the Markdown in your repository clean:

  • A page you open and do not change is written back exactly as it was.
  • An edit changes only the lines of the block you edited, so the Diff tab and a pull request show only what you meant to change.
  • An attribute or a piece of markup the editor has no control for is kept as it was written.

Blocks you add or change are written in one style: - for bullets, ** for bold and * for italic.

When a page opens in Code

A page opens in the Code tab with a notice when its Markdown cannot be read as a document, or when it is too large for the Visual tab: over 250 KB, or over 50 KB for a page that uses components. Everything else about the page works as usual.

Built in components

APIGIT extends standard Markdown with interactive components. Type / in the Visual tab, or click more in the toolbar of either tab, to insert one. The menu includes:

  • Admonitions: Note, Info, Tip, Warning, Danger, Check, Success, Help
  • Tabs, Expandable, Accordion Group, Card, Card Group, Columns, Code Group, Step
  • Json Schema, Field, Change, Tooltip, Copy Text, Icon
  • Container, Image Frame, Image Background
  • Formula, Video, Embedding and Mermaid Diagrams

For a complete component reference, click Help Docs in the toolbar or visit https://markdown.apigit.com 

Code blocks

Write options after the language of a fenced code block. They can be combined.

```js title="demo.js" lines highlight={2,4-5} const answer = 42; console.log(answer); function hello(name) { return `hello ${name}`; } ```
OptionEffect
title="demo.js"A title row above the code. filename=demo.js does the same
highlight={1,3-5}A background on the listed lines
linesLine numbers. They are not part of a copy or a selection
expandableA block longer than 12 lines starts folded, with Show more
wrapLong lines wrap
copy=falseNo copy button
diff=falseShows [!code ++] and [!code --] markers as written

An option that is written wrongly is ignored, and the block still shows.

Added and removed lines. End a line with a comment holding [!code ++] or [!code --] to tint it as added or removed. The marker itself is not shown. Use the comment style of the language: // [!code ++], # [!code ++], -- [!code ++], /* [!code ++] */ or <!-- [!code ++] -->. The copy button copies the new code: without the removed lines and without the markers. To show the markers as written, for example in a page that explains them, add diff=false to the block’s options.

```yaml openapi: 3.1.0 info: title: Old name # [!code --] title: New name # [!code ++] ```

Tabs that follow each other. Tabs and code groups with the same set of labels share the reader’s choice within a page: choosing Python in one switches the others. On a published document the choice is remembered while the browser tab is open.

Page frontmatter

A Markdown file can start with a frontmatter block. A published page reads three keys from it:

--- title: Getting started description: Install the client and make your first call. noindex: true --- The page starts here.
KeyEffect
titleThe page’s title and browser tab title, instead of the first # heading
descriptionThe page’s description, instead of its first paragraph
noindexWith true, asks search engines not to list this page

The block must be the very first thing in the file, between two lines of ---, and hold keys and values as above; it is then not shown on the page. A page that simply starts with a horizontal rule (---) is not affected. The name and icon of a page in the sidebar are set in the navigation, not here.

Use a Page With AI Tools

Every Markdown page of a published document has a Copy page button at the top right, next to the page title. Click it to copy the page as Markdown; the button reads Copied for a moment. The arrow beside it opens a menu:

  • Copy page: Copy the page as Markdown for LLMs
  • Open in ChatGPT and Open in Claude: Start a chat about the page. For a public document the assistant is given the page’s address and reads it itself. A page that needs a sign-in cannot be fetched that way: a short one is put into the chat for you, and a long one is copied so you can paste it (the menu item says which)
  • Copy MCP server URL, Copy Claude Code command, View as Markdown and Open llms.txt: The addresses an AI agent reads the document at; see Use a published API document with AI agents

Copy page menu on a published page

An API reference has the same button near its title. It copies OpenAPI or AsyncAPI with references resolved, or GraphQL as SDL. The download item names the file format. Agent addresses include generated AsyncAPI and GraphQL pages alongside OpenAPI and Markdown; see Supported API Formats.

Last updated on