@honkit/asciidoc 5.1.5 → 6.0.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/lib/toHTML.js CHANGED
@@ -10,12 +10,12 @@ const asciidocToHTML = (content, options) => {
10
10
  return asciidoctor.convert(content, {
11
11
  safe: "server",
12
12
  attributes: { showtitle: "", icons: "font@" },
13
- base_dir: options === null || options === void 0 ? void 0 : options.baseDirectory
13
+ base_dir: options?.baseDirectory
14
14
  });
15
15
  };
16
16
  // Render Asciidoc to HTML (inline)
17
17
  const asciidocToHTMLInline = (content, options) => {
18
- return asciidoctor.convert(content, { doctype: "inline", base_dir: options === null || options === void 0 ? void 0 : options.baseDirectory });
18
+ return asciidoctor.convert(content, { doctype: "inline", base_dir: options?.baseDirectory });
19
19
  };
20
20
  exports.default = {
21
21
  block: asciidocToHTML,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honkit/asciidoc",
3
- "version": "5.1.5",
3
+ "version": "6.0.0",
4
4
  "description": "Parse AsciiDoc content for gitbook",
5
5
  "homepage": "https://github.com/honkit/honkit",
6
6
  "bugs": {
@@ -36,17 +36,18 @@
36
36
  "prepublish": "npm run --if-present build"
37
37
  },
38
38
  "dependencies": {
39
- "@honkit/html": "^5.1.5",
40
- "asciidoctor": "^2.2.0",
41
- "lodash": "^4.13.1"
39
+ "@honkit/html": "6.0.0",
40
+ "asciidoctor": "^2.2.8",
41
+ "lodash": "^4.17.21"
42
42
  },
43
43
  "devDependencies": {
44
- "jest": "^29.0.3",
45
- "ts-jest": "^29.1.1"
44
+ "@types/jest": "^29.5.13",
45
+ "jest": "^29.7.0",
46
+ "ts-jest": "^29.2.5"
46
47
  },
47
48
  "publishConfig": {
48
49
  "access": "public"
49
50
  },
50
51
  "authors": "azu <azuciao@gmail.com>",
51
- "gitHead": "d75ed67c85e3fc6976e837b56402f84e860886c7"
52
+ "gitHead": "367fe659a4a33c656ae51a1ec75fff0447365f9f"
52
53
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=glossary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glossary.d.ts","sourceRoot":"","sources":["../../src/__tests__/glossary.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
8
- const assert_1 = __importDefault(require("assert"));
9
- const __1 = __importDefault(require("../"));
10
- let LEXED;
11
- beforeAll(() => {
12
- const CONTENT = fs_1.default.readFileSync(path_1.default.join(__dirname, "fixtures/GLOSSARY.adoc"), "utf8");
13
- LEXED = __1.default.glossary(CONTENT);
14
- });
15
- it("should only get heading + paragraph pairs", () => {
16
- assert_1.default.equal(LEXED.length, 4);
17
- });
18
- it("should output simple name/description objects", () => {
19
- assert_1.default.equal(true, !LEXED.some((e) => {
20
- return !Boolean(e.name && e.description);
21
- }));
22
- });
23
- it("should correctly convert it to text", () => {
24
- const text = __1.default.glossary.toText(LEXED);
25
- assert_1.default.deepEqual(__1.default.glossary(text), LEXED);
26
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=inline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/__tests__/inline.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const assert_1 = __importDefault(require("assert"));
7
- const __1 = __importDefault(require("../"));
8
- it("should render inline AsciiDoc", function () {
9
- assert_1.default.equal(__1.default.inline("Hello **World**").content, "Hello <strong>World</strong>");
10
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=langs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"langs.d.ts","sourceRoot":"","sources":["../../src/__tests__/langs.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
8
- const assert_1 = __importDefault(require("assert"));
9
- const __1 = __importDefault(require("../"));
10
- var LEXED;
11
- beforeAll(function () {
12
- var CONTENT = fs_1.default.readFileSync(path_1.default.join(__dirname, "./fixtures/LANGS.adoc"), "utf8");
13
- LEXED = __1.default.langs(CONTENT);
14
- });
15
- it("should detect paths and titles", function () {
16
- assert_1.default.equal(LEXED[0].ref, "en/");
17
- assert_1.default.equal(LEXED[0].title, "English");
18
- assert_1.default.equal(LEXED[1].ref, "fr/");
19
- assert_1.default.equal(LEXED[1].title, "French");
20
- });
21
- it("should correctly convert it to text", function () {
22
- var text = __1.default.langs.toText(LEXED);
23
- assert_1.default.deepEqual(__1.default.langs(text), LEXED);
24
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/__tests__/page.ts"],"names":[],"mappings":""}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = __importDefault(require("path"));
7
- const fs_1 = __importDefault(require("fs"));
8
- const assert_1 = __importDefault(require("assert"));
9
- const __1 = __importDefault(require("../"));
10
- it("should gen content", function () {
11
- const CONTENT = fs_1.default.readFileSync(path_1.default.join(__dirname, "./fixtures/PAGE.adoc"), "utf8");
12
- const LEXED = __1.default.page(CONTENT);
13
- (0, assert_1.default)(LEXED.content);
14
- });
15
- it("should include file", function () {
16
- const result = __1.default.page(`= GitBook User Manual
17
-
18
- == Usage
19
-
20
- include::src/__tests__/fixtures/usage.adoc[]
21
- `).content;
22
- // assert.match is available in Node > 12.16.0
23
- (0, assert_1.default)(result.match(/create a book/g) !== null);
24
- });
25
- it("should use font icons by default", function () {
26
- const result = __1.default.page(`= HonKit User Manual
27
-
28
- == Install
29
-
30
- IMPORTANT: Do not forgot to install \`yarn\`
31
- `).content;
32
- // assert.match is available in Node > 12.16.0
33
- (0, assert_1.default)(result.match(/fa icon-important/g) !== null);
34
- });
35
- it("should allow users to override icons attribute", function () {
36
- const result = __1.default.page(`= HonKit User Manual
37
- // override icons attribute
38
- :icons:
39
-
40
- == Install
41
-
42
- IMPORTANT: Do not forgot to install \`yarn\`
43
- `).content;
44
- // assert.doesNotMatch is available in Node > 12.16.0
45
- (0, assert_1.default)(result.match(/fa icon-important/g) === null);
46
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=readme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../src/__tests__/readme.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
8
- const assert_1 = __importDefault(require("assert"));
9
- const __1 = __importDefault(require("../"));
10
- var LEXED;
11
- beforeAll(function () {
12
- var CONTENT = fs_1.default.readFileSync(path_1.default.join(__dirname, "./fixtures/README.adoc"), "utf8");
13
- LEXED = __1.default.readme(CONTENT);
14
- });
15
- it("should contain a title", function () {
16
- (0, assert_1.default)(LEXED.title);
17
- });
18
- it("should contain a description", function () {
19
- (0, assert_1.default)(LEXED.description);
20
- });
21
- it("should extract the right title", function () {
22
- assert_1.default.equal(LEXED.title, "This is the title");
23
- });
24
- it("should extract the right description", function () {
25
- assert_1.default.equal(LEXED.description, "This is the book description.");
26
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=summary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/__tests__/summary.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
8
- const assert_1 = __importDefault(require("assert"));
9
- const __1 = __importDefault(require("../"));
10
- var LEXED, PART;
11
- beforeAll(function () {
12
- var CONTENT = fs_1.default.readFileSync(path_1.default.join(__dirname, "./fixtures/SUMMARY.adoc"), "utf8");
13
- LEXED = __1.default.summary(CONTENT);
14
- PART = LEXED.parts[0];
15
- // todo: add support for parts in asciidoc
16
- });
17
- it("should detect parts", function () {
18
- assert_1.default.equal(LEXED.parts.length, 1);
19
- });
20
- it("should detect articles", function () {
21
- assert_1.default.equal(PART.articles.length, 5);
22
- });
23
- it("should support articles", function () {
24
- assert_1.default.equal(PART.articles[0].articles.length, 2);
25
- assert_1.default.equal(PART.articles[1].articles.length, 0);
26
- assert_1.default.equal(PART.articles[2].articles.length, 0);
27
- });
28
- it("should detect paths and titles", function () {
29
- (0, assert_1.default)(PART.articles[0].ref);
30
- (0, assert_1.default)(PART.articles[1].ref);
31
- (0, assert_1.default)(PART.articles[2].ref);
32
- (0, assert_1.default)(PART.articles[3].ref);
33
- assert_1.default.equal(PART.articles[4].ref, null);
34
- (0, assert_1.default)(PART.articles[0].title);
35
- (0, assert_1.default)(PART.articles[1].title);
36
- (0, assert_1.default)(PART.articles[2].title);
37
- (0, assert_1.default)(PART.articles[3].title);
38
- (0, assert_1.default)(PART.articles[4].title);
39
- });
40
- it("should normalize paths from .md", function () {
41
- assert_1.default.equal(PART.articles[0].ref, "chapter-1/README.adoc");
42
- assert_1.default.equal(PART.articles[1].ref, "chapter-2/README.adoc");
43
- assert_1.default.equal(PART.articles[2].ref, "chapter-3/README.adoc");
44
- });
45
- it("should correctly convert it to text", function () {
46
- var text = __1.default.summary.toText(LEXED);
47
- assert_1.default.deepEqual(__1.default.summary(text), LEXED);
48
- });