joplin-plugin-markdown-formatter 1.1.0 → 1.3.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bwat47
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  # Markdown Formatter
8
8
 
9
- A Joplin plugin that formats the current note's Markdown with configurable, conservative rules.
9
+ A Joplin plugin that formats the current note's Markdown with some configurable rules.
10
10
 
11
- The formatter is designed for note cleanup rather than wholesale rewriting: it parses Markdown to find
11
+ The plugin parses Markdown to find
12
12
  known structures, then applies targeted edits to the original text. Syntax it does not explicitly
13
13
  understand is left alone.
14
14
 
@@ -20,22 +20,24 @@ understand is left alone.
20
20
  - Renumber ordered lists sequentially while preserving the first item's number.
21
21
  - Normalize emphasis and bold delimiters.
22
22
  - Normalize heading levels so they increase by at most one level at a time.
23
- - Preserve, tighten (when list doesn't contain block content), or loosen list spacing.
23
+ - Normalize list spacing: semantic (keep each list tight or loose as authored, fixing mixed spacing), preserve, tight, or loose.
24
24
  - Normalize nested list indentation with tabs, 2 spaces, or 4 spaces.
25
25
  - Normalize Horizontal rule format and spacing above/below.
26
26
  - Optionally align GitHub Flavored Markdown tables.
27
27
  - Ensure headings have a blank line before and after neighboring content.
28
28
  - Collapse repeated blank lines outside protected content.
29
+ - Trim trailing whitespace outside protected content, preserving two-space hard line breaks.
29
30
  - Ensure the note ends with exactly one trailing newline.
30
31
  - Apply changes through CodeMirror so formatting is undoable with Joplin's normal undo command.
31
32
 
32
33
  ## Usage
33
34
 
34
- Install the plugin, open a Markdown note, then run:
35
+ Install the plugin, open a Markdown note, then:
35
36
 
36
37
  - `Edit -> Format Markdown`
37
38
  - `Ctrl+Alt+F` on Windows/Linux
38
39
  - `Cmd+Alt+F` on macOS
40
+ - Click `Format Markdown` button in the formatting toolbar
39
41
 
40
42
  The command formats the currently open note. If the note is already formatted, it does not write the note
41
43
  back.
@@ -44,19 +46,20 @@ back.
44
46
 
45
47
  Settings are available under `Markdown Formatter` in Joplin's plugin settings.
46
48
 
47
- | Setting | Default | Description |
48
- | -------------------------------- | ------------------- | ----------------------------------------------------------------------- |
49
- | Unordered list marker | `-` | Rewrite unordered bullets to dash or asterisk. |
50
- | Normalize ordered list numbering | On | Renumber ordered lists sequentially, keeping the first item number. |
51
- | Normalize heading level increments | On | Lower skipped heading levels so headings increase one level at a time. |
52
- | Emphasis (italic) marker | `*emphasis*` | Prefer `*` or `_` for emphasis delimiters. |
53
- | Bold marker | `**bold**` | Prefer `**` or `__` for strong delimiters. |
54
- | List spacing | Preserve as written | Preserve, tighten, or loosen spacing between list items. |
55
- | List indentation | Tabs | Indentation used before nested list markers. |
56
- | Align table columns | Off | Pad table cells so pipes line up. |
57
- | Ensure blank lines around headings | On | Add one blank line before and after headings with neighboring content. |
58
- | Collapse consecutive blank lines | On | Reduce runs of blank lines to one blank line outside protected content. |
59
- | Ensure trailing newline | On | End the note with exactly one newline. |
49
+ | Setting | Default | Description |
50
+ | ---------------------------------- | ------------------- | ----------------------------------------------------------------------- |
51
+ | Unordered list marker | `-` | Rewrite unordered bullets to dash or asterisk. |
52
+ | Normalize ordered list numbering | On | Renumber ordered lists sequentially, keeping the first item number. |
53
+ | Normalize heading level increments | On | Lower skipped heading levels so headings increase one level at a time. |
54
+ | Emphasis (italic) marker | `*emphasis*` | Prefer `*` or `_` for emphasis delimiters. |
55
+ | Bold marker | `**bold**` | Prefer `**` or `__` for strong delimiters. |
56
+ | List spacing | Semantic | Semantic keeps each list tight or loose as authored and only fixes mixed spacing, so rendering never changes. Preserve, tight, and loose are also available. |
57
+ | List indentation | Tabs | Indentation used before nested list markers. |
58
+ | Align table columns | Off | Pad table cells so pipes line up. |
59
+ | Ensure blank lines around headings | On | Add one blank line before and after headings with neighboring content. |
60
+ | Collapse consecutive blank lines | On | Reduce runs of blank lines to one blank line outside protected content. |
61
+ | Trim trailing whitespace | On | Remove trailing spaces and tabs outside protected content, preserving two-space hard line breaks. |
62
+ | Ensure trailing newline | On | End the note with exactly one newline. |
60
63
 
61
64
  ## Safety Model
62
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joplin-plugin-markdown-formatter",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "scripts": {
5
5
  "dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
6
6
  "prepare": "npm run dist",
@@ -36,7 +36,6 @@
36
36
  "glob": "^8.0.3",
37
37
  "globals": "^17.6.0",
38
38
  "jest": "^30.4.2",
39
- "jest-environment-jsdom": "^30.4.1",
40
39
  "prettier": "^3.8.4",
41
40
  "tar": "^7.5.9",
42
41
  "ts-jest": "^29.4.11",
@@ -46,10 +45,13 @@
46
45
  "webpack-cli": "^7.1.0"
47
46
  },
48
47
  "dependencies": {
48
+ "diff-match-patch-es": "^1.0.1",
49
49
  "mdast-util-from-markdown": "^2.0.3",
50
50
  "mdast-util-frontmatter": "^2.0.1",
51
51
  "mdast-util-gfm": "^3.1.0",
52
+ "mdast-util-math": "^3.0.0",
52
53
  "micromark-extension-frontmatter": "^2.0.0",
53
- "micromark-extension-gfm": "^3.0.0"
54
+ "micromark-extension-gfm": "^3.0.0",
55
+ "micromark-extension-math": "^3.1.0"
54
56
  }
55
57
  }
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 1,
3
3
  "id": "com.bwat47.joplin-markdown-formatter",
4
4
  "app_min_version": "3.5",
5
- "version": "1.1.0",
5
+ "version": "1.3.0",
6
6
  "platforms": [
7
7
  "desktop",
8
8
  "mobile"
@@ -29,6 +29,6 @@
29
29
  "src": "images/markdown-formatter-promo.png",
30
30
  "label": "Markdown Formatter Promo Tile"
31
31
  },
32
- "_publish_hash": "sha256:dc50b70fcec22acb9114fbef93c491970838730fb887e34bded2d227f43f56e6",
33
- "_publish_commit": "main:7c2746ef5c9a396bb0b2b7af6258abafd85d8878"
32
+ "_publish_hash": "sha256:4580136d7d13cfb0af2d21c95b7c175ec39dfe29957bf9d6f3e24e3a07323d18",
33
+ "_publish_commit": "main:b96d375e10df3bdbd40124eb59b16025f6247024"
34
34
  }