@ox-content/vite-plugin 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -26,6 +26,40 @@ crypto = require_chunk.__toESM(crypto);
26
26
  let node_module = require("node:module");
27
27
  let node_fs_promises = require("node:fs/promises");
28
28
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
29
+ //#region src/markdown.ts
30
+ const DEFAULT_MARKDOWN_EXTENSIONS = [
31
+ ".md",
32
+ ".markdown",
33
+ ".mdx"
34
+ ];
35
+ function normalizeMarkdownExtensions(extensions) {
36
+ const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;
37
+ const seen = /* @__PURE__ */ new Set();
38
+ const normalized = [];
39
+ for (const extension of values) {
40
+ const value = extension.startsWith(".") ? extension : `.${extension}`;
41
+ const key = value.toLowerCase();
42
+ if (!seen.has(key)) {
43
+ seen.add(key);
44
+ normalized.push(value);
45
+ }
46
+ }
47
+ return normalized;
48
+ }
49
+ function isMarkdownFilePath(filePath, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
50
+ const pathname = filePath.split("?")[0].split("#")[0].toLowerCase();
51
+ return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));
52
+ }
53
+ function stripMarkdownExtension(filePath, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
54
+ const match = [...extensions].sort((left, right) => right.length - left.length).find((extension) => filePath.toLowerCase().endsWith(extension.toLowerCase()));
55
+ return match ? filePath.slice(0, -match.length) : filePath;
56
+ }
57
+ function markdownGlobPattern(srcDir, extensions) {
58
+ const suffixes = extensions.map((extension) => extension.replace(/^\./, ""));
59
+ if (suffixes.length === 1) return path.join(srcDir, `**/*.${suffixes[0]}`);
60
+ return path.join(srcDir, `**/*.{${suffixes.join(",")}}`);
61
+ }
62
+ //#endregion
29
63
  //#region src/environment.ts
30
64
  /**
31
65
  * Creates the Markdown processing environment configuration.
@@ -58,7 +92,7 @@ function createMarkdownEnvironment(options) {
58
92
  rollupOptions: { external: [/^node:/, /\.node$/] }
59
93
  },
60
94
  resolve: {
61
- extensions: [".md", ".markdown"],
95
+ extensions: options.extensions,
62
96
  conditions: [
63
97
  "markdown",
64
98
  "node",
@@ -6809,6 +6843,58 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
6809
6843
  return String(result);
6810
6844
  }
6811
6845
  //#endregion
6846
+ //#region src/plugins/index.ts
6847
+ /**
6848
+ * Transform all enabled plugins in HTML content.
6849
+ */
6850
+ async function transformAllPlugins(html, options = {}) {
6851
+ const { tabs = true, youtube = true, github = true, ogp, openGraph, mermaid = true, githubToken } = options;
6852
+ let result = html;
6853
+ const ogpOptions = openGraph ?? ogp ?? true;
6854
+ if (tabs) {
6855
+ const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs")).then((n) => n.tabs_exports);
6856
+ result = await transformTabs(result);
6857
+ }
6858
+ if (youtube) {
6859
+ const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs")).then((n) => n.youtube_exports);
6860
+ result = await transformYouTube(result);
6861
+ }
6862
+ if (github !== false) {
6863
+ const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs")).then((n) => n.github_exports);
6864
+ result = await transformGitHub(result, void 0, {
6865
+ token: githubToken,
6866
+ ...typeof github === "object" ? github : {}
6867
+ });
6868
+ }
6869
+ if (ogpOptions !== false) {
6870
+ const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs")).then((n) => n.ogp_exports);
6871
+ result = await transformOgp(result, void 0, typeof ogpOptions === "object" ? ogpOptions : {});
6872
+ }
6873
+ if (mermaid) {
6874
+ const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs")).then((n) => n.mermaid_exports);
6875
+ result = await transformMermaidStatic(result);
6876
+ }
6877
+ return result;
6878
+ }
6879
+ /**
6880
+ * Transform built-in embed components in HTML content.
6881
+ */
6882
+ async function transformBuiltinEmbeds(html, options) {
6883
+ let result = html;
6884
+ if (options.github) {
6885
+ const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs")).then((n) => n.github_exports);
6886
+ result = await transformGitHub(result, void 0, {
6887
+ token: process.env.GITHUB_TOKEN,
6888
+ ...options.github
6889
+ });
6890
+ }
6891
+ if (options.openGraph) {
6892
+ const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs")).then((n) => n.ogp_exports);
6893
+ result = await transformOgp(result, void 0, options.openGraph);
6894
+ }
6895
+ return result;
6896
+ }
6897
+ //#endregion
6812
6898
  //#region src/plugins/mermaid-protect.ts
6813
6899
  /**
6814
6900
  * Extract `<div class="ox-mermaid">...</div>` blocks and replace
@@ -6990,6 +7076,10 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
6990
7076
  const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
6991
7077
  html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
6992
7078
  }
7079
+ html = await transformBuiltinEmbeds(html, options.embeds ?? {
7080
+ github: {},
7081
+ openGraph: {}
7082
+ });
6993
7083
  html = restoreMermaidSvgs(html, svgs);
6994
7084
  return {
6995
7085
  code: generateModuleCode(html, frontmatter, toc, filePath, options),
@@ -8589,36 +8679,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
8589
8679
  }
8590
8680
  }
8591
8681
  //#endregion
8592
- //#region src/plugins/index.ts
8593
- /**
8594
- * Transform all enabled plugins in HTML content.
8595
- */
8596
- async function transformAllPlugins(html, options = {}) {
8597
- const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
8598
- let result = html;
8599
- if (tabs) {
8600
- const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs")).then((n) => n.tabs_exports);
8601
- result = await transformTabs(result);
8602
- }
8603
- if (youtube) {
8604
- const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs")).then((n) => n.youtube_exports);
8605
- result = await transformYouTube(result);
8606
- }
8607
- if (github) {
8608
- const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs")).then((n) => n.github_exports);
8609
- result = await transformGitHub(result, void 0, { token: githubToken });
8610
- }
8611
- if (ogp) {
8612
- const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs")).then((n) => n.ogp_exports);
8613
- result = await transformOgp(result);
8614
- }
8615
- if (mermaid) {
8616
- const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs")).then((n) => n.mermaid_exports);
8617
- result = await transformMermaidStatic(result);
8618
- }
8619
- return result;
8620
- }
8621
- //#endregion
8622
8682
  //#region src/island/parse.ts
8623
8683
  /**
8624
8684
  * Island Parser
@@ -10387,8 +10447,8 @@ function formatTitle(name) {
10387
10447
  /**
10388
10448
  * Collects all markdown files from the source directory.
10389
10449
  */
10390
- async function collectMarkdownFiles$1(srcDir) {
10391
- return (await (0, glob.glob)(path.join(srcDir, "**/*.{md,markdown}"), {
10450
+ async function collectMarkdownFiles$1(srcDir, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
10451
+ return (await (0, glob.glob)(markdownGlobPattern(srcDir, extensions), {
10392
10452
  nodir: true,
10393
10453
  ignore: [
10394
10454
  "**/node_modules/**",
@@ -10430,7 +10490,7 @@ async function buildSsg(options, root) {
10430
10490
  force: true
10431
10491
  });
10432
10492
  } catch {}
10433
- const markdownFiles = await collectMarkdownFiles$1(srcDir);
10493
+ const markdownFiles = await collectMarkdownFiles$1(srcDir, options.extensions);
10434
10494
  const navItems = resolveNavigationGroups(ssgOptions.navigation, base, ssgOptions.extension) ?? (ssgOptions.theme?.sidebar.length ? buildThemeNavItems(ssgOptions.theme.sidebar, base, ssgOptions.extension) : buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension));
10435
10495
  let siteName = ssgOptions.siteName ?? "Documentation";
10436
10496
  if (!ssgOptions.siteName) try {
@@ -10457,8 +10517,8 @@ async function buildSsg(options, root) {
10457
10517
  const pluginOptions = {
10458
10518
  tabs: true,
10459
10519
  youtube: true,
10460
- github: true,
10461
- ogp: true,
10520
+ github: options.embeds.github,
10521
+ openGraph: options.embeds.openGraph,
10462
10522
  mermaid: true,
10463
10523
  githubToken: process.env.GITHUB_TOKEN
10464
10524
  };
@@ -10604,7 +10664,7 @@ function resolveSearchOptions(options) {
10604
10664
  /**
10605
10665
  * Collects all Markdown files from a directory.
10606
10666
  */
10607
- async function collectMarkdownFiles(dir) {
10667
+ async function collectMarkdownFiles(dir, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
10608
10668
  const files = [];
10609
10669
  async function walk(currentDir) {
10610
10670
  try {
@@ -10612,7 +10672,7 @@ async function collectMarkdownFiles(dir) {
10612
10672
  for (const entry of entries) {
10613
10673
  const fullPath = path.join(currentDir, entry.name);
10614
10674
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
10615
- else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
10675
+ else if (entry.isFile() && isMarkdownFilePath(entry.name, extensions)) files.push(fullPath);
10616
10676
  }
10617
10677
  } catch {}
10618
10678
  }
@@ -10622,7 +10682,7 @@ async function collectMarkdownFiles(dir) {
10622
10682
  /**
10623
10683
  * Builds the search index from Markdown files.
10624
10684
  */
10625
- async function buildSearchIndex(srcDir, base) {
10685
+ async function buildSearchIndex(srcDir, base, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
10626
10686
  const napi = await getOxContent();
10627
10687
  if (!napi) return JSON.stringify({
10628
10688
  documents: [],
@@ -10631,13 +10691,12 @@ async function buildSearchIndex(srcDir, base) {
10631
10691
  avg_dl: 0,
10632
10692
  doc_count: 0
10633
10693
  });
10634
- const files = await collectMarkdownFiles(srcDir);
10694
+ const files = await collectMarkdownFiles(srcDir, extensions);
10635
10695
  const documents = [];
10636
10696
  for (const file of files) try {
10637
10697
  const content = await fs_promises.readFile(file, "utf-8");
10638
- const relativePath = path.relative(srcDir, file);
10639
- const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
10640
- const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
10698
+ const id = stripMarkdownExtension(path.relative(srcDir, file), extensions).replace(/\\/g, "/");
10699
+ const url = base + id;
10641
10700
  const extractSearchContent = napi.extractSearchContent;
10642
10701
  if (!extractSearchContent) {
10643
10702
  console.warn("[ox-content] Search not available: extractSearchContent not implemented");
@@ -10732,26 +10791,27 @@ function shouldSkip(url) {
10732
10791
  * Resolve a request URL to a markdown file path.
10733
10792
  * Returns null if no matching file exists.
10734
10793
  */
10735
- async function resolveMarkdownFile(url, srcDir) {
10794
+ async function resolveMarkdownFile(url, srcDir, extensions) {
10736
10795
  let pathname = url.split("?")[0].split("#")[0];
10737
10796
  if (pathname.endsWith("/index.html")) pathname = pathname.slice(0, -11) || "/";
10738
10797
  if (pathname !== "/" && pathname.endsWith("/")) pathname = pathname.slice(0, -1);
10739
- let relativePath;
10740
- if (pathname === "/") relativePath = "index.md";
10741
- else relativePath = pathname.slice(1) + ".md";
10742
- const filePath = path.join(srcDir, relativePath);
10743
- try {
10744
- await fs_promises.access(filePath);
10745
- return filePath;
10746
- } catch {
10747
- const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
10798
+ const routePath = pathname === "/" ? "" : pathname.slice(1);
10799
+ const directCandidates = pathname === "/" ? extensions.map((extension) => `index${extension}`) : isMarkdownFilePath(routePath, extensions) ? [routePath] : extensions.map((extension) => `${routePath}${extension}`);
10800
+ for (const relativePath of directCandidates) {
10801
+ const filePath = path.join(srcDir, relativePath);
10802
+ try {
10803
+ await fs_promises.access(filePath);
10804
+ return filePath;
10805
+ } catch {}
10806
+ }
10807
+ for (const extension of extensions) {
10808
+ const indexPath = path.join(srcDir, routePath, `index${extension}`);
10748
10809
  try {
10749
10810
  await fs_promises.access(indexPath);
10750
10811
  return indexPath;
10751
- } catch {
10752
- return null;
10753
- }
10812
+ } catch {}
10754
10813
  }
10814
+ return null;
10755
10815
  }
10756
10816
  /**
10757
10817
  * Inject Vite HMR client script into the HTML.
@@ -10813,8 +10873,8 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
10813
10873
  transformedHtml = await transformAllPlugins(transformedHtml, {
10814
10874
  tabs: true,
10815
10875
  youtube: true,
10816
- github: true,
10817
- ogp: true,
10876
+ github: options.embeds.github,
10877
+ openGraph: options.embeds.openGraph,
10818
10878
  mermaid: true,
10819
10879
  githubToken: process.env.GITHUB_TOKEN
10820
10880
  });
@@ -10852,7 +10912,7 @@ function createDevServerMiddleware(options, root, cache) {
10852
10912
  let routeUrl = url;
10853
10913
  if (base !== "/" && routeUrl.startsWith(base)) routeUrl = "/" + routeUrl.slice(base.length);
10854
10914
  if (shouldSkip(routeUrl)) return next();
10855
- const filePath = await resolveMarkdownFile(routeUrl, srcDir);
10915
+ const filePath = await resolveMarkdownFile(routeUrl, srcDir, options.extensions);
10856
10916
  if (!filePath) return next();
10857
10917
  try {
10858
10918
  const cached = cache.pages.get(filePath);
@@ -10864,7 +10924,7 @@ function createDevServerMiddleware(options, root, cache) {
10864
10924
  }
10865
10925
  if (!cache.siteName) cache.siteName = await resolveSiteName(options, root);
10866
10926
  if (!cache.navGroups) {
10867
- const markdownFiles = await collectMarkdownFiles$1(srcDir);
10927
+ const markdownFiles = await collectMarkdownFiles$1(srcDir, options.extensions);
10868
10928
  cache.navGroups = resolveNavigationGroups(options.ssg.navigation, base, options.ssg.extension) ?? (options.ssg.theme?.sidebar.length ? buildThemeNavItems(options.ssg.theme.sidebar, base, options.ssg.extension) : buildNavItems(markdownFiles, srcDir, base, options.ssg.extension));
10869
10929
  }
10870
10930
  const html = await renderPage$1(filePath, options, cache.navGroups, cache.siteName, base, root);
@@ -10911,9 +10971,9 @@ function extractTitle(content, frontmatter) {
10911
10971
  const match = content.match(/^#\s+(.+)$/m);
10912
10972
  return match ? match[1].trim() : "";
10913
10973
  }
10914
- function getUrlPath(filePath, srcDir) {
10974
+ function getUrlPath(filePath, srcDir, extensions) {
10915
10975
  let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
10916
- rel = rel.replace(/\.md$/, "");
10976
+ rel = stripMarkdownExtension(rel, extensions);
10917
10977
  if (rel === "index") return "/";
10918
10978
  if (rel.endsWith("/index")) rel = rel.slice(0, -6);
10919
10979
  return "/" + rel;
@@ -10953,10 +11013,7 @@ function validatePage(page, options) {
10953
11013
  }
10954
11014
  async function collectPages(options, root) {
10955
11015
  const srcDir = path.resolve(root, options.srcDir);
10956
- const files = await (0, glob.glob)("**/*.md", {
10957
- cwd: srcDir,
10958
- absolute: true
10959
- });
11016
+ const files = await (0, glob.glob)(markdownGlobPattern(srcDir, options.extensions), { absolute: true });
10960
11017
  const pages = [];
10961
11018
  const generateOgImage = options.ogImage || options.ssg.generateOgImage;
10962
11019
  for (const file of files.sort()) {
@@ -10967,7 +11024,7 @@ async function collectPages(options, root) {
10967
11024
  const description = typeof frontmatter.description === "string" ? frontmatter.description : "";
10968
11025
  const author = typeof frontmatter.author === "string" ? frontmatter.author : "";
10969
11026
  const tags = Array.isArray(frontmatter.tags) ? frontmatter.tags : typeof frontmatter.tags === "string" ? [frontmatter.tags] : [];
10970
- const urlPath = getUrlPath(file, srcDir);
11027
+ const urlPath = getUrlPath(file, srcDir, options.extensions);
10971
11028
  const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
10972
11029
  const page = {
10973
11030
  path: path.relative(srcDir, file),
@@ -11616,7 +11673,11 @@ function sortDiagnostics(diagnostics) {
11616
11673
  }
11617
11674
  //#endregion
11618
11675
  //#region src/lint-files.ts
11619
- const DEFAULT_LINT_FILE_INCLUDE = ["**/*.md", "**/*.markdown"];
11676
+ const DEFAULT_LINT_FILE_INCLUDE = [
11677
+ "**/*.md",
11678
+ "**/*.markdown",
11679
+ "**/*.mdx"
11680
+ ];
11620
11681
  const DEFAULT_LINT_FILE_EXCLUDE = [
11621
11682
  "**/node_modules/**",
11622
11683
  "**/.git/**",
@@ -12323,13 +12384,13 @@ function oxContent(options = {}) {
12323
12384
  configureServer(devServer) {
12324
12385
  devServer.middlewares.use(async (req, res, next) => {
12325
12386
  const url = req.url;
12326
- if (!url || !url.endsWith(".md")) return next();
12387
+ if (!url || !isMarkdownFilePath(url, resolvedOptions.extensions)) return next();
12327
12388
  next();
12328
12389
  });
12329
12390
  },
12330
12391
  resolveId(id) {
12331
12392
  if (id.startsWith("virtual:ox-content/")) return "\0" + id;
12332
- if (id.endsWith(".md")) return id;
12393
+ if (isMarkdownFilePath(id, resolvedOptions.extensions)) return id;
12333
12394
  return null;
12334
12395
  },
12335
12396
  async load(id) {
@@ -12337,14 +12398,14 @@ function oxContent(options = {}) {
12337
12398
  return null;
12338
12399
  },
12339
12400
  async transform(code, id) {
12340
- if (!id.endsWith(".md")) return null;
12401
+ if (!isMarkdownFilePath(id, resolvedOptions.extensions)) return null;
12341
12402
  return {
12342
12403
  code: (await transformMarkdown(code, id, resolvedOptions)).code,
12343
12404
  map: null
12344
12405
  };
12345
12406
  },
12346
12407
  async handleHotUpdate({ file, server }) {
12347
- if (file.endsWith(".md")) {
12408
+ if (isMarkdownFilePath(file, resolvedOptions.extensions)) {
12348
12409
  server.ws.send({
12349
12410
  type: "custom",
12350
12411
  event: "ox-content:update",
@@ -12397,7 +12458,7 @@ function oxContent(options = {}) {
12397
12458
  const srcDir = path.resolve(root, resolvedOptions.srcDir);
12398
12459
  devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
12399
12460
  devServer.watcher.on("add", (file) => {
12400
- if (file.startsWith(srcDir) && file.endsWith(".md")) {
12461
+ if (file.startsWith(srcDir) && isMarkdownFilePath(file, resolvedOptions.extensions)) {
12401
12462
  invalidateNavCache(ssgDevCache);
12402
12463
  devServer.ws.send({
12403
12464
  type: "custom",
@@ -12410,7 +12471,7 @@ function oxContent(options = {}) {
12410
12471
  }
12411
12472
  });
12412
12473
  devServer.watcher.on("unlink", (file) => {
12413
- if (file.startsWith(srcDir) && file.endsWith(".md")) {
12474
+ if (file.startsWith(srcDir) && isMarkdownFilePath(file, resolvedOptions.extensions)) {
12414
12475
  invalidateNavCache(ssgDevCache);
12415
12476
  devServer.ws.send({
12416
12477
  type: "custom",
@@ -12423,7 +12484,7 @@ function oxContent(options = {}) {
12423
12484
  }
12424
12485
  });
12425
12486
  devServer.watcher.on("change", (file) => {
12426
- if (file.startsWith(srcDir) && file.endsWith(".md")) invalidatePageCache(ssgDevCache, file);
12487
+ if (file.startsWith(srcDir) && isMarkdownFilePath(file, resolvedOptions.extensions)) invalidatePageCache(ssgDevCache, file);
12427
12488
  });
12428
12489
  },
12429
12490
  async closeBundle() {
@@ -12463,7 +12524,7 @@ function oxContent(options = {}) {
12463
12524
  const root = config?.root || process.cwd();
12464
12525
  const srcDir = path.resolve(root, resolvedOptions.srcDir);
12465
12526
  try {
12466
- searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
12527
+ searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base, resolvedOptions.extensions);
12467
12528
  console.log("[ox-content] Search index built");
12468
12529
  } catch (err) {
12469
12530
  console.warn("[ox-content] Failed to build search index:", err);
@@ -12494,6 +12555,7 @@ function resolveOptions(options) {
12494
12555
  srcDir: options.srcDir ?? "content",
12495
12556
  outDir: options.outDir ?? "dist",
12496
12557
  base: options.base ?? "/",
12558
+ extensions: normalizeMarkdownExtensions(options.extensions),
12497
12559
  ssg: resolveSsgOptions(options.ssg),
12498
12560
  gfm: options.gfm ?? true,
12499
12561
  footnotes: options.footnotes ?? true,
@@ -12514,9 +12576,25 @@ function resolveOptions(options) {
12514
12576
  docs: resolveDocsOptions(options.docs),
12515
12577
  search: resolveSearchOptions(options.search),
12516
12578
  ogViewer: options.ogViewer ?? true,
12579
+ embeds: resolveBuiltinEmbedOptions(options.embeds),
12517
12580
  i18n: resolveI18nOptions(options.i18n)
12518
12581
  };
12519
12582
  }
12583
+ function resolveBuiltinEmbedOptions(options) {
12584
+ if (options === false) return {
12585
+ github: false,
12586
+ openGraph: false
12587
+ };
12588
+ return {
12589
+ github: resolveSingleEmbedOptions(options?.github),
12590
+ openGraph: resolveSingleEmbedOptions(options?.openGraph)
12591
+ };
12592
+ }
12593
+ function resolveSingleEmbedOptions(options) {
12594
+ if (options === false) return false;
12595
+ if (options === true || options === void 0) return {};
12596
+ return options;
12597
+ }
12520
12598
  function resolveCodeAnnotationsOptions(options) {
12521
12599
  if (!options) return {
12522
12600
  enabled: false,
@@ -12590,12 +12668,14 @@ function normalizeRuntimeBase(base) {
12590
12668
  }
12591
12669
  //#endregion
12592
12670
  exports.DEFAULT_HTML_TEMPLATE = DEFAULT_HTML_TEMPLATE;
12671
+ exports.DEFAULT_MARKDOWN_EXTENSIONS = DEFAULT_MARKDOWN_EXTENSIONS;
12593
12672
  exports.DefaultTheme = DefaultTheme;
12594
12673
  exports.Fragment = Fragment;
12595
12674
  exports.buildSearchIndex = buildSearchIndex;
12596
12675
  exports.buildSsg = buildSsg;
12597
12676
  exports.clearRenderContext = clearRenderContext;
12598
12677
  exports.collectGitHubRepos = require_github.collectGitHubRepos;
12678
+ exports.collectGitHubSources = require_github.collectGitHubSources;
12599
12679
  exports.collectOgpUrls = require_ogp.collectOgpUrls;
12600
12680
  exports.convertVitePressNav = require_vitepress.convertVitePressNav;
12601
12681
  exports.convertVitePressSidebar = require_vitepress.convertVitePressSidebar;
@@ -12608,6 +12688,7 @@ exports.each = each;
12608
12688
  exports.extractDocs = extractDocs;
12609
12689
  exports.extractIslandInfo = extractIslandInfo;
12610
12690
  exports.extractVideoId = require_youtube.extractVideoId;
12691
+ exports.fetchGitHubSource = require_github.fetchGitHubSource;
12611
12692
  exports.fetchOgpData = require_ogp.fetchOgpData;
12612
12693
  exports.fetchRepoData = require_github.fetchRepoData;
12613
12694
  exports.fromVitePressConfig = require_vitepress.fromVitePressConfig;
@@ -12621,6 +12702,7 @@ exports.generateVirtualModule = generateVirtualModule;
12621
12702
  exports.generateVitePressMigrationConfig = require_vitepress.generateVitePressMigrationConfig;
12622
12703
  exports.hasIslands = hasIslands;
12623
12704
  exports.inferType = inferType;
12705
+ exports.isMarkdownFilePath = isMarkdownFilePath;
12624
12706
  exports.jsx = jsx;
12625
12707
  exports.jsxs = jsxs;
12626
12708
  exports.lintMarkdown = lintMarkdown;
@@ -12629,14 +12711,19 @@ exports.lintMarkdownFile = lintMarkdownFile;
12629
12711
  exports.lintMarkdownFiles = lintMarkdownFiles;
12630
12712
  exports.mergeThemes = require_vitepress.mergeThemes;
12631
12713
  exports.mermaidClientScript = require_mermaid.mermaidClientScript;
12714
+ exports.normalizeMarkdownExtensions = normalizeMarkdownExtensions;
12632
12715
  exports.normalizeVitePressFrontmatter = require_vitepress.normalizeVitePressFrontmatter;
12633
12716
  exports.oxContent = oxContent;
12717
+ exports.parseGitHubLineRange = require_github.parseGitHubLineRange;
12718
+ exports.parseGitHubPermalink = require_github.parseGitHubPermalink;
12634
12719
  exports.prefetchGitHubRepos = require_github.prefetchGitHubRepos;
12720
+ exports.prefetchGitHubSources = require_github.prefetchGitHubSources;
12635
12721
  exports.prefetchOgpData = require_ogp.prefetchOgpData;
12636
12722
  exports.raw = raw;
12637
12723
  exports.renderAllPages = renderAllPages;
12638
12724
  exports.renderPage = renderPage;
12639
12725
  exports.renderToString = renderToString;
12726
+ exports.resolveBuiltinEmbedOptions = resolveBuiltinEmbedOptions;
12640
12727
  exports.resolveDocsOptions = resolveDocsOptions;
12641
12728
  exports.resolveI18nOptions = resolveI18nOptions;
12642
12729
  exports.resolveOgImageOptions = resolveOgImageOptions;
@@ -12645,6 +12732,7 @@ exports.resolveSsgOptions = resolveSsgOptions;
12645
12732
  exports.resolveTheme = require_vitepress.resolveTheme;
12646
12733
  exports.setRenderContext = setRenderContext;
12647
12734
  exports.shouldLintMarkdownFile = shouldLintMarkdownFile;
12735
+ exports.stripMarkdownExtension = stripMarkdownExtension;
12648
12736
  exports.transformAllPlugins = transformAllPlugins;
12649
12737
  exports.transformGitHub = require_github.transformGitHub;
12650
12738
  exports.transformIslands = transformIslands;