docgen-tool 2.1.2 → 3.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.
Files changed (81) hide show
  1. package/.gitattributes +1 -0
  2. package/.github/workflows/deploy-website.yml +28 -0
  3. package/.prettierignore +4 -0
  4. package/.prettierrc +4 -0
  5. package/LICENSE +35 -33
  6. package/{docgen → dist/docgen.js} +11 -22
  7. package/docgen.js +95 -0
  8. package/package.json +47 -20
  9. package/source/__test__/test-run/contents.json +12 -0
  10. package/source/__test__/test-run/overview.txt +3 -0
  11. package/source/__test__/test-run/parameters.json +32 -0
  12. package/source/__test__/test-run/release-notes.txt +4 -0
  13. package/source/docgen.js +900 -775
  14. package/source/example/contents.json +11 -11
  15. package/source/example/index.txt +3 -3
  16. package/source/example/parameters.json +36 -36
  17. package/source/internal-readme.md +4 -0
  18. package/source/pdf-stylesheet.css +26 -20
  19. package/source/require/docgen.css +76 -69
  20. package/source/require/katexInjector.js +9 -13
  21. package/source/require/print.css +26 -19
  22. package/source/templates/main.html +93 -93
  23. package/source/user-guide/advanced-content.txt +170 -170
  24. package/source/user-guide/contents.json +56 -56
  25. package/source/user-guide/files/images/svg/inkit-logo.svg +9 -0
  26. package/source/user-guide/index.txt +257 -244
  27. package/source/user-guide/installation.txt +49 -49
  28. package/source/user-guide/parameters.json +36 -36
  29. package/source/user-guide/release-notes.txt +69 -58
  30. package/source/user-guide/running.txt +46 -46
  31. package/source/user-guide/troubleshooting.txt +31 -31
  32. package/source/user-guide/upgrading.txt +25 -25
  33. package/source/user-guide/version-control.txt +13 -13
  34. package/source/user-guide/writing-content.txt +269 -269
  35. package/tsconfig.json +8 -0
  36. package/.npmignore +0 -2
  37. package/docs/advanced-content.html +0 -239
  38. package/docs/commonmark.html +0 -225
  39. package/docs/docgen.pdf +0 -0
  40. package/docs/files/images/overview.png +0 -0
  41. package/docs/files/images/pdf.png +0 -0
  42. package/docs/files/images/svg/icon.svg +0 -845
  43. package/docs/files/images/svg/overview.svg +0 -1345
  44. package/docs/files/images/text.png +0 -0
  45. package/docs/files/images/web.png +0 -0
  46. package/docs/index.html +0 -333
  47. package/docs/installation.html +0 -121
  48. package/docs/ownership.html +0 -164
  49. package/docs/release-notes.html +0 -144
  50. package/docs/require/docgen.css +0 -131
  51. package/docs/require/katex/fonts/KaTeX_AMS-Regular.woff +0 -0
  52. package/docs/require/katex/fonts/KaTeX_Main-Bold.woff +0 -0
  53. package/docs/require/katex/fonts/KaTeX_Main-Italic.woff +0 -0
  54. package/docs/require/katex/fonts/KaTeX_Main-Regular.woff +0 -0
  55. package/docs/require/katex/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  56. package/docs/require/katex/fonts/KaTeX_Math-Italic.woff +0 -0
  57. package/docs/require/katex/fonts/KaTeX_Math-Regular.woff +0 -0
  58. package/docs/require/katex/fonts/KaTeX_Size1-Regular.woff +0 -0
  59. package/docs/require/katex/fonts/KaTeX_Size2-Regular.woff +0 -0
  60. package/docs/require/katex/fonts/KaTeX_Size3-Regular.woff +0 -0
  61. package/docs/require/katex/fonts/KaTeX_Size4-Regular.woff +0 -0
  62. package/docs/require/katex/katex.min.css +0 -1
  63. package/docs/require/katex/katex.min.js +0 -6
  64. package/docs/require/katexInjector.js +0 -22
  65. package/docs/require/print.css +0 -19
  66. package/docs/require/webknife/fonts/DroidSansMono.woff +0 -0
  67. package/docs/require/webknife/fonts/OpenSans.woff +0 -0
  68. package/docs/require/webknife/fonts/OpenSansBold.woff +0 -0
  69. package/docs/require/webknife/fonts/OpenSansBoldItalic.woff +0 -0
  70. package/docs/require/webknife/fonts/OpenSansItalic.woff +0 -0
  71. package/docs/require/webknife/framework.icons.js +0 -82
  72. package/docs/require/webknife/framework.min.css +0 -3
  73. package/docs/require/webknife/framework.min.js +0 -14
  74. package/docs/require/webknife/highlight.min.css +0 -1
  75. package/docs/require/webknife/highlight.min.js +0 -6
  76. package/docs/running.html +0 -123
  77. package/docs/troubleshooting.html +0 -105
  78. package/docs/upgrading.html +0 -124
  79. package/docs/version-control.html +0 -102
  80. package/docs/writing-content.html +0 -305
  81. /package/{docs → source/__test__/test-run}/files/images/logo.png +0 -0
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,28 @@
1
+ name: Deploy Website
2
+ on:
3
+ push:
4
+ branches: [ master ]
5
+ permissions:
6
+ contents: write
7
+ jobs:
8
+ build-and-deploy:
9
+ concurrency: ci-${{ github.ref }}
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout 🛎️
13
+ uses: actions/checkout@v3
14
+
15
+ - name: Install and Build 🔧
16
+ run: |
17
+ sudo apt-get install -y xfonts-base xfonts-75dpi
18
+ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
19
+ sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
20
+ sudo apt-get -f install -y
21
+ wkhtmltopdf -V
22
+ yarn install --frozen-lockfile
23
+ yarn build:docs
24
+
25
+ - name: Deploy 🚀
26
+ uses: JamesIves/github-pages-deploy-action@v4
27
+ with:
28
+ folder: . # directory to deploy
@@ -0,0 +1,4 @@
1
+ docs/
2
+ dist/
3
+ source/require/webknife
4
+ source/optional/katex
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
package/LICENSE CHANGED
@@ -1,33 +1,35 @@
1
- DocGen is licensed under the MIT license
2
- ----------------------------------------
3
-
4
- Copyright (c) 2015 Mark Macdonald
5
-
6
- DocGen includes third-party libraries (see below).
7
-
8
- MIT licensed:
9
- -------------
10
-
11
- KaTeX: Copyright (c) 2014 Khan Academy, (https://github.com/Khan/KaTeX)
12
-
13
- Webknife: Copyright (c) 2015 The Webknife Project, (http://mtmacdonald.github.io/webknife)
14
-
15
- Webknife includes third-party libraries attributed here: https://github.com/mtmacdonald/webknife/blob/master/LICENSE
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy
18
- of this software and associated documentation files (the "Software"), to deal
19
- in the Software without restriction, including without limitation the rights
20
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- copies of the Software, and to permit persons to whom the Software is
22
- furnished to do so, subject to the following conditions:
23
-
24
- The above copyright notice and this permission notice shall be included in all
25
- copies or substantial portions of the Software.
26
-
27
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- SOFTWARE.
1
+ DocGen is licensed under the MIT license
2
+ ----------------------------------------
3
+
4
+ Copyright (c) Inkit Inc. and contributors
5
+
6
+ Lead developer and contributor Mark Macdonald
7
+
8
+ DocGen includes third-party libraries (see below).
9
+
10
+ MIT licensed:
11
+ -------------
12
+
13
+ KaTeX: Copyright (c) 2014 Khan Academy, (https://github.com/Khan/KaTeX)
14
+
15
+ Webknife: Copyright (c) 2015 The Webknife Project, (http://mtmacdonald.github.io/webknife)
16
+
17
+ Webknife includes third-party libraries attributed here: https://github.com/mtmacdonald/webknife/blob/master/LICENSE
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all
27
+ copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
@@ -1,41 +1,32 @@
1
1
  #!/usr/bin/env node
2
-
3
- var docgen = require ('./source/docgen.js');
2
+ var docgen = require('./source/docgen.js');
4
3
  var program = require('commander');
5
- var EOL = require('os').EOL;
6
-
7
4
  var generator = new docgen(process);
8
-
9
- function scaffold (command) {
5
+ function scaffold(command) {
10
6
  generator.setOptions(command);
11
7
  generator.scaffold();
12
8
  }
13
-
14
- function run (command) {
9
+ function run(command) {
15
10
  generator.setOptions(command);
16
11
  generator.run();
17
12
  }
18
-
19
13
  /*
20
14
  parse command-line arguments with node commander
21
15
  commander help: http://slides.com/timsanteford/conquering-commander-js
22
16
  command-line conventions: http://docopt.org
23
17
  */
24
-
18
+ program.version(generator.getVersion()).usage('[command] [--option]');
25
19
  program
26
- .version(generator.getVersion())
27
- .usage('[command] [--option]');
28
-
29
- program.command('scaffold')
20
+ .command('scaffold')
30
21
  .usage('[--option]')
31
22
  .description('create a template input directory')
32
23
  .option('-o, --output [path]', 'path to the output directory (default: ./)', './')
33
24
  .option('-v, --verbose', 'show verbose output including detailed errors')
34
25
  .action(function (command) {
35
- scaffold(command);
36
- })
37
-
38
- program.command('run')
26
+ scaffold(command);
27
+ });
28
+ program
29
+ .command('run')
39
30
  .usage('[--option]')
40
31
  .description('create a static website from an input directory')
41
32
  .option('-i, --input [path]', 'path to the input directory [default: ./]', './')
@@ -51,11 +42,9 @@ program.command('run')
51
42
  .option('-R, --set-release-date [date]', 'override parameters.date (useful for build tools) [default: false]', false)
52
43
  .option('-w, --wkhtmltopdf-path [path]', 'specify a custom path to wkhtmltopdf [default: wkhtmltopdf]', 'wkhtmltopdf')
53
44
  .action(function (command) {
54
- run(command);
55
- });
56
-
45
+ run(command);
46
+ });
57
47
  program.parse(process.argv);
58
-
59
48
  //if no arguments were provided, show help and then exit
60
49
  if (!process.argv.slice(2).length) {
61
50
  program.help();
package/docgen.js ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+
3
+ let docgen = require('./source/docgen.js');
4
+ let program = require('commander');
5
+
6
+ let generator = new docgen(process);
7
+
8
+ const scaffold = (command) => {
9
+ generator.setOptions(command);
10
+ generator.scaffold();
11
+ };
12
+
13
+ const run = (command) => {
14
+ generator.setOptions(command);
15
+ generator.run();
16
+ };
17
+
18
+ /*
19
+ parse command-line arguments with node commander
20
+ commander help: http://slides.com/timsanteford/conquering-commander-js
21
+ command-line conventions: http://docopt.org
22
+ */
23
+
24
+ program.version(generator.getVersion()).usage('[command] [--option]');
25
+
26
+ program
27
+ .command('scaffold')
28
+ .usage('[--option]')
29
+ .description('create a template input directory')
30
+ .option(
31
+ '-o, --output [path]',
32
+ 'path to the output directory (default: ./)',
33
+ './',
34
+ )
35
+ .option('-v, --verbose', 'show verbose output including detailed errors')
36
+ .action((command) => {
37
+ scaffold(command);
38
+ });
39
+
40
+ program
41
+ .command('run')
42
+ .usage('[--option]')
43
+ .description('create a static website from an input directory')
44
+ .option(
45
+ '-i, --input [path]',
46
+ 'path to the input directory [default: ./]',
47
+ './',
48
+ )
49
+ .option(
50
+ '-o, --output [path]',
51
+ 'path to the output directory [default: ./output]',
52
+ './output',
53
+ )
54
+ .option('-v, --verbose', 'show verbose output including detailed errors')
55
+ .option(
56
+ '-t, --page-toc',
57
+ 'show a page table of contents at the top of each web page',
58
+ )
59
+ .option('-p, --pdf', 'create a PDF document')
60
+ .option(
61
+ '-d, --pdf-delay [milliseconds]',
62
+ 'delay PDF printing to allow time for dynamic rendering [default: 2000]',
63
+ '2000',
64
+ )
65
+ .option('-m, --math-katex', 'enable KaTex mathematical expressions')
66
+ .option('-n, --math-mathjax', 'enable MathJax mathematical expressions')
67
+ .option(
68
+ '-r, --redirect',
69
+ 'create an index.html in the parent directory that redirects to the homepage',
70
+ )
71
+ .option(
72
+ '-s, --set-version [version]',
73
+ 'override parameters.version (useful for build tools) [default: false]',
74
+ false,
75
+ )
76
+ .option(
77
+ '-R, --set-release-date [date]',
78
+ 'override parameters.date (useful for build tools) [default: false]',
79
+ false,
80
+ )
81
+ .option(
82
+ '-w, --wkhtmltopdf-path [path]',
83
+ 'specify a custom path to wkhtmltopdf [default: wkhtmltopdf]',
84
+ 'wkhtmltopdf',
85
+ )
86
+ .action((command) => {
87
+ run(command);
88
+ });
89
+
90
+ program.parse(process.argv);
91
+
92
+ //if no arguments were provided, show help and then exit
93
+ if (!process.argv.slice(2).length) {
94
+ program.help();
95
+ }
package/package.json CHANGED
@@ -1,35 +1,62 @@
1
1
  {
2
2
  "name": "docgen-tool",
3
- "version": "2.1.2",
3
+ "version": "3.0.0",
4
4
  "description": "A tool for creating HTML and PDF documentation",
5
- "main": "docgen",
6
- "bin" : { "docgen" : "./docgen" },
5
+ "main": "dist/docgen.js",
6
+ "bin": {
7
+ "docgen": "dist/docgen.js"
8
+ },
9
+ "scripts": {
10
+ "dev": "ts-node docgen.js run",
11
+ "build": "tsc -p tsconfig.json",
12
+ "run:build": "dist/docgen.js",
13
+ "build:docs": "ts-node docgen.js run -i ./source/user-guide -o ./docs -p -m -n -d 40000",
14
+ "test": "npm run prettier:check",
15
+ "test:run": "ts-node docgen.js run -i ./source/__test__/test-run -o ./source/__test__/test-run-output",
16
+ "prettier:check": "prettier --check 'docgen.js' '*.{js,json,css,less}'",
17
+ "prettier:fix": "prettier --write 'docgen.js' '*.{js,json,css,less}'"
18
+ },
19
+ "husky": {
20
+ "hooks": {
21
+ "pre-commit": "lint-staged"
22
+ }
23
+ },
24
+ "lint-staged": {
25
+ "*.{js,json,css,less}": "prettier --write",
26
+ "docgen": "prettier --write"
27
+ },
7
28
  "dependencies": {
8
- "rsvp": "3.0.18",
9
- "commander": "2.8.1",
10
- "cheerio": "0.19.0",
11
- "markdown-it": "4.2.1",
12
- "moment" : "2.10.3",
13
- "z-schema": "3.10.2",
14
- "chalk": "1.0.0",
15
- "spawn-args": "0.1.0",
16
- "cli-spinner": "0.2.1",
17
- "image-size": "0.3.5",
18
- "fs-extra": "0.18.4"
29
+ "chalk": "^4.1.0",
30
+ "cheerio": "^1.0.0-rc.12",
31
+ "cli-spinner": "^0.2.10",
32
+ "commander": "^11.0.0",
33
+ "fs-extra": "^11.1.1",
34
+ "husky": "^4.3.0",
35
+ "image-size": "^1.0.2",
36
+ "lint-staged": "^10.5.1",
37
+ "markdown-it": "^13.0.1",
38
+ "moment": "^2.29.4",
39
+ "rsvp": "^4.8.5",
40
+ "spawn-args": "^0.2.0",
41
+ "z-schema": "^6.0.1"
19
42
  },
20
43
  "devDependencies": {
21
- },
22
- "scripts": {
23
- "test": "echo \"Error: no test specified\" && exit 1"
44
+ "@types/node": "^20.3.1",
45
+ "eslint": "^8.43.0",
46
+ "eslint-config-prettier": "^8.8.0",
47
+ "prettier": "^2.1.2",
48
+ "ts-node": "^10.9.1",
49
+ "tslib": "^2.5.3",
50
+ "typescript": "^5.1.3"
24
51
  },
25
52
  "repository": {
26
53
  "type": "git",
27
54
  "url": "https://github.com/mtmacdonald/docgen"
28
55
  },
29
- "author": "Mark Macdonald",
56
+ "author": "Inkit Inc. and contributors",
30
57
  "license": "MIT",
31
58
  "bugs": {
32
59
  "url": "https://github.com/mtmacdonald/docgen/issues"
33
60
  },
34
- "homepage": "https://github.com/mtmacdonald/docgen"
35
- }
61
+ "homepage": "http://mtmacdonald.github.io/docgen/docs/index.html"
62
+ }
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "heading": "Test Run",
4
+ "column": 1,
5
+ "pages": [
6
+ {
7
+ "title": "Overview",
8
+ "source": "overview.txt"
9
+ }
10
+ ]
11
+ }
12
+ ]
@@ -0,0 +1,3 @@
1
+ # DocGen Test Case
2
+
3
+ An example documentation site for testing.
@@ -0,0 +1,32 @@
1
+ {
2
+ "title": "DocGen test case",
3
+ "name": "DocGen test case",
4
+ "version": "1.0.0",
5
+ "date": "27/06/2023",
6
+ "organization": {
7
+ "name": "DocGen Test Case",
8
+ "url": "https://www.inkit.com"
9
+ },
10
+ "author": {
11
+ "name": "DocGen Test Case",
12
+ "url": "https://www.inkit.com"
13
+ },
14
+ "owner": {
15
+ "name": "DocGen Test Case",
16
+ "url": "https://www.inkit.com"
17
+ },
18
+ "contributors": [],
19
+ "website": {
20
+ "name": "Github",
21
+ "url": "https://github.com/mtmacdonald/docgen"
22
+ },
23
+ "backlink": {
24
+ "name": "",
25
+ "url": ""
26
+ },
27
+ "module": "",
28
+ "id": "",
29
+ "summary": "DocGen test case.",
30
+ "marking": "MIT License.",
31
+ "legalese": ""
32
+ }
@@ -0,0 +1,4 @@
1
+ DocGen Test Case 1.0.0 released 27/06/2023
2
+ ------------------------------------------
3
+
4
+ - Initial version of test case