Home
Content

MkDocs Integration

Point a tab at mkdocs.yml. Sourcey imports the nav, pages, and assets of an existing MkDocs site.

Sourcey imports existing MkDocs projects directly. Point a tab at mkdocs.yml and Sourcey reads the MkDocs configuration, resolves the same markdown files, and renders them as a normal markdown tab. There is no need to copy the sidebar structure into sourcey.config.ts by hand.

Note

Requires Sourcey 3.6.0 or later.

Configuration

Pass the path to your MkDocs config, relative to sourcey.config.ts:

import { defineConfig, mkdocs } from "sourcey";

export default defineConfig({
  navigation: {
    tabs: [
      {
        tab: "Documentation",
        slug: "",
        source: mkdocs("./mkdocs.yml"),
      },
    ],
  },
});

mkdocs({ config: "./mkdocs.yml" }) is the equivalent object form.

What gets ingested

MkDocs conceptHow Sourcey handles it
docs_dirPages resolve relative to it (default docs)
nav (or legacy pages)Top-level sections become sidebar groups; nested sections flatten into the group with Parent / Child labels
Explicit page labelsPreserved as sidebar labels
Snippet includes (--8<-- "file.md")Expanded inline at build time
Admonitions (!!! note, ??? tip)Converted to blockquotes with a bold title, including nested admonitions
Content tabs (=== "Tab")Flattened into sections with bold tab titles
Inline code language markers (`#!python ...`)Stripped
Static assets under docs_dirImages, CSS, JS, PDFs, and similar files are copied into the build output

Loose pages at the top level of nav collect into a "Pages" group. Entries that point at external URLs or anchors are skipped. If the config has no nav at all, Sourcey discovers every .md and .mdx file under docs_dir.

What gets ignored

Only docs_dir and nav (or pages) are read from mkdocs.yml. Theme settings, plugin configuration, and markdown extension options are ignored: Sourcey applies its own theme, search, and markdown pipeline. Python-specific YAML tags (!!python/name:, !ENV) are stripped before parsing so they do not break the import.

Dev server

sourcey dev watches both mkdocs.yml and the docs directory. Edits to either trigger a re-render.

Next steps