pantsdown 2.2.3 → 2.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/.oxfmtrc.json +17 -0
- package/CLAUDE.md +1 -0
- package/README.md +44 -26
- package/bun.lock +1504 -0
- package/eslint.config.ts +46 -0
- package/package.json +47 -43
- package/src/css/styles.css +581 -581
- package/src/lexer.ts +419 -419
- package/src/pantsdown.ts +39 -38
- package/src/parser.ts +223 -239
- package/src/renderer.ts +237 -245
- package/src/rules/block.ts +99 -101
- package/src/rules/inline.ts +92 -92
- package/src/rules/utils.ts +14 -14
- package/src/tokenizer.ts +911 -919
- package/src/types.ts +262 -244
- package/src/utils.ts +278 -241
- package/tsconfig.json +2 -1
- package/.prettierignore +0 -1
- package/src/css/styles.css.d.ts +0 -4
package/.oxfmtrc.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
|
3
|
+
"ignorePatterns": [".github"],
|
|
4
|
+
"printWidth": 100,
|
|
5
|
+
"tabWidth": 3,
|
|
6
|
+
"sortImports": {
|
|
7
|
+
"newlinesBetween": false
|
|
8
|
+
},
|
|
9
|
+
"overrides": [
|
|
10
|
+
{
|
|
11
|
+
"files": ["*.json", "*.md"],
|
|
12
|
+
"options": {
|
|
13
|
+
"tabWidth": 2
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/CLAUDE.md
CHANGED
|
@@ -64,6 +64,7 @@ All token types are defined in `src/types.ts`. The `Token` union type covers all
|
|
|
64
64
|
## Output
|
|
65
65
|
|
|
66
66
|
`pantsdown.parse(markdown)` returns `{ html, javascript }`:
|
|
67
|
+
|
|
67
68
|
- `html`: The rendered HTML string
|
|
68
69
|
- `javascript`: A script for interactive features (task list checkboxes, copy buttons)
|
|
69
70
|
|
package/README.md
CHANGED
|
@@ -105,32 +105,50 @@ import { Pantsdown, type PartialPantsdownConfig } from "pantsdown";
|
|
|
105
105
|
// This is the default config object. If you provide
|
|
106
106
|
// a config object, it will be deeply merged into this.
|
|
107
107
|
const config: PartialPantsdownConfig = {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
108
|
+
renderer: {
|
|
109
|
+
/**
|
|
110
|
+
* Prefix to be added to relative image sources.
|
|
111
|
+
* Must start and end with "/"
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* relativeImageUrlPrefix: "/__localimage__/nested/directory/"
|
|
115
|
+
*
|
|
116
|
+
* 
|
|
117
|
+
* relative src is updated and results in:
|
|
118
|
+
* <img src="/__localimage__/nested/directory/wallpants-512.png" />
|
|
119
|
+
*
|
|
120
|
+
* 
|
|
121
|
+
* absolute src remains unchanged:
|
|
122
|
+
* <img src="https://avatars.githubusercontent.com/wallpants" />
|
|
123
|
+
*/
|
|
124
|
+
relativeImageUrlPrefix: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Prefix to be added to absolute image sources.
|
|
128
|
+
* Must start and end with "/"
|
|
129
|
+
* Falls back to `relativeImageUrlPrefix` if not provided
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* absoluteImageUrlPrefix: "/__localimage__/"
|
|
133
|
+
*
|
|
134
|
+
* 
|
|
135
|
+
* relative src is updated and results in:
|
|
136
|
+
* <img src="/__localimage__/wallpants-512.png" />
|
|
137
|
+
*
|
|
138
|
+
* 
|
|
139
|
+
* external src remains unchanged:
|
|
140
|
+
* <img src="https://avatars.githubusercontent.com/wallpants" />
|
|
141
|
+
*/
|
|
142
|
+
absoluteImageUrlPrefix?: string | undefined;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether to render <details> html tags with attribute `open=""`
|
|
146
|
+
*
|
|
147
|
+
* @default
|
|
148
|
+
* false
|
|
149
|
+
*/
|
|
150
|
+
detailsTagDefaultOpen: boolean;
|
|
151
|
+
};
|
|
134
152
|
};
|
|
135
153
|
|
|
136
154
|
const pantsdown = new Pantsdown(config);
|