prettier-plugin-markdown-list-tabwidth 1.1.0 → 1.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 CHANGED
@@ -1,3 +1,9 @@
1
+ # v1.2.0
2
+
3
+ ## Changes
4
+
5
+ - Removed the `/replace-parser` export and made it the default behavior, as MDX throws errors about frontmatter when the old printer is used with the newer parser.
6
+
1
7
  # v1.1.0
2
8
 
3
9
  ## Additions
package/README.md CHANGED
@@ -16,11 +16,9 @@ Starting in v3.4.0, Prettier switched to a fixed single space between a list mar
16
16
 
17
17
  Prior to this change, Prettier ensured that the marker + following spaces always consumed exactly `tabWidth` characters, producing indentation that aligned consistently across nested lists, multiline items, and mixed marker widths.
18
18
 
19
- The way this plugin works is that it replaces the printer/formatter for Markdown with the one from Prettier v3.3.3.
19
+ Any other issues you may have experienced due to the v3.4.0 update are also fixed by this plugin.
20
20
 
21
- Note: It does NOT replace the Markdown parser with that from Prettier v3.3.3, only the printer, the parser uses the one from your current version of Prettier except it sets the `astFormat` property to reference the v3.3.3 markdown printer.
22
- If you do want it to replace the parser, import it as `prettier-plugin-markdown-list-tabwidth/replace-parser` instead of `prettier-plugin-markdown-list-tabwidth`.
23
- If you want it to export the Markdown language and options from Prettier v3.3.3 as well, import it as `prettier-plugin-markdown-list-tabwidth/full-replace`.
21
+ The way this plugin works is that it replaces the parser and printer/formatter for Markdown, MDX, and Remark with the ones from Prettier v3.3.3.
24
22
 
25
23
  This plugin supports Markdown, MDX, and Remark.
26
24
 
@@ -40,7 +38,7 @@ npm i prettier-plugin-markdown-list-tabwidth --save-dev
40
38
 
41
39
  ## Usage
42
40
 
43
- To use the plugin, just `prettier-plugin-markdown-list-tabwidth` to the plugins array of your prettier config.
41
+ To use the plugin, just add `prettier-plugin-markdown-list-tabwidth` to the plugins array of your prettier config.
44
42
 
45
43
  ```json
46
44
  // .prettierrc
@@ -49,16 +47,7 @@ To use the plugin, just `prettier-plugin-markdown-list-tabwidth` to the plugins
49
47
  }
50
48
  ```
51
49
 
52
- If you are having issues with the plugin, try importing the `replace-parser` version, as it doesn't attempt to import your current prettier installation, and replaces the parser with the one from Prettier v3.3.3 that is guaranteed to be compatible with the printer used by the plugin.
53
-
54
- ```json
55
- // .prettierrc
56
- {
57
- "plugins": ["prettier-plugin-markdown-list-tabwidth/replace-parser"]
58
- }
59
- ```
60
-
61
- If you are still having issues after trying `replace-parser`, then try `full-replace` which will export the Markdown language and options from Prettier v3.3.3 as well, which should fix your issue.
50
+ If you are having issues with the plugin, try importing the `full-replace` version, which will export the Markdown language and options from Prettier v3.3.3 as well, which should fix your issue.
62
51
 
63
52
  ```json
64
53
  // .prettierrc
package/index.mjs CHANGED
@@ -1,50 +1,24 @@
1
1
  import * as prettier333MarkdownPlugin from "./prettier-3.3.3-markdown-plugin.mjs";
2
- // import * as prettierCurrentMarkdownPlugin from "prettier/plugins/markdown.mjs";
3
- import { createRequire } from "module"; // Use `module` instead of `node:module` to support Node < 14.13.0.
4
-
5
- let prettierCurrentMarkdownPlugin;
6
-
7
- try {
8
- // Resolve from project root
9
- const requireFromProject = createRequire(process.cwd() + "/");
10
- prettierCurrentMarkdownPlugin = requireFromProject("prettier/plugins/markdown.mjs");
11
- } catch {
12
- // Fallback: resolve from plugin directory
13
- const requireFromPlugin = createRequire(import.meta.url);
14
- prettierCurrentMarkdownPlugin = requireFromPlugin("prettier/plugins/markdown.mjs");
15
- }
16
2
 
17
3
  export const parsers = {
18
4
  markdown: {
19
5
  // The prettier Markdown parser from the currently installed prettier version.
20
- ...prettierCurrentMarkdownPlugin.parsers.markdown,
6
+ ...prettier333MarkdownPlugin.parsers.markdown,
21
7
  // Overrides the prettier Markdown parser's AST format.
22
8
  astFormat: "prettier-3.3.3-mdast",
23
9
  },
24
- "markdown-original": {
25
- // The prettier Markdown parser from the currently installed prettier version.
26
- ...prettierCurrentMarkdownPlugin.parsers.markdown,
27
- },
28
10
  mdx: {
29
11
  // The prettier MDX parser from the currently installed prettier version.
30
- ...prettierCurrentMarkdownPlugin.parsers.mdx,
12
+ ...prettier333MarkdownPlugin.parsers.mdx,
31
13
  // Overrides the prettier MDX parser's AST format.
32
14
  astFormat: "prettier-3.3.3-mdast",
33
15
  },
34
- "mdx-original": {
35
- // The prettier MDX parser from the currently installed prettier version.
36
- ...prettierCurrentMarkdownPlugin.parsers.mdx,
37
- },
38
16
  remark: {
39
17
  // The prettier Remark parser from the currently installed prettier version.
40
- ...prettierCurrentMarkdownPlugin.parsers.remark,
18
+ ...prettier333MarkdownPlugin.parsers.remark,
41
19
  // Overrides the prettier Remark parser's AST format.
42
20
  astFormat: "prettier-3.3.3-mdast",
43
21
  },
44
- "remark-original": {
45
- // The prettier Remark parser from the currently installed prettier version.
46
- ...prettierCurrentMarkdownPlugin.parsers.remark,
47
- },
48
22
  };
49
23
  export const printers = {
50
24
  // Adds the prettier v3.3.3 Markdown printer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-markdown-list-tabwidth",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A Prettier plugin that reverts the change in Prettier v3.4.0 that altered how Markdown list items are indented.",
5
5
  "keywords": [
6
6
  "prettier",
@@ -37,7 +37,6 @@
37
37
  "module": "./index.mjs",
38
38
  "exports": {
39
39
  ".": "./index.mjs",
40
- "./replace-parser": "./index-replace-parser.mjs",
41
40
  "./full-replace": "./index-full-replace.mjs",
42
41
  "./packge.json": "./package.json",
43
42
  "./*": "./*.mjs",
@@ -48,7 +47,11 @@
48
47
  "prettier": "*"
49
48
  },
50
49
  "devDependencies": {
51
- "prettier": "^3.7.4"
50
+ "@types/node": "14.0.0",
51
+ "eslint": "^9.39.2",
52
+ "eslint-plugin-import": "^2.32.0",
53
+ "prettier": "^3.7.4",
54
+ "typescript-eslint": "^8.52.0"
52
55
  },
53
56
  "engines": {
54
57
  "node": ">=14"
@@ -1,31 +0,0 @@
1
- import * as prettier333MarkdownPlugin from "./prettier-3.3.3-markdown-plugin.mjs";
2
-
3
- export const parsers = {
4
- markdown: {
5
- // Replaces the prettier Markdown parser with the one from Prettier v3.3.3.
6
- ...prettier333MarkdownPlugin.parsers.markdown,
7
- // Overrides the prettier Markdown parser's AST format.
8
- astFormat: "prettier-3.3.3-mdast",
9
- },
10
- mdx: {
11
- // Replaces the prettier MDX parser with the one from Prettier v3.3.3.
12
- ...prettier333MarkdownPlugin.parsers.mdx,
13
- // Overrides the prettier MDX parser's AST format.
14
- astFormat: "prettier-3.3.3-mdast",
15
- },
16
- remark: {
17
- // Replaces the prettier Remark parser with the one from Prettier v3.3.3.
18
- ...prettier333MarkdownPlugin.parsers.remark,
19
- // Overrides the prettier Remark parser's AST format.
20
- astFormat: "prettier-3.3.3-mdast",
21
- },
22
- };
23
- export const printers = {
24
- // Adds the prettier v3.3.3 Markdown printer.
25
- "prettier-3.3.3-mdast": prettier333MarkdownPlugin.printers.mdast,
26
- };
27
-
28
- export default {
29
- parsers,
30
- printers,
31
- };