Skip to content

Latest commit

History

History
72 lines (54 loc) 路 2.8 KB

write-markdown.mdx

File metadata and controls

72 lines (54 loc) 路 2.8 KB
title description
Write docs content using Markdown
Use Markdown and MDX to add content to your Fern documentation site, including Fern's built-in component library.

Add Markdown or MDX pages

Add pages manually to your documentation by creating Markdown (.md) or MDX (.mdx) files. New to Markdown? See Markdown Guide: Getting started.

NOTE: Throughout our documentation, we refer to both Markdown and MDX as Markdown. [MDX](https://mdxjs.com/) is a version of Markdown, extended to allow the use of JSX components.

Place your pages inside your fern/ folder and link to them from your navigation settings in the docs.yml file.

In the example below, the MDX files are inside a folder named pages/.

```bash fern/ 鈹溾攢 fern.config.json 鈹溾攢 docs.yml 鈹斺攢 pages/ 鈹溾攢 welcome.mdx 鈹斺攢 quickstart.mdx ``` ```yml navigation: - section: Overview contents: - page: Welcome path: ./pages/welcome.mdx - page: Quickstart path: ./pages/quickstart.mdx ```

Page header

Fern automatically generates the <h1> page header for each page from docs.yml. For example, here's the docs.yml entry that maps the page you are reading now:

          - page: Write Markdown content
            path: ./docs/pages/fern-docs/content/write-markdown.mdx

The value for page is used as the content of the top <h1> element of this page. Thus, when adding content to your Markdown pages, begin with <h2> instead of <h1>.

Fern components

Fern has a built-in component library you can use in Markdown. Explore the components.

Links in Markdown

Link target

When clicked, links to relative URLs open in the same tab, whereas links to absolute URLs open in a new browser tab.

Link format

Use a / character to begin a relative URL to another page on your docs site. This routes to the url defined in your docs.yml file, such as example-docs.buildwithfern.com. For example, if you want to link to https://example-docs.buildwithfern.com/overview/introduction, you can write the link in Markdown as follows:

```mdx Read the [Introduction](/learn/overview/introduction). ```

Images

To use images in your Markdown pages, upload them to a service such as Amazon S3 or Google Cloud Storage.

Once you have the URL to your image, use Markdown syntax to insert the image.