diff --git a/README.md b/README.md index c8afc83..6e6ff60 100644 --- a/README.md +++ b/README.md @@ -81,19 +81,21 @@ For example: Many variables have default values and are therefore optional. -| Variable name | Default value | Description | -| ----------------------------- | ------------- | ----------------------------------------------------------------------------- | -| `repo-owner` | | The name of the GitHub user or organization who owns the repository. | -| `repo-name` | | The name of the GitHub repository. | -| `default-branch` | `master` | The name of the repository's default branch. | -| `min-branch-coverage` | `100` | The minimum acceptable branch coverage (as a percentage). | -| `author-name` | `Sanctuary` | The name of the individual or group to whom copyright should be attributed. | -| `license-file` | `LICENSE` | The name of the licence file. | -| `source-files` | `index.js` | Space-separated list of filenames. Globbing is supported. | -| `heading-level` | `4` | The `` level of headings transcribed from `heading-prefix` comments. | -| `heading-prefix` | `#` | The character which follows `//` to signify a heading to transcribe. | -| `comment-prefix` | `.` | The character which follows `//` to signify documentation to transcribe. | -| `version-tag-prefix` | `v` | The prefix of annotated version tags (`version-tag-prefix =` for no prefix). | +| Variable name | Default value | Description | +| ----------------------------- | --------------------- | ----------------------------------------------------------------------------- | +| `repo-owner` | | The name of the GitHub user or organization who owns the repository. | +| `repo-name` | | The name of the GitHub repository. | +| `default-branch` | `master` | The name of the repository's default branch. | +| `min-branch-coverage` | `100` | The minimum acceptable branch coverage (as a percentage). | +| `author-name` | `Sanctuary` | The name of the individual or group to whom copyright should be attributed. | +| `license-file` | `LICENSE` | The name of the licence file. | +| `source-files` | `index.js` | Space-separated list of filenames. Globbing is supported. | +| `heading-level` | `4` | The `` level of headings transcribed from `heading-prefix` comments. | +| `heading-prefix` | `#` | The character which follows `//` to signify a heading to transcribe. | +| `comment-prefix` | `.` | The character which follows `//` to signify documentation to transcribe. | +| `opening-delimiter` | `` ```javascript `` | The opening delimiter of doctest blocks in the source files. | +| `closing-delimiter` | `` ``` `` | The closing delimiter of doctest blocks in the source files. | +| `version-tag-prefix` | `v` | The prefix of annotated version tags (`version-tag-prefix =` for no prefix). | ### Custom scripts @@ -116,9 +118,11 @@ Configurable via [variables][] (`license-file`). ### `doctest` -Runs [`doctest`↗︎][] with suitable `--module` and `--prefix` values. +Runs [`doctest`↗︎][] with suitable `--module`, `--prefix`, +`--opening-delimiter`, and `--closing-delimiter` values. -Configurable via [variables][] (`source-files`, `comment-prefix`). +Configurable via [variables][] (`source-files`, `comment-prefix`, +`opening-delimiter`, `closing-delimiter`). ### `generate-readme` diff --git a/bin/doctest b/bin/doctest index de547ab..e4d2168 100755 --- a/bin/doctest +++ b/bin/doctest @@ -12,5 +12,12 @@ files=($(get source-files)) set -f ; shopt -u nullglob prefix="$(get comment-prefix)" +opening="$(get opening-delimiter)" +closing="$(get closing-delimiter)" -node_modules/.bin/doctest --module commonjs --prefix "$prefix" -- "${files[@]}" +node_modules/.bin/doctest \ + --module commonjs \ + --prefix "$prefix" \ + --opening-delimiter "$opening" \ + --closing-delimiter "$closing" \ + -- "${files[@]}" diff --git a/functions b/functions index 2d37fac..f8902a8 100644 --- a/functions +++ b/functions @@ -28,6 +28,10 @@ get() { heading-level) printf '4' ;; heading-prefix) printf '#' ;; comment-prefix) printf '.' ;; + opening-delimiter) # shellcheck disable=SC2016 + printf '```javascript' ;; + closing-delimiter) # shellcheck disable=SC2016 + printf '```' ;; version-tag-prefix) printf 'v' ;; *) echo "'$1' not defined in $config" >&2 diff --git a/package.json b/package.json index 836b9d9..428b439 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "npm": ">=3.0.0" }, "dependencies": { - "doctest": "0.15.x", + "doctest": "0.16.x", "eslint": "5.15.x", "eslint-plugin-markdown": "1.0.0-beta.8", "mocha": "5.x.x",