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

{
  "logo": {
    "light": "/neuraforge-light.png",
    "dark": "/neuraforge-dark.png"
  },
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Examples",
      "link": "/markdown-examples"
    }
  ],
  "sidebar": [
    {
      "text": "Examples",
      "items": [
        {
          "text": "Markdown Examples",
          "link": "/markdown-examples"
        },
        {
          "text": "Runtime API Examples",
          "link": "/api-examples"
        }
      ]
    }
  ],
  "footer": {
    "message": "<a href=\"https://neuraforge.ai\" target=\"_blank\">neuraforge</a> - the AI Operating System for IT",
    "copyright": "Copyright © 2025-present"
  },
  "socialLinks": [
    {
      "icon": "linkedin",
      "link": "https://www.linkedin.com/company/neuraforge"
    },
    {
      "icon": "discord",
      "link": "https://discord.com/invite/CvZAtShmH2"
    },
    {
      "icon": "reddit",
      "link": "https://www.reddit.com/r/neuraforge/"
    }
  ],
  "search": {
    "provider": "local",
    "options": {
      "locales": {
        "en": {
          "translations": {
            "button": {
              "buttonText": "Search",
              "buttonAriaLabel": "Search"
            },
            "modal": {
              "displayDetails": "Show detailed list",
              "resetButtonTitle": "Reset search",
              "backButtonTitle": "Close search",
              "noResultsText": "No results",
              "footer": {
                "selectText": "Select",
                "selectKeyAriaLabel": "Enter",
                "navigateText": "Navigate",
                "navigateUpKeyAriaLabel": "Up Arrow",
                "navigateDownKeyAriaLabel": "Down Arrow",
                "closeText": "Close",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "de": {
          "translations": {
            "button": {
              "buttonText": "Suche",
              "buttonAriaLabel": "Suche"
            },
            "modal": {
              "displayDetails": "Detaillierte Liste anzeigen",
              "resetButtonTitle": "Suche zurücksetzen",
              "backButtonTitle": "Suche schließen",
              "noResultsText": "Keine Ergebnisse",
              "footer": {
                "selectText": "Auswählen",
                "selectKeyAriaLabel": "Eingabe",
                "navigateText": "Navigieren",
                "navigateUpKeyAriaLabel": "Pfeil nach oben",
                "navigateDownKeyAriaLabel": "Pfeil nach unten",
                "closeText": "Schließen",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "es": {
          "translations": {
            "button": {
              "buttonText": "Buscar",
              "buttonAriaLabel": "Buscar"
            },
            "modal": {
              "displayDetails": "Mostrar lista detallada",
              "resetButtonTitle": "Restablecer búsqueda",
              "backButtonTitle": "Cerrar búsqueda",
              "noResultsText": "Sin resultados",
              "footer": {
                "selectText": "Seleccionar",
                "selectKeyAriaLabel": "Enter",
                "navigateText": "Navegar",
                "navigateUpKeyAriaLabel": "Flecha arriba",
                "navigateDownKeyAriaLabel": "Flecha abajo",
                "closeText": "Cerrar",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "it": {
          "translations": {
            "button": {
              "buttonText": "Cerca",
              "buttonAriaLabel": "Cerca"
            },
            "modal": {
              "displayDetails": "Mostra elenco dettagliato",
              "resetButtonTitle": "Reimposta ricerca",
              "backButtonTitle": "Chiudi ricerca",
              "noResultsText": "Nessun risultato",
              "footer": {
                "selectText": "Seleziona",
                "selectKeyAriaLabel": "Invio",
                "navigateText": "Naviga",
                "navigateUpKeyAriaLabel": "Freccia su",
                "navigateDownKeyAriaLabel": "Freccia giù",
                "closeText": "Chiudi",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "ja": {
          "translations": {
            "button": {
              "buttonText": "検索",
              "buttonAriaLabel": "検索"
            },
            "modal": {
              "displayDetails": "詳細リストを表示",
              "resetButtonTitle": "検索をリセット",
              "backButtonTitle": "検索を閉じる",
              "noResultsText": "結果がありません",
              "footer": {
                "selectText": "選択",
                "selectKeyAriaLabel": "Enter",
                "navigateText": "ナビゲート",
                "navigateUpKeyAriaLabel": "上矢印",
                "navigateDownKeyAriaLabel": "下矢印",
                "closeText": "閉じる",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "fr": {
          "translations": {
            "button": {
              "buttonText": "Rechercher",
              "buttonAriaLabel": "Rechercher"
            },
            "modal": {
              "displayDetails": "Afficher la liste détaillée",
              "resetButtonTitle": "Réinitialiser la recherche",
              "backButtonTitle": "Fermer la recherche",
              "noResultsText": "Aucun résultat",
              "footer": {
                "selectText": "Sélectionner",
                "selectKeyAriaLabel": "Entrée",
                "navigateText": "Naviguer",
                "navigateUpKeyAriaLabel": "Flèche haut",
                "navigateDownKeyAriaLabel": "Flèche bas",
                "closeText": "Fermer",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "nl": {
          "translations": {
            "button": {
              "buttonText": "Zoeken",
              "buttonAriaLabel": "Zoeken"
            },
            "modal": {
              "displayDetails": "Gedetailleerde lijst tonen",
              "resetButtonTitle": "Zoekopdracht resetten",
              "backButtonTitle": "Zoeken sluiten",
              "noResultsText": "Geen resultaten",
              "footer": {
                "selectText": "Selecteren",
                "selectKeyAriaLabel": "Enter",
                "navigateText": "Navigeren",
                "navigateUpKeyAriaLabel": "Pijl omhoog",
                "navigateDownKeyAriaLabel": "Pijl omlaag",
                "closeText": "Sluiten",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        },
        "pt": {
          "translations": {
            "button": {
              "buttonText": "Pesquisar",
              "buttonAriaLabel": "Pesquisar"
            },
            "modal": {
              "displayDetails": "Mostrar lista detalhada",
              "resetButtonTitle": "Redefinir pesquisa",
              "backButtonTitle": "Fechar pesquisa",
              "noResultsText": "Nenhum resultado",
              "footer": {
                "selectText": "Selecionar",
                "selectKeyAriaLabel": "Enter",
                "navigateText": "Navegar",
                "navigateUpKeyAriaLabel": "Seta para cima",
                "navigateDownKeyAriaLabel": "Seta para baixo",
                "closeText": "Fechar",
                "closeKeyAriaLabel": "esc"
              }
            }
          }
        }
      }
    }
  }
}

Page Data

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

Page Frontmatter

{
  "outline": "deep"
}

More

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

neuraforge - the AI Operating System for IT