mdrefine 0.2.0-rc.3 → 0.2.1
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 +84 -0
- package/CONTRIBUTING.md +2 -1
- package/README.md +1 -1
- 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 +14 -7
- package/dist/cli/main.js.map +1 -1
- package/dist/rules/blocks.js +17 -5
- package/dist/rules/blocks.js.map +1 -1
- package/dist/rules/style.js +93 -21
- package/dist/rules/style.js.map +1 -1
- package/dist/syntax/parse.d.ts +14 -1
- package/dist/syntax/parse.js +25 -3
- package/dist/syntax/parse.js.map +1 -1
- package/dist/workspace/discovery.d.ts +8 -3
- package/dist/workspace/discovery.js +21 -9
- package/dist/workspace/discovery.js.map +1 -1
- package/dist/workspace/files.d.ts +17 -1
- package/dist/workspace/files.js +82 -6
- package/dist/workspace/files.js.map +1 -1
- package/docs/api.md +3 -1
- package/docs/benchmarks.md +41 -41
- package/docs/cli.md +17 -7
- package/docs/design.md +5 -0
- package/docs/dialects.md +2 -1
- package/docs/integrations.md +8 -2
- package/docs/quick-start.md +1 -1
- package/docs/rules.md +18 -4
- package/package.json +2 -2
package/docs/design.md
CHANGED
|
@@ -63,6 +63,11 @@ The comparison is only as good as the parser's reading:
|
|
|
63
63
|
and `style/block-spacing` leave text whose second line is a table delimiter
|
|
64
64
|
row as written ([issue
|
|
65
65
|
#283](https://github.com/viell-dev/slop-markdown-tools/issues/283)).
|
|
66
|
+
- Front matter needs a closing line. A first line of `---` or `+++` that no
|
|
67
|
+
later line closes is read as renderers read it, as a thematic break or text,
|
|
68
|
+
with the lists and block quotes below it; the parser's front matter extension
|
|
69
|
+
reads them as paragraphs there, so the tool leaves it out for such a document
|
|
70
|
+
([issue #278](https://github.com/viell-dev/slop-markdown-tools/issues/278)).
|
|
66
71
|
- Front matter ends at the next `---` or `+++` line, also one inside a code
|
|
67
72
|
block, for the parser, for site generators, and for GitHub's file view when
|
|
68
73
|
the front matter is a YAML mapping. GitHub's comments, and renderers without
|
package/docs/dialects.md
CHANGED
|
@@ -20,7 +20,8 @@ what is text, and so what formatting has to leave alone. Choose it in the
|
|
|
20
20
|
| Wikilinks, embeds, highlights (`==…==`), comments (`%%…%%`), `^block-ids` | No | No | No | No | Yes |
|
|
21
21
|
|
|
22
22
|
GitHub's syntax is the common base of the Forgejo, Gitea, and Obsidian dialects,
|
|
23
|
-
and the rules for GitHub Markdown apply to all three.
|
|
23
|
+
and the rules for GitHub Markdown apply to all three. Obsidian marks
|
|
24
|
+
strikethrough with two tildes only, so `~a~` is text there. The syntax that only
|
|
24
25
|
Forgejo and Gitea have is protected from formatting rather than parsed; see
|
|
25
26
|
[Forgejo and Gitea](#forgejo-and-gitea). Syntax that no dialect knows, such as
|
|
26
27
|
an Obsidian plugin's, is read as text: use a suppression comment or an `ignore`
|
package/docs/integrations.md
CHANGED
|
@@ -31,7 +31,10 @@ it runs, and adds what the commands changed to the commit, configure it in
|
|
|
31
31
|
```json
|
|
32
32
|
{
|
|
33
33
|
"lint-staged": {
|
|
34
|
-
"*.{md,markdown}": [
|
|
34
|
+
"*.{md,markdown}": [
|
|
35
|
+
"mdtools format --write --no-warn-ignored",
|
|
36
|
+
"mdtools lint --max-warnings 0 --no-warn-ignored"
|
|
37
|
+
]
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
```
|
|
@@ -43,9 +46,12 @@ the commit adds or changes:
|
|
|
43
46
|
```sh
|
|
44
47
|
#!/bin/sh
|
|
45
48
|
git diff --cached --name-only -z --diff-filter=ACMR -- '*.md' '*.markdown' |
|
|
46
|
-
xargs -0 -r npx mdtools lint --max-warnings 0 --
|
|
49
|
+
xargs -0 -r npx mdtools lint --max-warnings 0 --no-warn-ignored --
|
|
47
50
|
```
|
|
48
51
|
|
|
52
|
+
In both, `--no-warn-ignored` leaves out the
|
|
53
|
+
[warning](cli.md#which-files-are-processed) for a changed file that the tool
|
|
54
|
+
skips, such as one that the configuration's `ignore` patterns match.
|
|
49
55
|
`--diff-filter=ACMR` leaves out deleted files, which would be an error as paths.
|
|
50
56
|
`xargs -r` skips the command when no file changed. `--` keeps a file name that
|
|
51
57
|
starts with `-` from being read as an option. This hook checks each file as it
|
package/docs/quick-start.md
CHANGED
|
@@ -6,7 +6,7 @@ mdrefine needs Node.js 22.12 or newer. Install the package in the project that
|
|
|
6
6
|
holds your documents:
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install --save-dev --save-exact mdrefine@0.2.
|
|
9
|
+
npm install --save-dev --save-exact mdrefine@0.2.1
|
|
10
10
|
npx --no-install mdtools --help
|
|
11
11
|
```
|
|
12
12
|
|
package/docs/rules.md
CHANGED
|
@@ -761,6 +761,13 @@ so are the exceptions of [Forgejo and Gitea](dialects.md#forgejo-and-gitea):
|
|
|
761
761
|
the dollar decides whether dollar math ends there.
|
|
762
762
|
- Emphasis that begins on the line of an alert's or a callout's marker and ends
|
|
763
763
|
below it.
|
|
764
|
+
- Emphasis whose text holds a run of tildes that could mark strikethrough, one
|
|
765
|
+
or two tildes or in Obsidian two, while the paragraph holds another: GitHub
|
|
766
|
+
can read strikethrough there and the markers as text.
|
|
767
|
+
- A `_`, old or new, that only tildes separate from a letter or digit, as in
|
|
768
|
+
`x~~_b_~~`, which GitHub reads as inside a word.
|
|
769
|
+
- Text whose markers CommonMark pairs otherwise than the parser, as in
|
|
770
|
+
`xab***a* a*y`: GitHub follows CommonMark, so the parser misread the text.
|
|
764
771
|
|
|
765
772
|
## `style/final-newline`
|
|
766
773
|
|
|
@@ -825,7 +832,9 @@ because directly below text its line would continue the paragraph. It keeps its
|
|
|
825
832
|
`#` when its text starts like another block, such as a list item, block quote,
|
|
826
833
|
thematic break, fence, HTML, or link reference definition, when it contains `|`,
|
|
827
834
|
which `---` below it could make a table, or when it ends with a backslash, and
|
|
828
|
-
on Forgejo and Gitea when it contains `{`.
|
|
835
|
+
on Forgejo and Gitea when it contains `{`. Below a first line of `---` that no
|
|
836
|
+
line closes, a level-2 underline has at least four `-`, because `---` would
|
|
837
|
+
close it as front matter.
|
|
829
838
|
|
|
830
839
|
## `style/inline-code`
|
|
831
840
|
|
|
@@ -1100,8 +1109,11 @@ means:
|
|
|
1100
1109
|
`---` would underline as a heading.
|
|
1101
1110
|
- On the line of a list item whose marker is the new marker's character, as in
|
|
1102
1111
|
`- ***` with `---`: `- ---` is one thematic break, not a list item.
|
|
1103
|
-
- At the start of a document,
|
|
1104
|
-
|
|
1112
|
+
- At the start of a document, with `---`, which would open front matter if a
|
|
1113
|
+
later line of `---` closed it, and a `---` that site generators read as the
|
|
1114
|
+
start of front matter.
|
|
1115
|
+
- With `---`, at the start of a line below a first line of `---` that no line
|
|
1116
|
+
closes, which `---` would close as front matter.
|
|
1105
1117
|
|
|
1106
1118
|
## `style/trailing-space`
|
|
1107
1119
|
|
|
@@ -1149,7 +1161,9 @@ span, an image, math, a link's destination, a template tag on one line such as
|
|
|
1149
1161
|
`{% data x %}` or `{{ title }}`, and a word longer than the line stay whole and
|
|
1150
1162
|
can overflow; a code span or an image description written across lines is joined
|
|
1151
1163
|
onto one, without the spaces and tabs that start its next line, as renderers
|
|
1152
|
-
read it.
|
|
1164
|
+
read it. In Obsidian, the text of a link stays whole and is joined onto one line
|
|
1165
|
+
too, because Live Preview shows a link whose text spans lines as its Markdown
|
|
1166
|
+
source. List markers, block quote markers, and indentation count toward the
|
|
1153
1167
|
width, a tab up to the next multiple of four columns.
|
|
1154
1168
|
|
|
1155
1169
|
A word that would start a block at the start of a line, such as a list marker,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdrefine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Configurable Markdown linting and formatting for CommonMark, GitHub, Forgejo, Gitea, and Obsidian",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public",
|
|
39
39
|
"registry": "https://registry.npmjs.org/",
|
|
40
|
-
"tag": "
|
|
40
|
+
"tag": "latest"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|