Skip to content

Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:

md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

Results

Theme Data

{
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Examples",
      "link": "/docs/what-is-ffmate"
    }
  ],
  "sidebar": [
    {
      "text": "Introduction",
      "items": [
        {
          "text": "What is FFmate",
          "link": "/docs/what-is-ffmate"
        },
        {
          "text": "Getting Started",
          "link": "/docs/getting-started"
        }
      ]
    },
    {
      "text": "FFmate in action",
      "items": [
        {
          "text": "Tasks",
          "link": "/docs/tasks"
        },
        {
          "text": "Wildcards",
          "link": "/docs/wildcards"
        },
        {
          "text": "Presets",
          "link": "/docs/presets"
        },
        {
          "text": "Pre and Post processing",
          "link": "/docs/pre-post-prcessing"
        },
        {
          "text": "Watchfolder",
          "link": "/docs/watchfolder"
        },
        {
          "text": "Webhooks",
          "link": "/docs/webhooks"
        },
        {
          "text": "Web UI",
          "link": "/docs/web-ui"
        }
      ]
    },
    {
      "text": "Advanced",
      "items": [
        {
          "text": "FFmate Internals",
          "link": "/docs/ffmate-internals"
        },
        {
          "text": "Debugging",
          "link": "/docs/debugging"
        },
        {
          "text": "Swagger",
          "link": "/docs/swagger"
        },
        {
          "text": "Flags",
          "link": "/docs/flags"
        }
      ]
    }
  ],
  "search": {
    "provider": "local"
  },
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/welovemedia/ffmate"
    }
  ],
  "editLink": {
    "pattern": "https://github.com/welovemedia/ffmate-docs/edit/main/:path",
    "text": "Edit this page on GitHub"
  },
  "footer": {
    "message": "Released under the SSPL License.",
    "copyright": "Copyright © 2025-present we love media"
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "api-examples.md",
  "filePath": "api-examples.md",
  "lastUpdated": 1741414846000
}

Page Frontmatter

{
  "outline": "deep"
}

More

Check out the documentation for the full list of runtime APIs.

Released under the SSPL License.