honkit 6.2.2 → 6.2.4

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.
@@ -14,6 +14,23 @@ describe("WebsiteGenerator", () => {
14
14
  });
15
15
  expect(folder).toHaveFile("index.html");
16
16
  }, 60 * 1000);
17
+ longTest("should use structure.readme for index.html even if README.md exists", () => {
18
+ return (0, generateMock_1.default)(website_1.default, {
19
+ "book.json": "{ \"structure\": { \"readme\": \"README.other.md\" } }",
20
+ "SUMMARY.md": "# Summary\n\n* [Default README](README.md)",
21
+ "README.md": "default readme content",
22
+ "README.other.md": "custom readme content"
23
+ }).then((folder) => {
24
+ expect(folder).toHaveFile("index.html");
25
+ expect(folder).toHaveFile("README.html");
26
+ const index = fs_1.default.readFileSync(`${folder}/index.html`, "utf8");
27
+ expect(index).toContain("custom readme content");
28
+ expect(index).not.toContain("default readme content");
29
+ expect(index).toHaveDOMElement(".book-summary a[href=\"README.html\"]");
30
+ const readme = fs_1.default.readFileSync(`${folder}/README.html`, "utf8");
31
+ expect(readme).toContain("default readme content");
32
+ });
33
+ });
17
34
  describe("Glossary", () => {
18
35
  let folder;
19
36
  beforeAll(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"fileToOutput.d.ts","sourceRoot":"","sources":["../../../src/output/helper/fileToOutput.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,UAerC;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"fileToOutput.d.ts","sourceRoot":"","sources":["../../../src/output/helper/fileToOutput.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,UAkBrC;AAED,eAAe,YAAY,CAAC"}
@@ -18,8 +18,12 @@ function fileToOutput(output, filePath) {
18
18
  const book = output.getBook();
19
19
  const readme = book.getReadme();
20
20
  const fileReadme = readme.getFile();
21
- if (path_1.default.basename(filePath, path_1.default.extname(filePath)) == "README" ||
22
- (fileReadme.exists() && filePath == fileReadme.getPath())) {
21
+ const isBookReadme = fileReadme.exists() && filePath == fileReadme.getPath();
22
+ // Other README files become the index of their directory too,
23
+ // except where the book readme (structure.readme) already uses that index
24
+ const isDirectoryReadme = path_1.default.basename(filePath, path_1.default.extname(filePath)) == "README" &&
25
+ !(fileReadme.exists() && path_1.default.dirname(filePath) == path_1.default.dirname(fileReadme.getPath()));
26
+ if (isBookReadme || isDirectoryReadme) {
23
27
  filePath = path_1.default.join(path_1.default.dirname(filePath), `index${OUTPUT_EXTENSION}`);
24
28
  }
25
29
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honkit",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "HonKit is building beautiful books using Markdown.",
5
5
  "keywords": [
6
6
  "git",
@@ -70,12 +70,12 @@
70
70
  "semver": "^7.6.3",
71
71
  "send": "^0.19.2",
72
72
  "tiny-lr": "^1.1.1",
73
- "@honkit/honkit-plugin-fontsettings": "6.2.2",
74
- "@honkit/honkit-plugin-highlight": "6.2.2",
75
- "@honkit/asciidoc": "6.2.2",
76
- "@honkit/honkit-plugin-theme-default": "6.2.2",
77
- "@honkit/html": "6.2.2",
78
- "@honkit/markdown-legacy": "6.2.2"
73
+ "@honkit/asciidoc": "6.2.4",
74
+ "@honkit/honkit-plugin-fontsettings": "6.2.4",
75
+ "@honkit/honkit-plugin-theme-default": "6.2.4",
76
+ "@honkit/html": "6.2.4",
77
+ "@honkit/honkit-plugin-highlight": "6.2.4",
78
+ "@honkit/markdown-legacy": "6.2.4"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@relmify/jest-serializer-strip-ansi": "^1.0.2",
@@ -87,7 +87,7 @@
87
87
  "object-path": "^0.11.8",
88
88
  "rimraf": "^6.0.1",
89
89
  "typescript": "^5.6.2",
90
- "@honkit/internal-test-utils": "6.2.2"
90
+ "@honkit/internal-test-utils": "6.2.4"
91
91
  },
92
92
  "scripts": {
93
93
  "build": "tsc -p .",