mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
121 lines
5.3 KiB
JavaScript
121 lines
5.3 KiB
JavaScript
import {
|
||
u as p,
|
||
c as h,
|
||
o,
|
||
ae as d,
|
||
j as a,
|
||
t,
|
||
k as i,
|
||
a as s,
|
||
} from "./chunks/framework.WowTybjF.js";
|
||
const f = JSON.parse(
|
||
'{"title":"Runtime API Examples","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"api-examples.md","filePath":"api-examples.md"}',
|
||
),
|
||
m = { name: "api-examples.md" },
|
||
E = Object.assign(m, {
|
||
setup(k) {
|
||
const { site: g, theme: n, page: l, frontmatter: r } = p();
|
||
return (c, e) => (
|
||
o(),
|
||
h("div", null, [
|
||
e[0] ||
|
||
(e[0] = d(
|
||
`<h1 id="runtime-api-examples" tabindex="-1">Runtime API Examples <a class="header-anchor" href="#runtime-api-examples" aria-label="Permalink to "Runtime API Examples""></a></h1><p>This page demonstrates usage of some of the runtime APIs provided by VitePress.</p><p>The main <code>useData()</code> API can be used to access site, theme, and page data for the current page. It works in both <code>.md</code> and <code>.vue</code> files:</p><div class="language-md vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">md</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><script setup></span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">import { useData } from 'vitepress'</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">const { theme, page, frontmatter } = useData()</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"></script></span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-light-font-weight:bold;--shiki-dark:#79B8FF;--shiki-dark-font-weight:bold;">## Results</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-light-font-weight:bold;--shiki-dark:#79B8FF;--shiki-dark-font-weight:bold;">### Theme Data</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><pre>{{ theme }}</pre></span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-light-font-weight:bold;--shiki-dark:#79B8FF;--shiki-dark-font-weight:bold;">### Page Data</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><pre>{{ page }}</pre></span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-light-font-weight:bold;--shiki-dark:#79B8FF;--shiki-dark-font-weight:bold;">### Page Frontmatter</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><pre>{{ frontmatter }}</pre></span></span></code></pre></div><h2 id="results" tabindex="-1">Results <a class="header-anchor" href="#results" aria-label="Permalink to "Results""></a></h2><h3 id="theme-data" tabindex="-1">Theme Data <a class="header-anchor" href="#theme-data" aria-label="Permalink to "Theme Data""></a></h3>`,
|
||
6,
|
||
)),
|
||
a("pre", null, t(i(n)), 1),
|
||
e[1] ||
|
||
(e[1] = a(
|
||
"h3",
|
||
{ id: "page-data", tabindex: "-1" },
|
||
[
|
||
s("Page Data "),
|
||
a(
|
||
"a",
|
||
{
|
||
class: "header-anchor",
|
||
href: "#page-data",
|
||
"aria-label": 'Permalink to "Page Data"',
|
||
},
|
||
"",
|
||
),
|
||
],
|
||
-1,
|
||
)),
|
||
a("pre", null, t(i(l)), 1),
|
||
e[2] ||
|
||
(e[2] = a(
|
||
"h3",
|
||
{ id: "page-frontmatter", tabindex: "-1" },
|
||
[
|
||
s("Page Frontmatter "),
|
||
a(
|
||
"a",
|
||
{
|
||
class: "header-anchor",
|
||
href: "#page-frontmatter",
|
||
"aria-label": 'Permalink to "Page Frontmatter"',
|
||
},
|
||
"",
|
||
),
|
||
],
|
||
-1,
|
||
)),
|
||
a("pre", null, t(i(r)), 1),
|
||
e[3] ||
|
||
(e[3] = a(
|
||
"h2",
|
||
{ id: "more", tabindex: "-1" },
|
||
[
|
||
s("More "),
|
||
a(
|
||
"a",
|
||
{
|
||
class: "header-anchor",
|
||
href: "#more",
|
||
"aria-label": 'Permalink to "More"',
|
||
},
|
||
"",
|
||
),
|
||
],
|
||
-1,
|
||
)),
|
||
e[4] ||
|
||
(e[4] = a(
|
||
"p",
|
||
null,
|
||
[
|
||
s("Check out the documentation for the "),
|
||
a(
|
||
"a",
|
||
{
|
||
href: "https://vitepress.dev/reference/runtime-api#usedata",
|
||
target: "_blank",
|
||
rel: "noreferrer",
|
||
},
|
||
"full list of runtime APIs",
|
||
),
|
||
s("."),
|
||
],
|
||
-1,
|
||
)),
|
||
])
|
||
);
|
||
},
|
||
});
|
||
export { f as __pageData, E as default };
|