mdrefine 0.2.3 → 0.2.5
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 +65 -0
- package/CONTRIBUTING.md +21 -1
- package/README.md +1 -1
- package/dist/core/engine.js +14 -3
- package/dist/core/engine.js.map +1 -1
- package/dist/rules/blocks.js +39 -4
- package/dist/rules/blocks.js.map +1 -1
- package/dist/rules/dialects.js +11 -0
- package/dist/rules/dialects.js.map +1 -1
- package/dist/rules/links.js +9 -2
- package/dist/rules/links.js.map +1 -1
- package/dist/rules/style.js +78 -1
- package/dist/rules/style.js.map +1 -1
- package/dist/syntax/misread-lists.d.ts +59 -8
- package/dist/syntax/misread-lists.js +273 -5
- package/dist/syntax/misread-lists.js.map +1 -1
- package/dist/syntax/obsidian.js +10 -2
- package/dist/syntax/obsidian.js.map +1 -1
- package/docs/design.md +7 -4
- package/docs/dialects.md +5 -2
- package/docs/obsidian.md +32 -0
- package/docs/quick-start.md +1 -1
- package/docs/rules.md +28 -14
- package/package.json +3 -1
package/docs/design.md
CHANGED
|
@@ -31,9 +31,10 @@ The comparison is only as good as the parser's reading:
|
|
|
31
31
|
- It compares syntax trees, and does not run GitHub's, Forgejo's, Gitea's, or
|
|
32
32
|
Obsidian's renderer. To find documents that renderers read otherwise than the
|
|
33
33
|
parser, the tests format generated documents and CommonMark's examples and
|
|
34
|
-
compare the HTML of commonmark.js and markdown-it before and after,
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
compare the HTML of commonmark.js and markdown-it before and after, a weekly
|
|
35
|
+
workflow does the same with GitHub's renderer, and a check started by hand
|
|
36
|
+
compares Obsidian's Live Preview and Reading view, with Obsidian running in
|
|
37
|
+
Docker. Each difference found is tracked as an issue.
|
|
37
38
|
- It reads the document in its dialect, so it cannot notice that the dialect is
|
|
38
39
|
wrong. In CommonMark a table is an ordinary paragraph, and joining its lines
|
|
39
40
|
changes nothing that CommonMark sees. This is why the tool [assumes a
|
|
@@ -146,7 +147,9 @@ Files:
|
|
|
146
147
|
Syntax:
|
|
147
148
|
|
|
148
149
|
- Obsidian inline comments that span several paragraphs are not fully read;
|
|
149
|
-
suppress formatting around them or use comment blocks.
|
|
150
|
+
suppress formatting around them or use comment blocks. A comment on lines of
|
|
151
|
+
its own directly above text is read as a block before a paragraph, where
|
|
152
|
+
Obsidian reads one paragraph; both show the same text. Heading nesting paths
|
|
150
153
|
in links, property aliases, PDF subpaths, and the syntax of community plugins
|
|
151
154
|
are not supported.
|
|
152
155
|
- Forgejo's and Gitea's own syntax, such as definition lists, backslash math,
|
package/docs/dialects.md
CHANGED
|
@@ -127,8 +127,11 @@ On GitHub, Forgejo, and Gitea, more fragments are valid:
|
|
|
127
127
|
Both render GitHub Markdown and more. The tool parses their documents as GitHub
|
|
128
128
|
Markdown and protects the rest:
|
|
129
129
|
|
|
130
|
-
- A
|
|
131
|
-
|
|
130
|
+
- A definition description, a line starting with `: ` below its term, holds
|
|
131
|
+
blocks on Forgejo and Gitea, as a list item does, and so do the lines indented
|
|
132
|
+
below it: `: 2. Step` is a list there, and a fence starts code. No rule
|
|
133
|
+
changes the paragraph with such a line or the blocks indented below it. A
|
|
134
|
+
paragraph with a display-math line starting with `\[` is not wrapped.
|
|
132
135
|
- `\(…\)` math and `[[…]]` shortlinks on one line are kept whole; a pair split
|
|
133
136
|
across lines keeps its paragraph from being wrapped. Emphasis markers inside
|
|
134
137
|
`\(…\)` are not changed, and code spans are not joined where that would put
|
package/docs/obsidian.md
CHANGED
|
@@ -52,6 +52,38 @@ paragraph is left as written in the cases that
|
|
|
52
52
|
are not consistent, or inline syntax that runs from the title into the body. A
|
|
53
53
|
title that is too long is reported by `reportUnbreakable`.
|
|
54
54
|
|
|
55
|
+
## Where Obsidian reads Markdown its own way
|
|
56
|
+
|
|
57
|
+
Obsidian's Reading view and Live Preview read some Markdown otherwise than
|
|
58
|
+
CommonMark, and otherwise than each other. Where formatting would change what a
|
|
59
|
+
note shows there, the tool keeps the text as written:
|
|
60
|
+
|
|
61
|
+
- A paragraph, heading, or table cell with a backtick that no run of backticks
|
|
62
|
+
closes, such as ``a ` b``, also in a highlight, an inline comment, or the text
|
|
63
|
+
of a link or image. Live Preview shows the text after it as code, at least to
|
|
64
|
+
the end of its line, and Reading view pairs a run of two or more backticks
|
|
65
|
+
with a later, shorter run. No rule changes such a block. A backtick in math or
|
|
66
|
+
a wikilink does not count.
|
|
67
|
+
- The blocks below a run of three or more backticks that nothing closes. Live
|
|
68
|
+
Preview shows them as code too, across blank lines and out of a list item, up
|
|
69
|
+
to a run of the same length outside an indented code block, a fenced code
|
|
70
|
+
block, or a list item. No rule changes them, nor a table that holds such a
|
|
71
|
+
run.
|
|
72
|
+
- A paragraph with a later line that starts a list item in Obsidian, where
|
|
73
|
+
CommonMark reads more of the paragraph: Live Preview starts a list at a number
|
|
74
|
+
other than 1 with text after it, as in `3. Step`, except in a block quote, and
|
|
75
|
+
Reading view at an empty item, `*`, `+`, `- `, or `1.`, as in `Text` and `- `
|
|
76
|
+
below it, which the parser reads as a heading. No rule changes such a
|
|
77
|
+
paragraph, nor the blocks below it that start further right than the marker,
|
|
78
|
+
which Live Preview reads inside the item, or the block after those.
|
|
79
|
+
- A line of blank space that holds a tab, which Reading view reads as more of
|
|
80
|
+
the paragraph above it, and one directly below an HTML block such as
|
|
81
|
+
`<div>…</div>`, which continues the block. The blocks below such a line are
|
|
82
|
+
more of the HTML block too, up to an empty line, and Reading view shows them
|
|
83
|
+
as written. No rule empties the line or changes those blocks. A comment, and
|
|
84
|
+
the other HTML blocks that end at their own end marker, such as `<pre>`, do
|
|
85
|
+
not continue.
|
|
86
|
+
|
|
55
87
|
## Vaults inside a larger workspace
|
|
56
88
|
|
|
57
89
|
A note belongs to the nearest vault at or above its directory, wherever the
|
package/docs/quick-start.md
CHANGED
package/docs/rules.md
CHANGED
|
@@ -290,7 +290,8 @@ only when the new destination leads to the same file and fragment.
|
|
|
290
290
|
- `extension`: whether the path to a Markdown file ends in `.md`. `omit` applies
|
|
291
291
|
in the Obsidian dialect only.
|
|
292
292
|
- `leadingDot`: with `relative`, start a path with `./` when it does not start
|
|
293
|
-
with
|
|
293
|
+
with `./` or `../`, also a path to a name that starts with a dot, such as
|
|
294
|
+
`./.gitignore`.
|
|
294
295
|
|
|
295
296
|
A relative path also gets `./` when it would otherwise name a different file at
|
|
296
297
|
the vault's root. A destination that already has the configured spelling keeps
|
|
@@ -447,7 +448,9 @@ Options: none.
|
|
|
447
448
|
|
|
448
449
|
Writes the type of an Obsidian callout in lowercase, custom types included. The
|
|
449
450
|
title and the body are left as written, and so is a marker written with an
|
|
450
|
-
escape or a character reference, such as `\[!TIP]
|
|
451
|
+
escape or a character reference, such as `\[!TIP]`, and one that Obsidian shows
|
|
452
|
+
as text because more than one space or a tab separates it from the quote's `>`,
|
|
453
|
+
as in `> [!TIP]`.
|
|
451
454
|
|
|
452
455
|
Before:
|
|
453
456
|
|
|
@@ -611,7 +614,9 @@ lines at the start and at the end of a document. The option `maximum` is an
|
|
|
611
614
|
integer of at least 1; the default is 1. The line break that ends the last line
|
|
612
615
|
stays; [`style/final-newline`](#stylefinal-newline) adds it where it is missing.
|
|
613
616
|
Inside a block quote, a line of only `>` markers is a blank line, and repeated
|
|
614
|
-
ones are removed the same way.
|
|
617
|
+
ones are removed the same way. In the Obsidian dialect, a line of blank space
|
|
618
|
+
that holds a tab, or that lies directly below an HTML block, is not blank:
|
|
619
|
+
Obsidian's Reading view reads it as more of the paragraph or block above it.
|
|
615
620
|
|
|
616
621
|
Before, with three blank lines between the blocks and two at the end:
|
|
617
622
|
|
|
@@ -783,6 +788,12 @@ so are the exceptions of [Forgejo and Gitea](dialects.md#forgejo-and-gitea):
|
|
|
783
788
|
`x~~_b_~~`, which GitHub reads as inside a word.
|
|
784
789
|
- Text whose markers CommonMark pairs otherwise than the parser, as in
|
|
785
790
|
`xab***a* a*y`: GitHub follows CommonMark, so the parser misread the text.
|
|
791
|
+
- In Obsidian, a paragraph, heading, or table cell whose text holds a `*` or `_`
|
|
792
|
+
that is not a marker, as in `snake_case` or `5 * 3`. Obsidian's Reading view
|
|
793
|
+
pairs such a character with a later one, so `snake_case and _em_` shows
|
|
794
|
+
`case and _em` as emphasis, and `snake_case and *em*` is right only with the
|
|
795
|
+
`*` kept. Escaped characters and those in code, math, or wikilinks do not
|
|
796
|
+
count.
|
|
786
797
|
|
|
787
798
|
## `style/final-newline`
|
|
788
799
|
|
|
@@ -1179,14 +1190,16 @@ Line one\
|
|
|
1179
1190
|
line two
|
|
1180
1191
|
```
|
|
1181
1192
|
|
|
1182
|
-
Blank space is left as written where it is content:
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1193
|
+
Blank space is left as written where it is content: on a line of blank space
|
|
1194
|
+
that holds a tab or lies directly below an HTML block in the Obsidian dialect,
|
|
1195
|
+
which Obsidian's Reading view reads as more of the block above it; in code
|
|
1196
|
+
blocks, except on their fence lines, and in HTML, math, front matter, Obsidian
|
|
1197
|
+
comments, code spans, and link titles and labels that span lines. With
|
|
1198
|
+
`"backslash"`, a break stays as spaces where a backslash would change what the
|
|
1199
|
+
line says: after another backslash, after a literal autolink such as
|
|
1200
|
+
`www.example.com`, which would take the backslash into its address, on the title
|
|
1201
|
+
line of an alert or callout, in a paragraph that starts like a link reference
|
|
1202
|
+
definition (`[label]:`), and on Forgejo and Gitea inside `\(...\)` math.
|
|
1190
1203
|
|
|
1191
1204
|
## `style/wrap`
|
|
1192
1205
|
|
|
@@ -1204,9 +1217,10 @@ onto one, without the spaces and tabs that start its next line, as renderers
|
|
|
1204
1217
|
read it. On a lazy continuation line, which keeps them, such a code span stays
|
|
1205
1218
|
as written, and so does its paragraph. In Obsidian, the text of a link stays
|
|
1206
1219
|
whole and is joined onto one line too, because Live Preview shows a link whose
|
|
1207
|
-
text spans lines as its Markdown source.
|
|
1208
|
-
|
|
1209
|
-
|
|
1220
|
+
text spans lines as its Markdown source. For the same reason, an inline footnote
|
|
1221
|
+
(`^[…]`) on one line stays whole there, and a paragraph with one that spans
|
|
1222
|
+
lines keeps its lines. List markers, block quote markers, and indentation count
|
|
1223
|
+
toward the width, a tab up to the next multiple of four columns.
|
|
1210
1224
|
|
|
1211
1225
|
A word that would start a block at the start of a line, such as a list marker,
|
|
1212
1226
|
`#`, `>`, a run of `-` or `=`, or a table delimiter row such as `|---|`, stays
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdrefine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Configurable Markdown linting and formatting for CommonMark, GitHub, Forgejo, Gitea, and Obsidian",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -91,6 +91,8 @@
|
|
|
91
91
|
"docs:preview": "vitepress preview docs",
|
|
92
92
|
"benchmark": "node benchmarks/run.mjs",
|
|
93
93
|
"prebenchmark": "npm run build",
|
|
94
|
+
"check:obsidian": "run-s build check:obsidian:run",
|
|
95
|
+
"check:obsidian:run": "node scripts/obsidian-check.mjs",
|
|
94
96
|
"release:prepare": "run-s check release:pack",
|
|
95
97
|
"release:pack": "node scripts/package-smoke.mjs --retain",
|
|
96
98
|
"schema": "run-s build schema:write",
|