pantsdown 1.8.0 → 1.8.2
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/README.md +1 -8
- package/package.json +7 -7
- package/src/tokenizer.ts +4 -3
- package/src/utils.ts +3 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Pantsdown is a **Markdown** to **HTML** converter. It attempts to render markdown similar to how GitHub does it plus
|
|
9
9
|
some features developed specifically for [github-preview.nvim](https://github.com/wallpants/github-preview.nvim).
|
|
10
10
|
|
|
11
|
-
If you need a feature that's supported by GitHub and is not already listed in the [Roadmap](
|
|
11
|
+
If you need a feature that's supported by GitHub and is not already listed in the [Roadmap](#-roadmap),
|
|
12
12
|
feel free to open an issue.
|
|
13
13
|
|
|
14
14
|
## [▶️ Demo](https://wallpants.github.io/pantsdown/)
|
|
@@ -137,10 +137,3 @@ console.log(html);
|
|
|
137
137
|
|
|
138
138
|
Pantsdown is based on [Marked](https://github.com/markedjs/marked).
|
|
139
139
|
Without their hard work, Pantsdown would not exist.
|
|
140
|
-
|
|
141
|
-
## 🚀 Roadmap
|
|
142
|
-
|
|
143
|
-
- [ ] check if copy code button works with current vite docs
|
|
144
|
-
- [ ] showcase more in demo | list features
|
|
145
|
-
- [ ] [Alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)
|
|
146
|
-
- [ ] [Mermaid](https://mermaid.js.org/) usage docs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantsdown",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"author": "wallpants",
|
|
5
5
|
"description": "Markdown to 'GitHub HTML' parser",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"format": "prettier
|
|
30
|
+
"format": "prettier **.{md,ts,css} -w",
|
|
31
31
|
"lint": "tsc && eslint . --ext ts --report-unused-disable-directives --max-warnings 0",
|
|
32
32
|
"commit": "cz",
|
|
33
33
|
"docs:build": "bun run docs/build.ts"
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@happy-dom/global-registrator": "^12.10.3",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
47
|
-
"@typescript-eslint/parser": "^6.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
47
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
48
48
|
"bun-types": "latest",
|
|
49
49
|
"commitizen": "^4.3.0",
|
|
50
50
|
"cz-conventional-changelog": "^3.3.0",
|
|
51
|
-
"eslint": "^8.
|
|
52
|
-
"prettier": "^3.0.
|
|
51
|
+
"eslint": "^8.53.0",
|
|
52
|
+
"prettier": "^3.0.3",
|
|
53
53
|
"prettier-plugin-organize-imports": "^3.2.3",
|
|
54
|
-
"semantic-release": "^22.0.
|
|
54
|
+
"semantic-release": "^22.0.7",
|
|
55
55
|
"typescript": "5.2.2"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/src/tokenizer.ts
CHANGED
|
@@ -725,7 +725,7 @@ export class Tokenizer {
|
|
|
725
725
|
endReg.lastIndex = 0;
|
|
726
726
|
|
|
727
727
|
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
728
|
-
maskedSrc = maskedSrc.slice(-1 * src.length +
|
|
728
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
729
729
|
|
|
730
730
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
731
731
|
// eslint-disable-next-line
|
|
@@ -755,8 +755,9 @@ export class Tokenizer {
|
|
|
755
755
|
|
|
756
756
|
// Remove extra characters. *a*** -> *a*
|
|
757
757
|
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
758
|
-
|
|
759
|
-
const
|
|
758
|
+
// char length can be >1 for unicode characters;
|
|
759
|
+
const lastCharLength = [...match[0]]![0]!.length;
|
|
760
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
760
761
|
|
|
761
762
|
// Create `em` if smallest delimiter has odd char count. *a***
|
|
762
763
|
if (Math.min(lLength, rLength) % 2) {
|
package/src/utils.ts
CHANGED
|
@@ -285,16 +285,16 @@ export const ALERTS = [
|
|
|
285
285
|
{
|
|
286
286
|
variant: "Note",
|
|
287
287
|
regex: makeAlertRegex("Note"),
|
|
288
|
-
icon: '<svg class="octicon octicon-info
|
|
288
|
+
icon: '<svg class="octicon octicon-info" style="margin-right: 0.5rem;" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>',
|
|
289
289
|
},
|
|
290
290
|
{
|
|
291
291
|
variant: "Important",
|
|
292
292
|
regex: makeAlertRegex("Important"),
|
|
293
|
-
icon: '<svg class="octicon octicon-report
|
|
293
|
+
icon: '<svg class="octicon octicon-report" style="margin-right: 0.5rem;" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',
|
|
294
294
|
},
|
|
295
295
|
{
|
|
296
296
|
variant: "Warning",
|
|
297
297
|
regex: makeAlertRegex("Warning"),
|
|
298
|
-
icon: '<svg class="octicon octicon-alert
|
|
298
|
+
icon: '<svg class="octicon octicon-alert" style="margin-right: 0.5rem;" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',
|
|
299
299
|
},
|
|
300
300
|
];
|