Skip to content

Commit 94fdc8d

Browse files
committed
fix(viewer): show markdown copy/download on the published site (0.0.5)
The remote docs loader, used on GitHub Pages and by the prebuilt viewer in @gitpagedocs/cli, rendered each markdown file to HTML and dropped the original text, so the copy and download buttons beside the fullscreen button never rendered there. It now reads each file once and keeps the original text in sourceByLanguage next to the HTML, like the local loader. Version markers, docs folder and baselines moved to 0.0.5.
1 parent 97a9a22 commit 94fdc8d

63 files changed

Lines changed: 253 additions & 185 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AUDIT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Known flags: `--build --serve --layoutconfig --full --push --home --search --pat
3939
- `gitpagedocs/config.json` (has `site` + `VersionControl`; no inline UI strings since 1.1.68).
4040
- `site.languages` in `gitpagedocs/config.json` (`{ "en": true, "pt": true, "es": true }`) + `gitpagedocs/langs/<lang>.json` (`langmenu` + `translations` per language; `cli/contracts/languages.mjs`, `cli/contracts/langs-paths.mjs`).
4141
- `gitpagedocs/icon.svg`.
42-
- Per version in `DOC_VERSIONS = [PACKAGE_VERSION]` (`cli/contracts/doc-versions.mjs`; currently `["0.0.4"]`):
42+
- Per version in `DOC_VERSIONS = [PACKAGE_VERSION]` (`cli/contracts/doc-versions.mjs`; currently `["0.0.5"]`):
4343
`gitpagedocs/docs/versions/<v>/config.json` with arrays `routes-md`, `routes-html`, `routes-source-viewer`, `routes-video`, `routes-audio` and their `menus-header-*`, plus `<v>/{pt,en,es}/*.md` from `cli/content/docs-{pt,en,es}.mjs`.
4444
- The source-viewer route points at the GitHub tree URL (`source-viewer-path`), so no HTML snapshot is generated any more; the byte-stable contract covers `config.json` + `langs/*.json` only.
4545
- **Contract invariant** for the refactor = the `config.json` and `langs/*.json` files stay byte-stable (baseline.snapshot.json). `source-viewer` drift is expected.

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
All notable changes to Git Page Docs are documented here. Versions follow semver and count from the
44
0.0.1 baseline below.
55

6+
## 0.0.5 - 2026-09-27 - markdown copy/download on the published site
7+
8+
### Fixed
9+
10+
- The copy and download buttons beside the fullscreen button did not appear on the published site: the
11+
remote docs loader (used on GitHub Pages and by the prebuilt viewer shipped in `@gitpagedocs/cli`)
12+
rendered the markdown to HTML and dropped the original text the buttons need. It now reads each file
13+
once and keeps the original text (`sourceByLanguage`) next to the HTML, like the local loader.
14+
615
## 0.0.4 - 2026-09-27 - AI chat guide, markdown actions, compact config, layouts v2, guide motion
716

817
### Compact gitpagedocs config (no repeated values)

‎README.md‎

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ Generate docs, configure GitHub Pages URL, create workflow, and push:
121121
npx @gitpagedocs/cli --push --owner your-user --repo your-repository
122122
```
123123

124-
Docs deploy at the repository root, e.g. `https://your-user.github.io/your-repository/v/0.0.4/?lang=en`.
124+
Docs deploy at the repository root, e.g. `https://your-user.github.io/your-repository/v/0.0.5/?lang=en`.
125125

126126
Optional `--path` to serve docs in a subpath (e.g. `docs` or `git-page-docs`):
127127

128128
```bash
129129
npx @gitpagedocs/cli --push --owner your-user --repo your-repository --path docs
130130
```
131131

132-
Then docs are at `https://your-user.github.io/your-repository/docs/v/0.0.4/?lang=en`.
132+
Then docs are at `https://your-user.github.io/your-repository/docs/v/0.0.5/?lang=en`.
133133

134134
Shortcut syntax also supported:
135135

@@ -261,8 +261,8 @@ gitpagedocs/
261261
icon.svg
262262
docs/
263263
versions/
264-
0.0.4/config.json
265-
0.0.4/{en,pt,es}/*.md
264+
0.0.5/config.json
265+
0.0.5/{en,pt,es}/*.md
266266
```
267267

268268
Local layout mode adds (at the repository root, next to `gitpagedocs/`):
@@ -381,7 +381,7 @@ All routes for accessing documentation files on the official site or self-hosted
381381
| `lang` | `en`, `pt`, `es` | UI and content language |
382382
| `theme` | layout id (e.g. `aurora-dark`, `aurora-light`) | Active theme; always reflected in URL |
383383
| `modetheme` | `dark`, `light` | Theme mode (legacy; `theme` takes precedence) |
384-
| `version` | e.g. `0.0.4` | Version (alternative to path) |
384+
| `version` | e.g. `0.0.5` | Version (alternative to path) |
385385
| `menu` | `en`, `pt`, `es` | Language for path resolution (use with `id` or `name`) |
386386
| `id` | route id (e.g. `1`, `2`) | Navigate to page by route id |
387387
| `name` | slug (e.g. `getting-started`) | Navigate to page by filename slug |
@@ -408,46 +408,46 @@ https://vidigal-code.github.io/git-page-docs
408408
- Repository default version:
409409
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/?lang=en
410410
- Repository pinned version:
411-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en
411+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en
412412
- Project version path without owner/repo:
413-
https://vidigal-code.github.io/git-page-docs/v/0.0.4/?lang=en
413+
https://vidigal-code.github.io/git-page-docs/v/0.0.5/?lang=en
414414
- Version through query parameter:
415-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/?lang=en&version=0.0.4
415+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/?lang=en&version=0.0.5
416416

417417
**Markdown pages by route id**
418418

419419
- Getting Started (`id=1`):
420-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=1
420+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=1
421421
- Project overview (`id=2`):
422-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=2
422+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=2
423423
- Functionalities (`id=3`):
424-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=3
424+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=3
425425
- GitHub issues and projects (`id=4`):
426-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=4
426+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=4
427427
- Introduction to Git (`id=5`):
428-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=5
428+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=5
429429
- Authorized routes (`id=6`):
430-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=6
430+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=6
431431

432432
**Markdown pages by slug (`name`)**
433433

434434
- Getting Started:
435-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=getting-started
435+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=getting-started
436436
- Project overview:
437-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=project-overview
437+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=project-overview
438438
- Functionalities:
439-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=functionalities
439+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=functionalities
440440
- GitHub issues and projects:
441-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=github-issues-projects
441+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=github-issues-projects
442442
- Introduction to Git:
443-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=git-introduction
443+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=git-introduction
444444
- Authorized routes:
445-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&name=authorized-routes
445+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&name=authorized-routes
446446

447447
**Source viewer**
448448

449449
- Source viewer page inside the docs shell (`id=7`):
450-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=7
450+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=7
451451
- Standalone source viewer root:
452452
https://vidigal-code.github.io/git-page-docs/source-viewer
453453
- Standalone source viewer for this repository:
@@ -459,42 +459,42 @@ https://vidigal-code.github.io/git-page-docs
459459
**Video pages**
460460

461461
- Interactive vs non-interactive modes (`id=8`):
462-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=8
462+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=8
463463
- GitHub issues and projects video (`id=9`):
464-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=9
464+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=9
465465
- Python tutor video (`id=10`):
466-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=10
466+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=10
467467
- Git introduction video (`id=11`):
468-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=11
468+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=11
469469

470470
**Audio pages**
471471

472472
- Audio track (`id=12`):
473-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=12
473+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=12
474474

475475
**Fullscreen modes**
476476

477477
- Markdown fullscreen:
478-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?mdfull=en&file=gitpagedocs/docs/versions/0.0.4/en/getting-started.md
478+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?mdfull=en&file=gitpagedocs/docs/versions/0.0.5/en/getting-started.md
479479
- Video fullscreen by route id:
480-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?videofull=en&id=8
480+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?videofull=en&id=8
481481
- Video fullscreen by slug:
482-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?videofull=en&slug=bdIJkGr2NV0
482+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?videofull=en&slug=bdIJkGr2NV0
483483
- Audio fullscreen by route id:
484-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?audiofull=en&id=12
484+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?audiofull=en&id=12
485485
- Audio fullscreen by slug:
486-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?audiofull=en&slug=0w80F8FffQ4
486+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?audiofull=en&slug=0w80F8FffQ4
487487

488488
**Theme and heading selection**
489489

490490
- aurora-dark theme:
491-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&theme=aurora-dark
491+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&theme=aurora-dark
492492
- aurora-light theme:
493-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&theme=aurora-light
493+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&theme=aurora-light
494494
- Legacy mode parameter:
495-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&modetheme=dark
495+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&modetheme=dark
496496
- Scroll to a Markdown heading (`## Prerequisites` of Getting Started; the anchor is the lower-cased heading with spaces as `-`):
497-
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.4/?lang=en&menu=en&id=1#prerequisites
497+
https://vidigal-code.github.io/git-page-docs/Vidigal-code/git-page-docs/v/0.0.5/?lang=en&menu=en&id=1#prerequisites
498498

499499
**Standalone app routes**
500500

@@ -536,9 +536,9 @@ Example:
536536
{
537537
"id": 6,
538538
"path": {
539-
"en": "gitpagedocs/docs/versions/0.0.4/en/authorized-routes.md",
540-
"pt": "gitpagedocs/docs/versions/0.0.4/pt/authorized-routes.md",
541-
"es": "gitpagedocs/docs/versions/0.0.4/es/authorized-routes.md"
539+
"en": "gitpagedocs/docs/versions/0.0.5/en/authorized-routes.md",
540+
"pt": "gitpagedocs/docs/versions/0.0.5/pt/authorized-routes.md",
541+
"es": "gitpagedocs/docs/versions/0.0.5/es/authorized-routes.md"
542542
},
543543
"authorization": {
544544
"accessKeyId": "docs-key",

‎cli/contracts/doc-versions.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const PACKAGE_VERSION = "0.0.4";
1+
export const PACKAGE_VERSION = "0.0.5";
22

33
export const DOC_VERSIONS = [PACKAGE_VERSION];

‎cli/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitpagedocs/cli",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "CLI that scaffolds and maintains gitpagedocs documentation, generates docs with AI, configures GitHub Pages, and runs the MCP server.",
55
"bin": {
66
"gitpagedocs": "index.mjs"
@@ -29,8 +29,8 @@
2929
},
3030
"dependencies": {
3131
"@clack/prompts": "^1.5.1",
32-
"@gitpagedocs/mcp": "^0.0.4",
33-
"@gitpagedocs/tools": "^0.0.4",
32+
"@gitpagedocs/mcp": "^0.0.5",
33+
"@gitpagedocs/tools": "^0.0.5",
3434
"tsx": "^4.21.0"
3535
},
3636
"repository": {

‎frontend/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitpagedocs/frontend",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"private": true,
55
"description": "Next.js 15 documentation viewer for Git Page Docs (static export).",
66
"scripts": {

‎frontend/src/entities/docs/api/load-remote-docs-data-client.ts‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,34 @@ async function fetchTextByLanguage(
585585
return contentByLanguage;
586586
}
587587

588+
const MD_MISSING_PATH_HTML = "<p>Missing language file path in config.</p>";
589+
const MD_UNAVAILABLE_HTML = "<p>Unable to load remote markdown file.</p>";
590+
591+
/**
592+
* Fetches each language's markdown once: the HTML is rendered for display and
593+
* the original text is kept (readable files only) for the copy / download actions.
594+
*/
595+
async function fetchMarkdownByLanguage(
596+
ctx: PageBuildContext,
597+
pathsByLanguage: Record<LanguageCode, string>,
598+
): Promise<{ markdownByLanguage: Record<LanguageCode, string>; sourceByLanguage: Record<LanguageCode, string> }> {
599+
const markdownByLanguage: Record<LanguageCode, string> = {};
600+
const sourceByLanguage: Record<LanguageCode, string> = {};
601+
await Promise.all(
602+
ctx.availableLanguages.map(async (langCode) => {
603+
const relativePath = pathsByLanguage[langCode];
604+
if (!relativePath) {
605+
markdownByLanguage[langCode] = MD_MISSING_PATH_HTML;
606+
return;
607+
}
608+
const markdown = await fetchRepoText(ctx.owner, ctx.repo, relativePath);
609+
markdownByLanguage[langCode] = markdown ? markdownToHtml(markdown) : MD_UNAVAILABLE_HTML;
610+
if (markdown) sourceByLanguage[langCode] = markdown;
611+
}),
612+
);
613+
return { markdownByLanguage, sourceByLanguage };
614+
}
615+
588616
/** Every available language's value, falling back to `en`, then to `fallback`. */
589617
function localizeByLanguage(valuesByLanguage: Record<LanguageCode, string>, languages: LanguageCode[], fallback: string): Record<LanguageCode, string> {
590618
const localized: Record<LanguageCode, string> = {};
@@ -604,12 +632,10 @@ async function loadMarkdownSection(
604632
if (!mdRoute || !routeHasPath(mdRoute)) {
605633
return undefined;
606634
}
607-
const markdownByLanguage = await fetchTextByLanguage(ctx, mdRoute.path, "<p>Missing language file path in config.</p>", (markdown) =>
608-
markdown ? markdownToHtml(markdown) : "<p>Unable to load remote markdown file.</p>",
609-
);
635+
const { markdownByLanguage, sourceByLanguage } = await fetchMarkdownByLanguage(ctx, mdRoute.path);
610636
const fullscreenEnabled = "fullscreenEnabled" in mdRoute ? mdRoute.fullscreenEnabled : true;
611637
registerLanguagePaths(ctx, mdRoute.path, pageIndex, "md");
612-
return { routeId: id, config: mdRoute, markdownByLanguage, fullscreenEnabled };
638+
return { routeId: id, config: mdRoute, markdownByLanguage, sourceByLanguage, fullscreenEnabled };
613639
}
614640

615641
function resolveSourceViewerPath(rawPath: ContentTypeRouteConfig["source-viewer-path"], preferredLanguage: LanguageCode): string {

‎frontend/src/entities/docs/lib/fallback-layouts.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function buildFallbackLayoutsAndThemes(): {
2020
id: FALLBACK_LAYOUT_ID,
2121
name: "Fallback Dark",
2222
author: "gitpagedocs",
23-
version: "0.0.4",
23+
version: "0.0.5",
2424
mode: "dark",
2525
supportsLightAndDarkModes: false,
2626
colors: {

‎frontend/src/processes/docs-routing/generate-static-params.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { parseOwnerRepoFromUrl } from "@/shared/lib/runtime/parse-owner-repo";
33
import { getRepoFromPackage } from "@/shared/config/repo-from-package";
44
import { isRepositorySearchEnabled } from "@/shared/lib/repository-search";
55

6-
const DEFAULT_VERSIONS = ["0.0.4"];
6+
const DEFAULT_VERSIONS = ["0.0.5"];
77
const FALLBACK_OWNER = "Vidigal-code";
88
const FALLBACK_REPO = "git-page-docs";
99

‎frontend/tests/entities-api/remote-docs-client.test.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,36 @@ describe("loadRemoteDocsData", () => {
431431
expect((await loadRemoteDocsData("o", "r"))?.pages[1].sourceViewer?.sourceViewerPath).toBe("plain");
432432
});
433433
});
434+
435+
describe("remote markdown pages keep the original file text", () => {
436+
it("exposes sourceByLanguage next to the rendered HTML (copy/download need it)", async () => {
437+
stubRepoFetch({
438+
"o/r/gitpagedocs/config.json": minimalConfig(
439+
{
440+
"routes-md": [{ id: 1, path: { en: "docs/en/a.md", pt: "docs/pt/a.md" } }],
441+
"menus-header-md": [{ id: 1 }],
442+
},
443+
{ supportedLanguages: ["en", "pt"] },
444+
),
445+
"o/r/docs/en/a.md": "---\ntitle: x\n---\n# Hello",
446+
"o/r/docs/pt/a.md": "# Ola",
447+
});
448+
449+
const data = await loadRemoteDocsData("o", "r", undefined, "en");
450+
451+
const md = data?.pages[0]?.md;
452+
expect(md?.markdownByLanguage.en).toContain("Hello");
453+
expect(md?.sourceByLanguage).toEqual({ en: "---\ntitle: x\n---\n# Hello", pt: "# Ola" });
454+
});
455+
456+
it("leaves unreadable files out of sourceByLanguage", async () => {
457+
stubRepoFetch({
458+
"o/r/gitpagedocs/config.json": minimalConfig({ "routes-md": [{ id: 1, path: { en: "docs/en/missing.md" } }], "menus-header-md": [{ id: 1 }] }),
459+
});
460+
461+
const data = await loadRemoteDocsData("o", "r", undefined, "en");
462+
463+
expect(data?.pages[0]?.md?.markdownByLanguage.en).toBe("<p>Unable to load remote markdown file.</p>");
464+
expect(data?.pages[0]?.md?.sourceByLanguage).toEqual({});
465+
});
466+
});

0 commit comments

Comments
 (0)