Skip to content

Commit

Permalink
Add README documentation for getVersion, leave promise/extendConfig u…
Browse files Browse the repository at this point in the history
…ndocumented (unsupported).
  • Loading branch information
DavidAnson committed Dec 5, 2024
1 parent 8da43dd commit b404c8b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,31 @@ const results = lintSync({ "strings": { "content": original } });
const fixed = applyFixes(original, results.content);
```

### Miscellaneous

To get the [semantic version][semver] of the library, the `getVersion` method
can be used:

```javascript
/**
* Gets the (semantic) version of the library.
*
* @returns {string} SemVer string.
*/
function getVersion() { ... }
```

Invoking `getVersion` is simple:

```javascript
import { getVersion } from "markdownlint";

// Displays the library version
console.log(getVersion());
```

[semver]: https://semver.org

## Usage

Invoke `lint` and use the `result` object's `toString` method:
Expand Down
5 changes: 4 additions & 1 deletion example/standalone.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// @ts-check

import { applyFixes } from "markdownlint";
import { applyFixes, getVersion } from "markdownlint";
import { lint as lintAsync } from "markdownlint/async";
import { lint as lintPromise } from "markdownlint/promise";
import { lint as lintSync } from "markdownlint/sync";

// Displays the library version
console.log(getVersion());

const options = {
"files": [ "good.md", "bad.md" ],
"strings": {
Expand Down
1 change: 1 addition & 0 deletions test/markdownlint-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ test("readmeHeadings", (t) => new Promise((resolve) => {
"#### callback",
"#### result",
"### Fixing",
"### Miscellaneous",
"## Usage",
"## Browser",
"## Examples",
Expand Down

0 comments on commit b404c8b

Please sign in to comment.