Skip to content

ランタイムAPIの例

このページでは、VitePressが提供するいくつかのランタイムAPIの使い方を紹介します。

主な useData() API を使うことで、現在のページのサイト、テーマ、ページデータにアクセスできます。これは .md ファイルと .vue ファイルの両方で動作します:

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

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

## 結果

### テーマデータ
<pre>{{ theme }}</pre>

### ページデータ
<pre>{{ page }}</pre>

### ページフロントマター
<pre>{{ frontmatter }}</pre>

結果

テーマデータ

{
  "logo": {
    "light": "/neuraforge-light.png",
    "dark": "/neuraforge-dark.png"
  },
  "nav": [
    {
      "text": "ホーム",
      "link": "/"
    },
    {
      "text": "例",
      "link": "/ja/markdown-examples"
    }
  ],
  "sidebar": [
    {
      "text": "例",
      "items": [
        {
          "text": "マークダウン例",
          "link": "/ja/markdown-examples"
        },
        {
          "text": "API例",
          "link": "/ja/api-examples"
        }
      ]
    }
  ],
  "footer": {
    "message": "<a href=\"https://neuraforge.ai\" target=\"_blank\">neuraforge</a> - ITのためのAIオペレーティングシステム",
    "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"
              }
            }
          }
        }
      }
    }
  }
}

ページデータ

{
  "title": "ランタイムAPIの例",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "ja/api-examples.md",
  "filePath": "ja/api-examples.md"
}

ページフロントマター

{
  "outline": "deep"
}

詳細

ランタイムAPIの全リスト をご覧ください。

neuraforge - ITのためのAIオペレーティングシステム