markdown-maker 1.10.1 → 1.10.3
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/.github/workflows/node.js.yml +21 -26
- package/.vscode/extensions.json +3 -0
- package/.vscode/launch.json +4 -22
- package/.vscode/settings.json +8 -3
- package/.vscode/snippets.code-snippets +6 -8
- package/jest.config.js +7 -0
- package/package.json +41 -64
- package/src/cltool.ts +119 -135
- package/src/commands.ts +238 -244
- package/src/errors.ts +26 -0
- package/src/main.ts +123 -0
- package/src/parser.ts +398 -0
- package/src/templates.ts +5 -1
- package/src/types.ts +33 -0
- package/tests/_test-util.ts +44 -0
- package/tests/advanced.spec.ts +92 -0
- package/tests/basic.spec.ts +68 -0
- package/tests/clargs.spec.ts +50 -0
- package/tests/errors.spec.ts +64 -0
- package/tests/html.spec.ts +23 -0
- package/tests/line.spec.ts +21 -0
- package/tests/marked.spec.ts +40 -0
- package/tests/target.spec.ts +41 -0
- package/tests/vars.spec.ts +45 -0
- package/tsconfig.json +66 -64
- package/prettierrc.yaml +0 -4
- package/src/parse.ts +0 -396
- package/test/advanced.test.js +0 -37
- package/test/basic.test.js +0 -67
- package/test/clargs.test.js +0 -51
- package/test/errors.test.js +0 -47
- package/test/hooks.js +0 -9
- package/test/hooks.test.js +0 -114
- package/test/html.test.js +0 -37
- package/test/line.test.js +0 -21
- package/test/marked.test.js +0 -43
- package/test/target.test.js +0 -43
- package/test/tester.test.js +0 -41
- package/test/vars.test.js +0 -49
| @@ -1,35 +1,30 @@ | |
| 1 1 | 
             
            # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
         | 
| 2 2 | 
             
            # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
         | 
| 3 3 |  | 
| 4 | 
            -
            name:  | 
| 4 | 
            +
            name: Jest
         | 
| 5 5 |  | 
| 6 6 | 
             
            on: [push, pull_request]
         | 
| 7 7 |  | 
| 8 8 | 
             
            jobs:
         | 
| 9 | 
            -
             | 
| 9 | 
            +
                build:
         | 
| 10 | 
            +
                    runs-on: ubuntu-latest
         | 
| 10 11 |  | 
| 11 | 
            -
             | 
| 12 | 
            +
                    strategy:
         | 
| 13 | 
            +
                        matrix:
         | 
| 14 | 
            +
                            node-version: [20.x, 21.x, 22.x]
         | 
| 15 | 
            +
                            # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
         | 
| 12 16 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
                    cmd: install # will run `yarn install` command
         | 
| 28 | 
            -
                - name: yarn build
         | 
| 29 | 
            -
                  uses: borales/actions-yarn@v3.0.0
         | 
| 30 | 
            -
                  with:
         | 
| 31 | 
            -
                    cmd: build # will run `yarn build` command
         | 
| 32 | 
            -
                - name: yarn test
         | 
| 33 | 
            -
                  uses: borales/actions-yarn@v3.0.0
         | 
| 34 | 
            -
                  with:
         | 
| 35 | 
            -
                    cmd: test # will run `yarn test` command
         | 
| 17 | 
            +
                    steps:
         | 
| 18 | 
            +
                        - uses: actions/checkout@v2
         | 
| 19 | 
            +
                        - name: Use Node.js ${{ matrix.node-version }}
         | 
| 20 | 
            +
                          uses: actions/setup-node@v1
         | 
| 21 | 
            +
                          with:
         | 
| 22 | 
            +
                              node-version: ${{ matrix.node-version }}
         | 
| 23 | 
            +
                        - name: yarn install
         | 
| 24 | 
            +
                          uses: borales/actions-yarn@v3.0.0
         | 
| 25 | 
            +
                          with:
         | 
| 26 | 
            +
                              cmd: install # will run `yarn install` command
         | 
| 27 | 
            +
                        - name: yarn test
         | 
| 28 | 
            +
                          uses: borales/actions-yarn@v3.0.0
         | 
| 29 | 
            +
                          with:
         | 
| 30 | 
            +
                              cmd: test # will run `yarn test` command
         | 
    
        package/.vscode/launch.json
    CHANGED
    
    | @@ -4,31 +4,13 @@ | |
| 4 4 | 
             
                // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
         | 
| 5 5 | 
             
                "version": "0.2.0",
         | 
| 6 6 | 
             
                "configurations": [
         | 
| 7 | 
            -
                    {
         | 
| 8 | 
            -
                        "name": "Compile main",
         | 
| 9 | 
            -
                        "request": "launch",
         | 
| 10 | 
            -
                        "runtimeArgs": [
         | 
| 11 | 
            -
                            "run-script",
         | 
| 12 | 
            -
                            "main"
         | 
| 13 | 
            -
                        ],
         | 
| 14 | 
            -
                        "runtimeExecutable": "npm",
         | 
| 15 | 
            -
                        "skipFiles": [
         | 
| 16 | 
            -
                            "<node_internals>/**"
         | 
| 17 | 
            -
                        ],
         | 
| 18 | 
            -
                        "type": "pwa-node"
         | 
| 19 | 
            -
                    },
         | 
| 20 7 | 
             
                    {
         | 
| 21 8 | 
             
                        "name": "Run test",
         | 
| 22 9 | 
             
                        "request": "launch",
         | 
| 23 | 
            -
                        "runtimeArgs": [
         | 
| 24 | 
            -
                            "run-script",
         | 
| 25 | 
            -
                            "test"
         | 
| 26 | 
            -
                        ],
         | 
| 10 | 
            +
                        "runtimeArgs": ["run-script", "test"],
         | 
| 27 11 | 
             
                        "runtimeExecutable": "npm",
         | 
| 28 | 
            -
                        "skipFiles": [
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                        ],
         | 
| 31 | 
            -
                        "type": "pwa-node"
         | 
| 12 | 
            +
                        "skipFiles": ["<node_internals>/**"],
         | 
| 13 | 
            +
                        "type": "node"
         | 
| 32 14 | 
             
                    }
         | 
| 33 15 | 
             
                ]
         | 
| 34 | 
            -
            }
         | 
| 16 | 
            +
            }
         | 
    
        package/.vscode/settings.json
    CHANGED
    
    | @@ -1,5 +1,10 @@ | |
| 1 1 | 
             
            {
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 2 | 
            +
            	"editor.formatOnPaste": true,
         | 
| 3 | 
            +
            	"editor.defaultFormatter": "esbenp.prettier-vscode",
         | 
| 4 | 
            +
            	"prettier.tabWidth": 4,
         | 
| 5 | 
            +
            	"prettier.useEditorConfig": true,
         | 
| 6 | 
            +
            	"prettier.configPath": "",
         | 
| 7 | 
            +
            	"prettier.requireConfig": false,
         | 
| 8 | 
            +
            	"prettier.useTabs": true,
         | 
| 9 | 
            +
            	"jest.jestCommandLine": "npx jest -i"
         | 
| 5 10 | 
             
            }
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            {
         | 
| 2 | 
            -
            	// Place your markdown-maker workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | 
| 3 | 
            -
            	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | 
| 4 | 
            -
            	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | 
| 5 | 
            -
            	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | 
| 6 | 
            -
            	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | 
| 2 | 
            +
            	// Place your markdown-maker workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
         | 
| 3 | 
            +
            	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
         | 
| 4 | 
            +
            	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
         | 
| 5 | 
            +
            	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
         | 
| 6 | 
            +
            	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
         | 
| 7 7 | 
             
            	// Placeholders with the same ids are connected.
         | 
| 8 8 | 
             
            	// Example:
         | 
| 9 9 | 
             
            	// "Print to console": {
         | 
| @@ -15,7 +15,7 @@ | |
| 15 15 | 
             
            	// 	],
         | 
| 16 16 | 
             
            	// 	"description": "Log output to console"
         | 
| 17 17 | 
             
            	// }
         | 
| 18 | 
            -
            	"MD Command" | 
| 18 | 
            +
            	"MD Command": {
         | 
| 19 19 | 
             
            		"scope": "javascript,typescript",
         | 
| 20 20 | 
             
            		"prefix": "cummy",
         | 
| 21 21 | 
             
            		"body": [
         | 
| @@ -27,6 +27,4 @@ | |
| 27 27 | 
             
            		],
         | 
| 28 28 | 
             
            		"description": "Snippet for a new command"
         | 
| 29 29 | 
             
            	}
         | 
| 30 | 
            -
             | 
| 31 30 | 
             
            }
         | 
| 32 | 
            -
             | 
    
        package/jest.config.js
    ADDED
    
    
    
        package/package.json
    CHANGED
    
    | @@ -1,66 +1,43 @@ | |
| 1 1 | 
             
            {
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
                "author": "blitzher",
         | 
| 44 | 
            -
                "license": "MIT",
         | 
| 45 | 
            -
                "dependencies": {
         | 
| 46 | 
            -
                    "@types/chokidar": "^2.1.3",
         | 
| 47 | 
            -
                    "@types/colors": "^1.2.1",
         | 
| 48 | 
            -
                    "@types/node": "^15.6.1",
         | 
| 49 | 
            -
                    "@types/ws": "^8.5.3",
         | 
| 50 | 
            -
                    "argparse": "^2.0.1",
         | 
| 51 | 
            -
                    "chokidar": "^3.5.1",
         | 
| 52 | 
            -
                    "colors": "^1.4.0",
         | 
| 53 | 
            -
                    "colors.ts": "^1.0.20",
         | 
| 54 | 
            -
                    "marked": "^2.0.1",
         | 
| 55 | 
            -
                    "node-html-parser": "^6.1.13",
         | 
| 56 | 
            -
                    "require-runtime": "^2.0.0",
         | 
| 57 | 
            -
                    "ws": "^8.8.1"
         | 
| 58 | 
            -
                },
         | 
| 59 | 
            -
                "devDependencies": {
         | 
| 60 | 
            -
                    "cloc": "^2.7.0",
         | 
| 61 | 
            -
                    "mocha": "^8.3.1",
         | 
| 62 | 
            -
                    "pkg": "^4.4.9",
         | 
| 63 | 
            -
                    "prettier": "^2.3.0",
         | 
| 64 | 
            -
                    "typescript": "^4.3.2"
         | 
| 65 | 
            -
                }
         | 
| 2 | 
            +
            	"name": "markdown-maker",
         | 
| 3 | 
            +
            	"version": "1.10.3",
         | 
| 4 | 
            +
            	"description": "A superset-compiler for markdown using marked",
         | 
| 5 | 
            +
            	"main": "src/main.ts",
         | 
| 6 | 
            +
            	"bin": {
         | 
| 7 | 
            +
            		"mdparse": "bundle/main.js"
         | 
| 8 | 
            +
            	},
         | 
| 9 | 
            +
            	"scripts": {
         | 
| 10 | 
            +
            		"test": "jest",
         | 
| 11 | 
            +
            		"bundle": "tsc --project tsconfig.json",
         | 
| 12 | 
            +
            		"main": "node bundle/main.js",
         | 
| 13 | 
            +
            		"clean": "rm -rf bundle bin",
         | 
| 14 | 
            +
            		"pretest": "npm run bundle"
         | 
| 15 | 
            +
            	},
         | 
| 16 | 
            +
            	"keywords": [],
         | 
| 17 | 
            +
            	"author": "blitzher",
         | 
| 18 | 
            +
            	"license": "MIT",
         | 
| 19 | 
            +
            	"dependencies": {
         | 
| 20 | 
            +
            		"argparse": "^2.0.1",
         | 
| 21 | 
            +
            		"chokidar": "^3.5.1",
         | 
| 22 | 
            +
            		"colors.ts": "^1.0.20",
         | 
| 23 | 
            +
            		"marked": "^12.0.2",
         | 
| 24 | 
            +
            		"node-html-parser": "^6.1.13",
         | 
| 25 | 
            +
            		"require-runtime": "^2.0.0",
         | 
| 26 | 
            +
            		"ts-node": "^10.9.2",
         | 
| 27 | 
            +
            		"ws": "^8.8.1"
         | 
| 28 | 
            +
            	},
         | 
| 29 | 
            +
            	"devDependencies": {
         | 
| 30 | 
            +
            		"@types/argparse": "^2.0.16",
         | 
| 31 | 
            +
            		"@types/chokidar": "^2.1.3",
         | 
| 32 | 
            +
            		"@types/colors": "^1.2.1",
         | 
| 33 | 
            +
            		"@types/jest": "^29.5.12",
         | 
| 34 | 
            +
            		"@types/node": "^15.6.1",
         | 
| 35 | 
            +
            		"@types/ws": "^8.5.3",
         | 
| 36 | 
            +
            		"@types/xregexp": "^4.4.0",
         | 
| 37 | 
            +
            		"cloc": "^2.7.0",
         | 
| 38 | 
            +
            		"jest": "^29.7.0",
         | 
| 39 | 
            +
            		"prettier": "^2.3.0",
         | 
| 40 | 
            +
            		"ts-jest": "^29.1.2",
         | 
| 41 | 
            +
            		"typescript": "^4.3.2"
         | 
| 42 | 
            +
            	}
         | 
| 66 43 | 
             
            }
         | 
    
        package/src/cltool.ts
    CHANGED
    
    | @@ -1,168 +1,152 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 1 | 
            +
            import fs from "fs"; /* for handling reading of files */
         | 
| 2 | 
            +
            import path from "path"; /* for handling file paths */
         | 
| 3 3 |  | 
| 4 4 | 
             
            import Colors = require("colors.ts"); /* for adding colours to strings */
         | 
| 5 | 
            -
            import  | 
| 6 | 
            -
            import  | 
| 5 | 
            +
            import { TaggedElement, TargetType } from "./types";
         | 
| 6 | 
            +
            import Parser from "./parser";
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            const version = process.env.npm_package_version || "0.0.0";
         | 
| 7 9 |  | 
| 8 10 | 
             
            Colors.enable();
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            const choki = require("chokidar");
         | 
| 11 | 
            +
            import { ArgumentParser } from "argparse"; /* for parsing clargs */
         | 
| 12 | 
            +
            import { HTMLElement } from "node-html-parser";
         | 
| 12 13 |  | 
| 13 14 | 
             
            export const argParser = new ArgumentParser({
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 15 | 
            +
            	description:
         | 
| 16 | 
            +
            		"Markdown bundler, with extra options. Extension file is loaded from ./extensions.js, if it exists",
         | 
| 17 | 
            +
            	prog: "mdparse",
         | 
| 16 18 | 
             
            });
         | 
| 17 19 |  | 
| 18 | 
            -
            const configFileName = ".mdmconfig.json";
         | 
| 19 | 
            -
             | 
| 20 20 | 
             
            //#region command line args
         | 
| 21 21 | 
             
            argParser.add_argument("src", {
         | 
| 22 | 
            -
             | 
| 22 | 
            +
            	help: "file to be parsed. If this is a directory, it looks for entry point in the directory, see --entry",
         | 
| 23 | 
            +
            });
         | 
| 24 | 
            +
            argParser.add_argument("--version", {
         | 
| 25 | 
            +
            	action: "version",
         | 
| 26 | 
            +
            	version: `v${version}`,
         | 
| 23 27 | 
             
            });
         | 
| 24 | 
            -
            argParser.add_argument("--version", { action: "version", version });
         | 
| 25 28 | 
             
            argParser.add_argument("-v", "--verbose", {
         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 29 | 
            +
            	action: "store_true",
         | 
| 30 | 
            +
            	help: "enable verbose output",
         | 
| 28 31 | 
             
            });
         | 
| 29 32 | 
             
            argParser.add_argument("-D", "--debug", {
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 33 | 
            +
            	action: "store_true",
         | 
| 34 | 
            +
            	help: "enable debugging information",
         | 
| 32 35 | 
             
            });
         | 
| 33 36 | 
             
            argParser.add_argument("-o", "--output", {
         | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 37 | 
            +
            	help: "destination of bundle, by default is 'dist/bundle.md'",
         | 
| 38 | 
            +
            	default: "dist/bundle.md",
         | 
| 36 39 | 
             
            });
         | 
| 37 40 | 
             
            argParser.add_argument("-d", "--max-depth", {
         | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            +
            	help: "maximum recursion depth, by default is 15",
         | 
| 42 | 
            +
            	default: 15,
         | 
| 43 | 
            +
            	type: "int",
         | 
| 41 44 | 
             
            });
         | 
| 42 45 | 
             
            argParser.add_argument("-e", "--entry", {
         | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 46 | 
            +
            	help: "assign entry point in directory, by default is 'main.md'",
         | 
| 47 | 
            +
            	default: "main.md",
         | 
| 45 48 | 
             
            });
         | 
| 46 49 | 
             
            argParser.add_argument("-w", "--watch", {
         | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 50 | 
            +
            	action: "store_true",
         | 
| 51 | 
            +
            	help: "recompile after a change in target target file or directory.",
         | 
| 49 52 | 
             
            });
         | 
| 50 53 | 
             
            argParser.add_argument("-u", "--use-underscore", {
         | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 54 | 
            +
            	action: "store_true",
         | 
| 55 | 
            +
            	help: "set the parser to use '_' as seperator in ids for Table of Content. If the links in the table does not work, this is likely to be the issue.",
         | 
| 53 56 | 
             
            });
         | 
| 54 57 | 
             
            argParser.add_argument("-t", "--toc-level", {
         | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            +
            	help: "the section level of the table of contents, by default is 3",
         | 
| 59 | 
            +
            	default: 3,
         | 
| 60 | 
            +
            	type: "int",
         | 
| 58 61 | 
             
            });
         | 
| 59 62 | 
             
            argParser.add_argument("-H", "--html", {
         | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 63 | 
            +
            	action: "store_true",
         | 
| 64 | 
            +
            	help: "compile HTML from the parsed markdown",
         | 
| 62 65 | 
             
            });
         | 
| 63 66 | 
             
            argParser.add_argument("--allow-undefined", "-A", {
         | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 67 | 
            +
            	action: "store_true",
         | 
| 68 | 
            +
            	help: "allow the use of the \"<thing>\" syntax, without raising an error when 'thing' is not a variable. Mostly useful when writing inline html tags, and other non-strictly markdown related uses",
         | 
| 66 69 | 
             
            });
         | 
| 67 70 | 
             
            //#endregion
         | 
| 68 71 |  | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
                if (!clargs.watch) compile(clargs.src, clargs.output);
         | 
| 151 | 
            -
                /* watch the folder and recompile on change */
         | 
| 152 | 
            -
                else {
         | 
| 153 | 
            -
                    const srcDirName = path.dirname(clargs.src);
         | 
| 154 | 
            -
                    console.log(`Watching ${srcDirName} for changes...`.yellow);
         | 
| 155 | 
            -
                    server = new WebSocketServer({ port: 7788 });
         | 
| 156 | 
            -
             | 
| 157 | 
            -
                    const _watcher = choki.watch(srcDirName).on("all", watcher);
         | 
| 158 | 
            -
                    try {
         | 
| 159 | 
            -
                        compile(clargs.src, clargs.output);
         | 
| 160 | 
            -
                    } catch (e) {
         | 
| 161 | 
            -
                        console.log(e.message);
         | 
| 162 | 
            -
                    }
         | 
| 163 | 
            -
                }
         | 
| 164 | 
            -
             | 
| 165 | 
            -
            }
         | 
| 166 | 
            -
             | 
| 167 | 
            -
            /* main entrypoint */
         | 
| 168 | 
            -
            if (require.main === module) main();
         | 
| 72 | 
            +
            export type CommandLineArgs = {
         | 
| 73 | 
            +
            	src: string;
         | 
| 74 | 
            +
            	output: string;
         | 
| 75 | 
            +
            	verbose: boolean;
         | 
| 76 | 
            +
            	debug: boolean;
         | 
| 77 | 
            +
            	max_depth: number;
         | 
| 78 | 
            +
            	entry: string;
         | 
| 79 | 
            +
            	watch: boolean;
         | 
| 80 | 
            +
            	use_underscore: boolean;
         | 
| 81 | 
            +
            	toc_level: number;
         | 
| 82 | 
            +
            	html: boolean;
         | 
| 83 | 
            +
            	allow_undefined: boolean;
         | 
| 84 | 
            +
            };
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            export type IncompleteCommandLineArgs = {
         | 
| 87 | 
            +
            	src?: string;
         | 
| 88 | 
            +
            	output?: string;
         | 
| 89 | 
            +
            	verbose?: boolean;
         | 
| 90 | 
            +
            	debug?: boolean;
         | 
| 91 | 
            +
            	max_depth?: number;
         | 
| 92 | 
            +
            	entry?: string;
         | 
| 93 | 
            +
            	watch?: boolean;
         | 
| 94 | 
            +
            	use_underscore?: boolean;
         | 
| 95 | 
            +
            	toc_level?: number;
         | 
| 96 | 
            +
            	html?: boolean;
         | 
| 97 | 
            +
            	allow_undefined?: boolean;
         | 
| 98 | 
            +
            };
         | 
| 99 | 
            +
             | 
| 100 | 
            +
            export type ParserOptions = {
         | 
| 101 | 
            +
            	defs: {
         | 
| 102 | 
            +
            		[key: string]: string;
         | 
| 103 | 
            +
            	};
         | 
| 104 | 
            +
            	secs: {
         | 
| 105 | 
            +
            		level: number;
         | 
| 106 | 
            +
            		title: string;
         | 
| 107 | 
            +
            	}[];
         | 
| 108 | 
            +
            	args: string[];
         | 
| 109 | 
            +
            	depth: number;
         | 
| 110 | 
            +
            	verbose: boolean;
         | 
| 111 | 
            +
            	debug: boolean;
         | 
| 112 | 
            +
            	max_depth: number;
         | 
| 113 | 
            +
            	use_underscore: boolean;
         | 
| 114 | 
            +
            	toc_level: number;
         | 
| 115 | 
            +
            	allow_undefined: boolean;
         | 
| 116 | 
            +
            	html: boolean;
         | 
| 117 | 
            +
            	watch: boolean;
         | 
| 118 | 
            +
            	targetType: TargetType | undefined;
         | 
| 119 | 
            +
            	only_warn: boolean;
         | 
| 120 | 
            +
            	parent?: Parser;
         | 
| 121 | 
            +
            	hooks: {
         | 
| 122 | 
            +
            		[key: string]: (map: { [tag: string]: TaggedElement }) => void;
         | 
| 123 | 
            +
            	};
         | 
| 124 | 
            +
            	isFileCallback: (s: string) => false | string;
         | 
| 125 | 
            +
            };
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            export type IncompleteParserOptions = {
         | 
| 128 | 
            +
            	defs?: {
         | 
| 129 | 
            +
            		[key: string]: string;
         | 
| 130 | 
            +
            	};
         | 
| 131 | 
            +
            	secs?: {
         | 
| 132 | 
            +
            		level: number;
         | 
| 133 | 
            +
            		title: string;
         | 
| 134 | 
            +
            	}[];
         | 
| 135 | 
            +
            	args?: string[];
         | 
| 136 | 
            +
            	depth?: number;
         | 
| 137 | 
            +
            	verbose?: boolean;
         | 
| 138 | 
            +
            	debug?: boolean;
         | 
| 139 | 
            +
            	max_depth?: number;
         | 
| 140 | 
            +
            	use_underscore?: boolean;
         | 
| 141 | 
            +
            	toc_level?: number;
         | 
| 142 | 
            +
            	allow_undefined?: boolean;
         | 
| 143 | 
            +
            	html?: boolean;
         | 
| 144 | 
            +
            	watch?: boolean;
         | 
| 145 | 
            +
            	targetType?: TargetType | undefined;
         | 
| 146 | 
            +
            	only_warn?: boolean;
         | 
| 147 | 
            +
            	parent?: Parser;
         | 
| 148 | 
            +
            	hooks?: {
         | 
| 149 | 
            +
            		[key: string]: (map: { [tag: string]: TaggedElement }) => void;
         | 
| 150 | 
            +
            	};
         | 
| 151 | 
            +
            	isFileCallback?: (s: string) => false | string;
         | 
| 152 | 
            +
            };
         |