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": "/"
}
],
"outline": "deep",
"sidebar": {
"/products/": [
{
"text": "Overview",
"link": "/products/"
},
{
"text": "Getting started",
"collapsed": false,
"items": [
{
"text": "Installation",
"link": "/products/gettingstarted/installation"
},
{
"text": "Klarity AIC Lifecycle",
"link": "/products/gettingstarted/lifecycle"
},
{
"text": "Quick AI Component",
"link": "/products/gettingstarted/quick"
}
]
},
{
"text": "Safenai blueprint",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/products/blueprint"
},
{
"text": "Visual inspection",
"link": "/products/blueprint/visual_inspection",
"collapsed": true,
"items": [
{
"text": "Use case class description",
"link": "/todo"
},
{
"text": "Blueprint content",
"link": "/products/blueprint/visual_inspection"
},
{
"text": "Implementation example",
"link": "/products/blueprint/visual_inspection/example"
}
]
}
]
},
{
"text": "Klarity",
"collapsed": false,
"items": [
{
"text": "Applications",
"link": "/products/klarity/applications"
},
{
"text": "Dashboard",
"link": "products/dashboard/dashboard",
"items": [
{
"text": "Functional workflow",
"link": "products/klarity/dashboard/usage"
},
{
"text": "Contract functionality",
"link": "products/klarity/dashboard/contract"
},
{
"text": "Build functionality",
"link": "products/klarity/dashboard/build"
},
{
"text": "Operate functionality",
"link": "products/klarity/dashboard/operate"
},
{
"text": "Dashboard Layout",
"link": "products/klarity/dashboard/layout"
}
]
},
{
"text": "viewer",
"link": "/products/klarity/viewer/viewer"
},
{
"text": "Craft",
"link": "/products/craft/",
"items": [
{
"text": "Overview",
"link": "/products/klarity/craft/index"
},
{
"text": "Functionality",
"link": "/products/klarity/craft/functionality"
},
{
"text": "Configuration",
"link": "/products/klarity/craft/configuration"
},
{
"text": "Storage",
"link": "/products/klarity/craft/storage"
},
{
"text": "Concept",
"link": "/products/klarity/craft/concept"
},
{
"text": "Todo",
"link": "/products/klarity/craft/todo"
}
]
},
{
"text": "Workbench",
"link": "products/workbench/workbench",
"items": [
{
"text": "With klarity workbench",
"link": "/todo"
},
{
"text": "With you own workbench",
"link": "/todo"
}
]
}
]
},
{
"text": "DataAnvil",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/products/dataanvil/overview"
},
{
"text": "Getting started",
"link": "/products/dataanvil/gettingstarted"
},
{
"text": "Tutorials",
"items": [
{
"text": "Welding",
"link": "products/dataanvil/demonstrations/welding"
},
{
"text": "Woodscape ",
"link": "products/dataanvil/demonstrations/woodscape"
}
]
},
{
"text": "Installation",
"link": "/products/dataanvil/installation"
},
{
"text": "User Documentation",
"link": "/products/dataanvil/userdoc",
"items": [
{
"text": "Concept",
"link": "/products/dataanvil/userdoc/concept"
},
{
"text": "Functionalities",
"link": "/products/dataanvil/functionalities"
}
]
},
{
"text": "Product documentation",
"items": [
{
"text": "Architecture",
"link": "/products/dataanvil/architecture"
},
{
"text": "Roadmap and release",
"link": "/products/dataanvil/roadmap"
},
{
"text": "Quality and test",
"link": "/products/dataanvil/tests"
}
]
}
]
},
{
"text": "Infrastructure",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/products/infrastructure"
},
{
"text": "Access management",
"link": "/products/infrastructure/access_management"
},
{
"text": "Architecture",
"link": "/products/infrastructure/architecture"
},
{
"text": "authentication",
"link": "/products/infrastructure/authentication"
},
{
"text": "k8s-vs-k3s",
"link": "/products/infrastructure/k8s-vs-k3s"
},
{
"text": "mvp-aaa-architecture",
"link": "/products/infrastructure/mvp-aaa-architecture"
},
{
"text": "observability",
"link": "/products/infrastructure/observability"
},
{
"text": "sizing",
"link": "/products/infrastructure/sizing"
}
]
},
{
"text": "Concept ",
"collapsed": false,
"items": [
{
"text": "Definitions",
"link": "/products/concept/concept"
},
{
"text": "AI Component",
"link": "/products/concept/ai_component"
},
{
"text": "AI Component versions",
"link": "/products/concept/version"
}
]
},
{
"text": "Architecture and roadmap",
"collapsed": false,
"items": [
{
"text": "architecture",
"link": "/products/architecture and roadmap/architecture"
},
{
"text": "API and Interfaces",
"link": "/products/architecture and roadmap/interfaces"
},
{
"text": "Capacities",
"link": "/products/architecture and roadmap/capacities"
},
{
"text": "Tools and technos",
"link": "/products/architecture and roadmap/tools_techno"
},
{
"text": "Integration",
"link": "/products/architecture and roadmap/integration"
}
]
},
{
"text": "Not yet integrated",
"collapsed": true,
"items": [
{
"text": "actions",
"link": "/products/actions"
},
{
"text": "Data design elements",
"collapsed": true,
"items": []
}
]
}
],
"/teams/": [
{
"text": "Overview",
"link": "/teams/"
},
{
"text": "Getting started",
"collapsed": false,
"items": [
{
"text": "Installation",
"link": "/todo"
}
]
},
{
"text": "Gitlab usage",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/teams/gitlab/overview"
},
{
"text": "Gitflow",
"link": "/teams/gitlab/flow"
},
{
"text": "CI / CD",
"link": "/teams/gitlab/ci_cd"
},
{
"text": "Git Config",
"link": "/teams/gitlab/gitconfig"
}
]
},
{
"text": "Github usage",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/teams/github/overview"
},
{
"text": "Gitflow",
"link": "/teams/github/flow"
},
{
"text": "CI / CD",
"link": "/teams/github/ci_cd"
}
]
},
{
"text": "Pypi",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/teams/pypi/overview"
}
]
},
{
"text": "Safenai environment",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/teams/environment"
}
]
},
{
"text": "Develompent guidelines",
"collapsed": false,
"items": [
{
"text": "Requierements",
"link": "/teams/opensource"
},
{
"text": "Opensource",
"link": "/teams/opensource"
},
{
"text": "Packaging",
"link": "/teams/packaging"
},
{
"text": "tools and technos",
"link": "/teams/tools_techno"
}
]
}
],
"/artefacts/": [
{
"text": "Artefact Overview",
"link": "/artefacts/core/artefact"
},
{
"text": "Artefact specification",
"link": "artefacts/artefacts"
},
{
"text": "Metrics",
"link": "/artefacts/metrics"
},
{
"items": [
{
"text": "Functional Artefacts",
"items": [
{
"text": "artefact_list",
"link": "/artefacts/core/artefact_list"
},
{
"text": "confusion_matrix",
"link": "/artefacts/core/confusion_matrix"
},
{
"text": "html_content",
"link": "/artefacts/core/html_content"
},
{
"text": "image_overlay",
"link": "/artefacts/core/image_overlay"
},
{
"text": "roc_curve",
"link": "/artefacts/core/roc_curve"
},
{
"text": "value_ratio",
"link": "/artefacts/core/value_ratio"
},
{
"text": "return on investment",
"link": "/artefacts/core/roi"
},
{
"text": "drift",
"link": "/artefacts/core/drift"
}
]
},
{
"text": "Under Specification Artefacts",
"items": [
{
"text": "complex_metric",
"link": "/artefacts/complex_metric/complex_metric"
}
]
}
]
}
],
"/documentations/": [
{
"text": "Overview",
"link": "/documentations"
},
{
"text": "Graphical charter",
"link": "/documentations/graphiccharter"
},
{
"text": "Todo",
"link": "/documentations/todo"
},
{
"text": "Improve documentation",
"collapsed": true,
"items": [
{
"text": "Markdown Examples",
"link": "/documentations/markdown-examples"
},
{
"text": "vitepress interna API",
"link": "/documentations/api-examples"
}
]
}
]
},
"editLink": {
"pattern": "https://gitlab.com/safenai/products/klarity/design/-/tree/main/docs/:path"
},
"lastUpdated": true,
"search": {
"provider": "local"
},
"mermaid": {},
"socialLinks": [
{
"icon": "gitlab",
"link": "https://gitlab.com/safenai/products/documentations"
}
]
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "documentations/api-examples.md",
"filePath": "documentations/api-examples.md",
"lastUpdated": null
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.