mdrefine 0.2.0-rc.2 → 0.2.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.
- package/CHANGELOG.md +577 -0
- package/CODE_OF_CONDUCT.md +30 -0
- package/CONTRIBUTING.md +189 -16
- package/README.md +100 -154
- package/SECURITY.md +15 -13
- package/config.schema.json +91 -0
- package/dist/cli/diff.d.ts +10 -0
- package/dist/cli/diff.js +247 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/main.js +270 -150
- package/dist/cli/main.js.map +1 -1
- package/dist/config/load.js +67 -6
- package/dist/config/load.js.map +1 -1
- package/dist/config/problems.d.ts +7 -0
- package/dist/config/problems.js +208 -0
- package/dist/config/problems.js.map +1 -0
- package/dist/config/resolve.d.ts +42 -109
- package/dist/config/resolve.js +193 -52
- package/dist/config/resolve.js.map +1 -1
- package/dist/core/directives.d.ts +7 -0
- package/dist/core/directives.js +25 -13
- package/dist/core/directives.js.map +1 -1
- package/dist/core/engine.d.ts +42 -4
- package/dist/core/engine.js +518 -79
- package/dist/core/engine.js.map +1 -1
- package/dist/core/frozen.d.ts +6 -0
- package/dist/core/frozen.js +15 -0
- package/dist/core/frozen.js.map +1 -0
- package/dist/core/scope.d.ts +30 -0
- package/dist/core/scope.js +122 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/core/types.d.ts +202 -23
- package/dist/core/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +3 -0
- package/dist/node.js +4 -0
- package/dist/node.js.map +1 -0
- package/dist/rules/blocks.d.ts +34 -0
- package/dist/rules/blocks.js +550 -0
- package/dist/rules/blocks.js.map +1 -0
- package/dist/rules/content.d.ts +2 -0
- package/dist/rules/content.js +85 -0
- package/dist/rules/content.js.map +1 -0
- package/dist/rules/dialects.js +10 -6
- package/dist/rules/dialects.js.map +1 -1
- package/dist/rules/links.js +302 -6
- package/dist/rules/links.js.map +1 -1
- package/dist/rules/lists.d.ts +2 -0
- package/dist/rules/lists.js +924 -0
- package/dist/rules/lists.js.map +1 -0
- package/dist/rules/structure.js +127 -1
- package/dist/rules/structure.js.map +1 -1
- package/dist/rules/style.d.ts +8 -2
- package/dist/rules/style.js +1137 -165
- package/dist/rules/style.js.map +1 -1
- package/dist/syntax/block-identifier.d.ts +18 -0
- package/dist/syntax/block-identifier.js +24 -0
- package/dist/syntax/block-identifier.js.map +1 -0
- package/dist/syntax/obsidian.d.ts +29 -11
- package/dist/syntax/obsidian.js +9 -10
- package/dist/syntax/obsidian.js.map +1 -1
- package/dist/syntax/parse.d.ts +87 -3
- package/dist/syntax/parse.js +247 -19
- package/dist/syntax/parse.js.map +1 -1
- package/dist/workspace/access.d.ts +12 -3
- package/dist/workspace/access.js +33 -5
- package/dist/workspace/access.js.map +1 -1
- package/dist/workspace/discovery.d.ts +85 -0
- package/dist/workspace/discovery.js +155 -0
- package/dist/workspace/discovery.js.map +1 -0
- package/dist/workspace/encoding.d.ts +24 -0
- package/dist/workspace/encoding.js +113 -0
- package/dist/workspace/encoding.js.map +1 -0
- package/dist/workspace/files.d.ts +92 -6
- package/dist/workspace/files.js +715 -59
- package/dist/workspace/files.js.map +1 -1
- package/dist/workspace/git.d.ts +54 -0
- package/dist/workspace/git.js +198 -0
- package/dist/workspace/git.js.map +1 -0
- package/dist/workspace/index.d.ts +58 -3
- package/dist/workspace/index.js +136 -37
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/selection.d.ts +2 -2
- package/dist/workspace/selection.js +3 -3
- package/dist/workspace/selection.js.map +1 -1
- package/dist/workspace/slug.js +8 -1
- package/dist/workspace/slug.js.map +1 -1
- package/dist/workspace/vault.js +3 -1
- package/dist/workspace/vault.js.map +1 -1
- package/docs/api.md +239 -0
- package/docs/benchmarks.md +140 -200
- package/docs/changelog.md +1 -0
- package/docs/cli.md +281 -89
- package/docs/configuration.md +193 -480
- package/docs/design.md +163 -284
- package/docs/dialects.md +169 -0
- package/docs/examples.md +151 -109
- package/docs/index.md +21 -37
- package/docs/integrations.md +144 -0
- package/docs/obsidian.md +91 -115
- package/docs/plugins.md +147 -212
- package/docs/quick-start.md +68 -74
- package/docs/rules.md +1237 -0
- package/docs/versions.md +56 -0
- package/examples/README.md +17 -14
- package/examples/automation/summarize-report.mjs +5 -2
- package/examples/library/lint-folder.mjs +5 -4
- package/examples/library/lint-workspace.mjs +32 -0
- package/examples/plugin/notes/release-checklist.md +2 -2
- package/examples/plugin/rules.mjs +17 -23
- package/examples/workspaces/obsidian-vault/after/mdtools.config.jsonc +2 -2
- package/examples/workspaces/obsidian-vault/before/mdtools.config.jsonc +2 -2
- package/examples/workspaces/repository-docs/after/README.md +2 -2
- package/examples/workspaces/repository-docs/after/mdtools.config.jsonc +0 -2
- package/examples/workspaces/repository-docs/before/README.md +2 -2
- package/examples/workspaces/repository-docs/before/docs/guide.md +7 -7
- package/examples/workspaces/repository-docs/before/docs/reference.md +3 -1
- package/examples/workspaces/repository-docs/before/mdtools.config.jsonc +0 -2
- package/package.json +38 -12
- package/docs/contributing.md +0 -218
- package/docs/releases/0.1.0-beta.1.md +0 -39
- package/docs/releases/0.1.0-beta.2.md +0 -83
- package/docs/releases/0.1.0-beta.3.md +0 -61
- package/docs/releases/0.1.0-beta.4.md +0 -50
- package/docs/releases/0.1.0-rc.1.md +0 -99
- package/docs/releases/0.2.0-rc.1.md +0 -141
- package/docs/releases/0.2.0-rc.2.md +0 -225
- package/docs/releases.md +0 -144
- package/docs/testing.md +0 -93
package/docs/versions.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Versions
|
|
2
|
+
|
|
3
|
+
Version numbers follow [Semantic Versioning](https://semver.org/). Before 1.0,
|
|
4
|
+
the second number plays the part of the first: a minor release such as 0.3.0 may
|
|
5
|
+
change what 0.2 does, and the [changelog](changelog.md) says how, while a patch
|
|
6
|
+
release such as 0.2.1 only fixes defects.
|
|
7
|
+
|
|
8
|
+
## What a version number covers
|
|
9
|
+
|
|
10
|
+
- the `mdtools` commands, their options, and their exit codes;
|
|
11
|
+
- the [JSON report](cli.md#json-report) printed with `--json`: its fields and
|
|
12
|
+
what they mean;
|
|
13
|
+
- the configuration: file names, keys, presets, dialect names, rule IDs, rule
|
|
14
|
+
options, what each of them means, and where its [JSON
|
|
15
|
+
Schema](configuration.md#json-schema) is found;
|
|
16
|
+
- the library's exports from `mdrefine` and `mdrefine/node`, their TypeScript
|
|
17
|
+
types, and the plugin contract described in [library API](api.md) and
|
|
18
|
+
[plugins](plugins.md);
|
|
19
|
+
- the supported Node.js versions, given by `engines` in `package.json`.
|
|
20
|
+
|
|
21
|
+
These can change in any release:
|
|
22
|
+
|
|
23
|
+
- the wording of messages: diagnostics, warnings, and the summary line. A script
|
|
24
|
+
should read the exit code and the JSON report, whose diagnostics carry rule
|
|
25
|
+
IDs.
|
|
26
|
+
- formatting output that changes because a defect is fixed. A patch release can
|
|
27
|
+
format a document differently where the previous version damaged it, refused
|
|
28
|
+
it, or read it the wrong way, and can report findings that the defect hid.
|
|
29
|
+
- speed and memory use, and the figures on the [benchmark page](benchmarks.md).
|
|
30
|
+
- files of the package that the documentation does not describe.
|
|
31
|
+
|
|
32
|
+
A deliberate change of what formatting produces, such as a new default, a rule
|
|
33
|
+
added to a preset, or a changed option, comes in a minor release, and so does a
|
|
34
|
+
higher minimum Node.js version. Pin the exact version, as the
|
|
35
|
+
[installation](quick-start.md#install) does, so that you choose when such a
|
|
36
|
+
change reaches your documents.
|
|
37
|
+
|
|
38
|
+
## Releases and channels
|
|
39
|
+
|
|
40
|
+
From 0.2.0, the first stable release, npm's `latest` tag names the newest stable
|
|
41
|
+
release. Release candidates and betas are published under the tags `rc` and
|
|
42
|
+
`beta` and leave `latest` alone. Only the newest release line receives fixes;
|
|
43
|
+
see the [security
|
|
44
|
+
policy](https://github.com/viell-dev/slop-markdown-tools/blob/main/SECURITY.md).
|
|
45
|
+
This site describes the newest stable release.
|
|
46
|
+
|
|
47
|
+
A version named in the repository is not necessarily published. The registry is
|
|
48
|
+
the source of truth:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm view mdrefine versions
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Each release has a [GitHub
|
|
55
|
+
release](https://github.com/viell-dev/slop-markdown-tools/releases) with the
|
|
56
|
+
tested package and its checksum.
|
package/examples/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# Examples
|
|
2
2
|
|
|
3
|
-
Working examples of configuring, running, and extending
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Working examples of configuring, running, and extending mdrefine. The [examples
|
|
4
|
+
page](https://viell-dev.github.io/slop-markdown-tools/examples.html) walks
|
|
5
|
+
through each one with its input and output. The integration tests run every
|
|
6
|
+
example, so what is here matches what the tool does.
|
|
7
7
|
|
|
8
8
|
Run the commands below from a built checkout (`npm ci && npm run build`). In a
|
|
9
9
|
project that installs the package, the same files are under
|
|
10
|
-
`node_modules/mdrefine/examples/`, and `npx
|
|
10
|
+
`node_modules/mdrefine/examples/`, and `npx mdtools` replaces
|
|
11
11
|
`node dist/cli/main.js`.
|
|
12
12
|
|
|
13
13
|
## Starting configurations
|
|
14
14
|
|
|
15
15
|
Copy one to the root of your documents as `mdtools.config.jsonc`.
|
|
16
16
|
|
|
17
|
-
| File | For
|
|
18
|
-
| ---------------------------------- |
|
|
19
|
-
| [`github.jsonc`](github.jsonc) | Repositories rendered by GitHub
|
|
20
|
-
| [`forgejo.jsonc`](forgejo.jsonc) | Codeberg and other Forgejo instances
|
|
21
|
-
| [`gitea.jsonc`](gitea.jsonc) | Gitea instances
|
|
22
|
-
| [`obsidian.jsonc`](obsidian.jsonc) | Obsidian vaults, with vault-
|
|
17
|
+
| File | For |
|
|
18
|
+
| ---------------------------------- | ----------------------------------------------- |
|
|
19
|
+
| [`github.jsonc`](github.jsonc) | Repositories rendered by GitHub |
|
|
20
|
+
| [`forgejo.jsonc`](forgejo.jsonc) | Codeberg and other Forgejo instances |
|
|
21
|
+
| [`gitea.jsonc`](gitea.jsonc) | Gitea instances |
|
|
22
|
+
| [`obsidian.jsonc`](obsidian.jsonc) | Obsidian vaults, with vault-relative link paths |
|
|
23
23
|
|
|
24
24
|
## Workspaces before and after formatting
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ reports it afterwards.
|
|
|
32
32
|
two guides for a repository on GitHub.
|
|
33
33
|
- [`workspaces/obsidian-vault/`](workspaces/obsidian-vault/) is a small vault
|
|
34
34
|
with wikilinks, an embed, callouts, a block reference, and an ignored template
|
|
35
|
-
|
|
35
|
+
directory.
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
node dist/cli/main.js lint --root examples/workspaces/repository-docs/before
|
|
@@ -60,12 +60,15 @@ name, which works inside this repository and wherever the package is installed.
|
|
|
60
60
|
```sh
|
|
61
61
|
node examples/library/format-string.mjs
|
|
62
62
|
node examples/library/lint-folder.mjs
|
|
63
|
+
node examples/library/lint-workspace.mjs
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
[`format-string.mjs`](library/format-string.mjs) formats one string.
|
|
66
67
|
[`lint-folder.mjs`](library/lint-folder.mjs) reads a folder of GitHub Markdown,
|
|
67
|
-
builds the workspace that link checks need, and prints diagnostics.
|
|
68
|
-
|
|
68
|
+
builds the workspace that link checks need, and prints diagnostics.
|
|
69
|
+
[`lint-workspace.mjs`](library/lint-workspace.mjs) does the same with
|
|
70
|
+
`mdrefine/node`, which chooses the files as the CLI does. Without an argument,
|
|
71
|
+
both read `workspaces/repository-docs/after`.
|
|
69
72
|
|
|
70
73
|
## Automation
|
|
71
74
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
//
|
|
5
5
|
// The report is one object: { version, mode, files, written }, with a `skipped`
|
|
6
6
|
// list when the run left out a path it was not permitted to read. Each file has
|
|
7
|
-
// a `path`, its `diagnostics`, and for `format` a `changed` flag
|
|
7
|
+
// a `path`, its `diagnostics`, and for `format` a `changed` flag; `written` lists
|
|
8
|
+
// the paths of the files that `format --write` wrote.
|
|
8
9
|
let input = "";
|
|
9
10
|
process.stdin.setEncoding("utf8");
|
|
10
11
|
for await (const chunk of process.stdin) input += chunk;
|
|
@@ -27,7 +28,9 @@ console.log(`${report.mode}: ${report.files.length} file(s), ${diagnostics} diag
|
|
|
27
28
|
if (report.mode === "format") {
|
|
28
29
|
// `changed` stays true for a file that `--write` has just formatted.
|
|
29
30
|
const changed = report.files.filter((file) => file.changed).length;
|
|
30
|
-
|
|
31
|
+
const written = report.written.length;
|
|
32
|
+
if (written) console.log(`${written} file(s) were formatted`);
|
|
33
|
+
if (!written || changed > written) console.log(`${changed - written} file(s) need formatting`);
|
|
31
34
|
}
|
|
32
35
|
for (const [key, entry] of [...counts].sort((a, b) => b[1].count - a[1].count)) {
|
|
33
36
|
console.log(`${entry.count} ${key} in ${entry.files.size} file(s)`);
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// The library never reads or writes files. The host reads them and hands them
|
|
4
4
|
// to createWorkspace(), which is what lets rules check links between documents.
|
|
5
5
|
// This script reads everything below the folder; a real host would skip folders
|
|
6
|
-
// such as .git and node_modules, as the CLI does.
|
|
6
|
+
// such as .git and node_modules, as the CLI does. lint-workspace.mjs leaves that
|
|
7
|
+
// to discoverWorkspace() from "mdrefine/node".
|
|
7
8
|
//
|
|
8
9
|
// node examples/library/lint-folder.mjs [folder]
|
|
9
10
|
import { readdir, readFile } from "node:fs/promises";
|
|
@@ -17,14 +18,14 @@ const folder = path.resolve(
|
|
|
17
18
|
const config = { extends: ["recommended", "github"] };
|
|
18
19
|
|
|
19
20
|
// Workspace keys are forward-slash paths relative to the folder. A Markdown
|
|
20
|
-
// file
|
|
21
|
-
// still resolve.
|
|
21
|
+
// file, named .md or .markdown as the CLI finds them, maps to its text; any
|
|
22
|
+
// other file maps to null, so that links to it still resolve.
|
|
22
23
|
const files = {};
|
|
23
24
|
for (const entry of await readdir(folder, { recursive: true, withFileTypes: true })) {
|
|
24
25
|
if (!entry.isFile()) continue;
|
|
25
26
|
const absolute = path.join(entry.parentPath, entry.name);
|
|
26
27
|
const name = path.relative(folder, absolute).split(path.sep).join("/");
|
|
27
|
-
files[name] = /\.md$/i.test(name) ? await readFile(absolute, "utf8") : null;
|
|
28
|
+
files[name] = /\.(?:md|markdown)$/i.test(name) ? await readFile(absolute, "utf8") : null;
|
|
28
29
|
}
|
|
29
30
|
const workspace = createWorkspace(files, { dialect: "github" });
|
|
30
31
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Lint a workspace on disk through the library, choosing files as the CLI does.
|
|
2
|
+
//
|
|
3
|
+
// discoverWorkspace() from "mdrefine/node" finds the files, honors .gitignore
|
|
4
|
+
// files and the configuration's ignore patterns, leaves out nested
|
|
5
|
+
// repositories and what it may not read, and recognizes Obsidian vaults.
|
|
6
|
+
// options() then gives each document what the CLI passes to lint() and
|
|
7
|
+
// format(). Configuration files are not read: pass the configuration.
|
|
8
|
+
//
|
|
9
|
+
// node examples/library/lint-workspace.mjs [folder]
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { lint } from "mdrefine";
|
|
13
|
+
import { discoverWorkspace } from "mdrefine/node";
|
|
14
|
+
|
|
15
|
+
const root = path.resolve(
|
|
16
|
+
process.argv[2] ?? fileURLToPath(new URL("../workspaces/repository-docs/after", import.meta.url)),
|
|
17
|
+
);
|
|
18
|
+
const config = { extends: ["recommended", "github"] };
|
|
19
|
+
|
|
20
|
+
const discovery = await discoverWorkspace({ root, config });
|
|
21
|
+
for (const item of discovery.skipped) console.log(`skipped: ${item.message}`);
|
|
22
|
+
let errors = 0;
|
|
23
|
+
for (const name of discovery.selected) {
|
|
24
|
+
for (const item of lint(discovery.read(name), discovery.options(name))) {
|
|
25
|
+
if (item.severity === "error") errors += 1;
|
|
26
|
+
console.log(
|
|
27
|
+
`${name}:${item.line}:${item.column} ${item.severity} ${item.rule}: ${item.message}`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
console.log(`${errors} error(s) in ${discovery.selected.length} document(s)`);
|
|
32
|
+
process.exitCode = errors > 0 ? 1 : 0;
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
name: "house",
|
|
16
16
|
presets: {
|
|
17
17
|
recommended: {
|
|
18
|
-
rules: { "house/no-placeholder": "error", "house/
|
|
18
|
+
rules: { "house/no-placeholder": "error", "house/heading-space": "warn" },
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
rules: {
|
|
@@ -57,36 +57,30 @@ export default {
|
|
|
57
57
|
return findings;
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
|
-
"
|
|
61
|
-
description: "Write
|
|
60
|
+
"heading-space": {
|
|
61
|
+
description: "Write one space between a heading's # marks and its text.",
|
|
62
62
|
kind: "style",
|
|
63
63
|
phase: "block",
|
|
64
64
|
check({ document }) {
|
|
65
65
|
const findings = [];
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// "---" would close it as front matter, so no break is rewritten there.
|
|
69
|
-
const opensFrontMatter =
|
|
70
|
-
blocks[0]?.type === "thematicBreak" && document.source.startsWith("---");
|
|
71
|
-
for (const [index, node] of blocks.entries()) {
|
|
72
|
-
if (node.type !== "thematicBreak") continue;
|
|
66
|
+
visit(document.tree, (node) => {
|
|
67
|
+
if (node.type !== "heading" || !node.children.length) return;
|
|
73
68
|
const start = node.position.start.offset;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
previous.position.end.line < node.position.start.line - 1;
|
|
69
|
+
const text = node.children[0].position.start.offset;
|
|
70
|
+
const marks = document.source.slice(start, text);
|
|
71
|
+
const wanted = `${"#".repeat(node.depth)} `;
|
|
72
|
+
// Only a "#" heading starts with its marks: an underlined heading
|
|
73
|
+
// starts with its text, and so the check below leaves it alone. The
|
|
74
|
+
// parser drops the blank space before a heading's text, so changing
|
|
75
|
+
// it cannot change what the heading says.
|
|
76
|
+
if (!/^#+[ \t]+$/.test(marks) || marks === wanted) return;
|
|
83
77
|
findings.push({
|
|
84
78
|
start,
|
|
85
|
-
end,
|
|
86
|
-
message: "Write
|
|
87
|
-
|
|
79
|
+
end: text,
|
|
80
|
+
message: "Write one space after the heading's # marks.",
|
|
81
|
+
edit: { start, end: text, text: wanted },
|
|
88
82
|
});
|
|
89
|
-
}
|
|
83
|
+
});
|
|
90
84
|
return findings;
|
|
91
85
|
},
|
|
92
86
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
// An Obsidian vault; this file sits at the vault root, next to .obsidian/.
|
|
2
|
+
// An Obsidian vault; this file sits at the vault's root, next to .obsidian/.
|
|
3
3
|
"extends": ["recommended", "obsidian"],
|
|
4
4
|
// Templates contain placeholders, not prose. They stay valid link targets.
|
|
5
5
|
"ignore": ["Templates/**"],
|
|
6
6
|
"rules": {
|
|
7
|
-
// Spell Markdown links as vault-
|
|
7
|
+
// Spell Markdown links as vault-relative paths in angle brackets.
|
|
8
8
|
"links/path": ["warn", { "style": "root", "brackets": "angle" }],
|
|
9
9
|
},
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
// An Obsidian vault; this file sits at the vault root, next to .obsidian/.
|
|
2
|
+
// An Obsidian vault; this file sits at the vault's root, next to .obsidian/.
|
|
3
3
|
"extends": ["recommended", "obsidian"],
|
|
4
4
|
// Templates contain placeholders, not prose. They stay valid link targets.
|
|
5
5
|
"ignore": ["Templates/**"],
|
|
6
6
|
"rules": {
|
|
7
|
-
// Spell Markdown links as vault-
|
|
7
|
+
// Spell Markdown links as vault-relative paths in angle brackets.
|
|
8
8
|
"links/path": ["warn", { "style": "root", "brackets": "angle" }],
|
|
9
9
|
},
|
|
10
10
|
}
|
|
@@ -8,8 +8,8 @@ a sensor board and publishes them as a small web page that updates every minute.
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
Follow the [setup guide](./docs/guide.md) first, then read the
|
|
12
|
-
|
|
11
|
+
Follow the [setup guide](./docs/guide.md) first, then read the [sensor
|
|
12
|
+
reference](./docs/reference.md#pressure) to interpret the readings. The
|
|
13
13
|
[calibration notes](docs/calibration.md) explain how to correct a drifting
|
|
14
14
|
sensor.
|
|
15
15
|
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Documentation for a repository hosted on GitHub.
|
|
3
3
|
"extends": ["recommended", "github"],
|
|
4
4
|
"rules": {
|
|
5
|
-
// Not part of a preset: turn underlined headings into "#" headings.
|
|
6
|
-
"style/heading": "warn",
|
|
7
5
|
// Write local links as ./relative paths, which editors can follow too.
|
|
8
6
|
"links/path": ["warn", { "style": "relative", "leadingDot": true }],
|
|
9
7
|
},
|
|
@@ -17,5 +17,5 @@ Follow the [setup guide](docs/guide.md) first, then read the [sensor reference](
|
|
|
17
17
|
| Humidity | % | Yes |
|
|
18
18
|
| Pressure | hPa | Since 1.2 |
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* [X] Publish readings every minute
|
|
21
|
+
* [ ] Keep a week of history
|
|
@@ -3,14 +3,14 @@ Setup guide
|
|
|
3
3
|
|
|
4
4
|
This guide takes a new board from the box to its first published reading. Allow about ten minutes, most of which is waiting for the sensors to settle.
|
|
5
5
|
|
|
6
|
-
1
|
|
7
|
-
2
|
|
6
|
+
1) Connect the board over USB and wait until the status light stops blinking. A steady light means the sensors have settled and the readings can be trusted.
|
|
7
|
+
2) Copy `station.toml` to the board and set the publishing interval:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
~~~toml
|
|
10
|
+
[publish]
|
|
11
|
+
interval_seconds = 60 # Lines in code blocks are never wrapped, however long they are.
|
|
12
|
+
~~~
|
|
13
13
|
|
|
14
|
-
3
|
|
14
|
+
3) Open the page listed under [Usage](../README.md#usage) and check that all three readings appear.
|
|
15
15
|
|
|
16
16
|
Readings that look wrong are usually a unit problem; the [reference](reference.md) lists the unit of every sensor.
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
Reported in degrees Celsius, rounded to one decimal place.
|
|
6
6
|
|
|
7
|
-
## Humidity
|
|
7
|
+
## Humidity ##
|
|
8
8
|
|
|
9
9
|
Reported as relative humidity in percent.
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
|
|
11
13
|
## Pressure
|
|
12
14
|
|
|
13
15
|
Reported in hectopascals. Pressure needs about two minutes after power-on before the first stable value; see the __[setup guide](guide.md)__.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Documentation for a repository hosted on GitHub.
|
|
3
3
|
"extends": ["recommended", "github"],
|
|
4
4
|
"rules": {
|
|
5
|
-
// Not part of a preset: turn underlined headings into "#" headings.
|
|
6
|
-
"style/heading": "warn",
|
|
7
5
|
// Write local links as ./relative paths, which editors can follow too.
|
|
8
6
|
"links/path": ["warn", { "style": "relative", "leadingDot": true }],
|
|
9
7
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdrefine",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Configurable Markdown linting and formatting for CommonMark, GitHub, Forgejo, Gitea, and Obsidian",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"lint",
|
|
8
|
+
"linter",
|
|
9
|
+
"format",
|
|
10
|
+
"formatter",
|
|
11
|
+
"commonmark",
|
|
12
|
+
"gfm",
|
|
13
|
+
"github",
|
|
14
|
+
"forgejo",
|
|
15
|
+
"codeberg",
|
|
16
|
+
"gitea",
|
|
17
|
+
"obsidian",
|
|
18
|
+
"mdast",
|
|
19
|
+
"micromark"
|
|
20
|
+
],
|
|
5
21
|
"type": "module",
|
|
6
22
|
"license": "MIT",
|
|
7
23
|
"author": "viell",
|
|
@@ -21,20 +37,28 @@
|
|
|
21
37
|
"publishConfig": {
|
|
22
38
|
"access": "public",
|
|
23
39
|
"registry": "https://registry.npmjs.org/",
|
|
24
|
-
"tag": "
|
|
40
|
+
"tag": "latest"
|
|
25
41
|
},
|
|
26
42
|
"exports": {
|
|
27
43
|
".": {
|
|
28
44
|
"types": "./dist/index.d.ts",
|
|
29
|
-
"
|
|
30
|
-
}
|
|
45
|
+
"default": "./dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./node": {
|
|
48
|
+
"types": "./dist/node.d.ts",
|
|
49
|
+
"default": "./dist/node.js"
|
|
50
|
+
},
|
|
51
|
+
"./config.schema.json": "./config.schema.json",
|
|
52
|
+
"./package.json": "./package.json"
|
|
31
53
|
},
|
|
32
54
|
"files": [
|
|
33
55
|
"dist",
|
|
56
|
+
"config.schema.json",
|
|
34
57
|
"docs/*.md",
|
|
35
|
-
"docs/releases/*.md",
|
|
36
58
|
"examples",
|
|
37
59
|
"README.md",
|
|
60
|
+
"CHANGELOG.md",
|
|
61
|
+
"CODE_OF_CONDUCT.md",
|
|
38
62
|
"CONTRIBUTING.md",
|
|
39
63
|
"SECURITY.md",
|
|
40
64
|
"LICENSE",
|
|
@@ -68,9 +92,12 @@
|
|
|
68
92
|
"benchmark": "node benchmarks/run.mjs",
|
|
69
93
|
"prebenchmark": "npm run build",
|
|
70
94
|
"release:prepare": "run-s check release:pack",
|
|
71
|
-
"release:pack": "node scripts/package-smoke.mjs --retain"
|
|
95
|
+
"release:pack": "node scripts/package-smoke.mjs --retain",
|
|
96
|
+
"schema": "run-s build schema:write",
|
|
97
|
+
"schema:write": "node scripts/config-schema.mjs"
|
|
72
98
|
},
|
|
73
99
|
"dependencies": {
|
|
100
|
+
"@types/mdast": "4.0.4",
|
|
74
101
|
"ajv": "8.20.0",
|
|
75
102
|
"commander": "15.0.0",
|
|
76
103
|
"decode-named-character-reference": "1.3.0",
|
|
@@ -93,17 +120,16 @@
|
|
|
93
120
|
},
|
|
94
121
|
"devDependencies": {
|
|
95
122
|
"@eslint/js": "10.0.1",
|
|
96
|
-
"@types/
|
|
97
|
-
"@types/node": "26.6.4",
|
|
123
|
+
"@types/node": "22.20.5",
|
|
98
124
|
"@types/unist": "3.0.3",
|
|
99
|
-
"eslint": "10.
|
|
125
|
+
"eslint": "10.13.0",
|
|
100
126
|
"fast-check": "4.10.2",
|
|
101
127
|
"npm-run-all2": "9.0.3",
|
|
102
|
-
"prettier": "3.9.
|
|
128
|
+
"prettier": "3.9.10",
|
|
103
129
|
"typescript": "6.0.3",
|
|
104
|
-
"typescript-eslint": "8.71.
|
|
130
|
+
"typescript-eslint": "8.71.2",
|
|
105
131
|
"vitepress": "2.0.0-alpha.20",
|
|
106
|
-
"vitest": "5.0.
|
|
132
|
+
"vitest": "5.0.5"
|
|
107
133
|
},
|
|
108
134
|
"homepage": "https://viell-dev.github.io/slop-markdown-tools/"
|
|
109
135
|
}
|