mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add README documentation for getVersion, leave promise/extendConfig undocumented (unsupported).
This commit is contained in:
parent
8da43dd246
commit
b404c8bf16
3 changed files with 30 additions and 1 deletions
25
README.md
25
README.md
|
|
@ -804,6 +804,31 @@ const results = lintSync({ "strings": { "content": original } });
|
||||||
const fixed = applyFixes(original, results.content);
|
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
|
## Usage
|
||||||
|
|
||||||
Invoke `lint` and use the `result` object's `toString` method:
|
Invoke `lint` and use the `result` object's `toString` method:
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import { applyFixes } from "markdownlint";
|
import { applyFixes, getVersion } from "markdownlint";
|
||||||
import { lint as lintAsync } from "markdownlint/async";
|
import { lint as lintAsync } from "markdownlint/async";
|
||||||
import { lint as lintPromise } from "markdownlint/promise";
|
import { lint as lintPromise } from "markdownlint/promise";
|
||||||
import { lint as lintSync } from "markdownlint/sync";
|
import { lint as lintSync } from "markdownlint/sync";
|
||||||
|
|
||||||
|
// Displays the library version
|
||||||
|
console.log(getVersion());
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
"files": [ "good.md", "bad.md" ],
|
"files": [ "good.md", "bad.md" ],
|
||||||
"strings": {
|
"strings": {
|
||||||
|
|
|
||||||
|
|
@ -692,6 +692,7 @@ test("readmeHeadings", (t) => new Promise((resolve) => {
|
||||||
"#### callback",
|
"#### callback",
|
||||||
"#### result",
|
"#### result",
|
||||||
"### Fixing",
|
"### Fixing",
|
||||||
|
"### Miscellaneous",
|
||||||
"## Usage",
|
"## Usage",
|
||||||
"## Browser",
|
"## Browser",
|
||||||
"## Examples",
|
"## Examples",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue