fix-md-tables 1.0.0 → 1.1.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/lib/index.mjs +5 -2
- package/package.json +9 -3
package/lib/index.mjs
CHANGED
|
@@ -97,10 +97,13 @@ export function splitCellContent(cell) {
|
|
|
97
97
|
return [cell.slice(0, leadingEnd), cell.slice(leadingEnd, trailingStart), cell.slice(trailingStart)];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/** Compensate a regular cell by adding ideographic spaces
|
|
100
|
+
/** Compensate a regular cell by adding ideographic spaces and removing equivalent regular spaces */
|
|
101
101
|
export function compensateRegularCell(cell, compensation) {
|
|
102
102
|
const [leadingSpace, content, trailingSpace] = splitCellContent(cell);
|
|
103
|
-
|
|
103
|
+
// Remove 2 regular spaces per ideographic space (both are 2 cols visually)
|
|
104
|
+
const spacesToRemove = compensation * 2;
|
|
105
|
+
const newTrailingSpace = trailingSpace.length > spacesToRemove ? trailingSpace.slice(spacesToRemove) : "";
|
|
106
|
+
return leadingSpace + content + IDEOGRAPHIC_SPACE.repeat(compensation) + newTrailingSpace;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
/** Process a single cell, applying emoji compensation */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fix-md-tables",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Fix markdown table alignment for emoji using ideographic spaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
"lint": "eslint .",
|
|
21
21
|
"lint:fix": "eslint . --fix",
|
|
22
22
|
"test": "vitest run",
|
|
23
|
-
"test:watch": "vitest"
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"changelog": "changelogen --output CHANGELOG.md",
|
|
25
|
+
"release": "pnpm run check && changelogen --release && git push --follow-tags",
|
|
26
|
+
"release:patch": "pnpm run check && changelogen --release --patch && git push --follow-tags",
|
|
27
|
+
"release:minor": "pnpm run check && changelogen --release --minor && git push --follow-tags",
|
|
28
|
+
"release:major": "pnpm run check && changelogen --release --major && git push --follow-tags"
|
|
24
29
|
},
|
|
25
30
|
"keywords": [
|
|
26
31
|
"markdown",
|
|
@@ -34,13 +39,14 @@
|
|
|
34
39
|
"license": "MIT",
|
|
35
40
|
"repository": {
|
|
36
41
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/
|
|
42
|
+
"url": "https://github.com/JoobyPM/fix-md-tables"
|
|
38
43
|
},
|
|
39
44
|
"engines": {
|
|
40
45
|
"node": ">=18"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
43
48
|
"@eslint/js": "^9.39.2",
|
|
49
|
+
"changelogen": "^0.6.2",
|
|
44
50
|
"eslint": "^9.39.2",
|
|
45
51
|
"globals": "^16.5.0",
|
|
46
52
|
"prettier": "^3.4.2",
|