@cloro-dev/response-parser 0.5.1 โ 0.5.3
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 +22 -25
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A powerful TypeScript library for parsing AI model responses from ChatGPT, Gemin
|
|
|
10
10
|
- ๐ **Auto-Detection**: Automatically detects the AI provider from response structure
|
|
11
11
|
- ๐จ **Built-in Styling**: Provider-specific styling
|
|
12
12
|
- ๐ง **Framework-Agnostic**: Pure HTML output for any framework
|
|
13
|
-
-
|
|
13
|
+
- ๐งน **Script removal**: Removes `<script>` and `<noscript>` elements. This is not a full HTML sanitizer.
|
|
14
14
|
- ๐ฆ **TypeScript**: Full TypeScript support with comprehensive types
|
|
15
15
|
- ๐ฏ **Lightweight**: No runtime dependencies for core parsing
|
|
16
16
|
|
|
@@ -26,7 +26,9 @@ pnpm add @cloro-dev/response-parser
|
|
|
26
26
|
|
|
27
27
|
## Quick Start
|
|
28
28
|
|
|
29
|
-
This library parses AI responses and returns
|
|
29
|
+
This library parses AI responses and returns HTML strings. You can render the HTML in any framework.
|
|
30
|
+
|
|
31
|
+
> **Security**: The parser removes only `<script>` and `<noscript>` elements. It does not remove event handler attributes (for example `onerror=`) or `javascript:` URLs. If the HTML comes from a source that you do not trust, sanitize `parsed.html` with a full HTML sanitizer (for example [DOMPurify](https://github.com/cure53/DOMPurify)) before you render it.
|
|
30
32
|
|
|
31
33
|
```typescript
|
|
32
34
|
import { parseAiResponse, detectProvider } from "@cloro-dev/response-parser";
|
|
@@ -36,7 +38,7 @@ const response = await fetchAIResponse();
|
|
|
36
38
|
const parsed = parseAiResponse(response);
|
|
37
39
|
|
|
38
40
|
console.log(parsed.provider); // 'CHATGPT' | 'GEMINI' | etc.
|
|
39
|
-
console.log(parsed.html); //
|
|
41
|
+
console.log(parsed.html); // HTML with <script> and <noscript> elements removed
|
|
40
42
|
console.log(parsed.text); // Plain text version
|
|
41
43
|
```
|
|
42
44
|
|
|
@@ -236,6 +238,15 @@ The core parsing logic is identical - you just need to handle the HTML rendering
|
|
|
236
238
|
|
|
237
239
|
## What's Changed
|
|
238
240
|
|
|
241
|
+
### v0.5.3
|
|
242
|
+
|
|
243
|
+
- First release from the Publish workflow, with npm Trusted Publishing and provenance. No library changes
|
|
244
|
+
|
|
245
|
+
### v0.5.2
|
|
246
|
+
|
|
247
|
+
- โ
**Fixed** The README said that the parser sanitizes HTML. It removes only `<script>` and `<noscript>` elements. A new Security note tells you to sanitize untrusted HTML before you render it
|
|
248
|
+
- โ
**Fixed** The `package.json` repository URL now points to `cloro-dev/response-parser`
|
|
249
|
+
|
|
239
250
|
### v0.5.1
|
|
240
251
|
|
|
241
252
|
- โ
**Fixed** ChatGPT `removeSources` now hides the open sources dialog of the mobile page
|
|
@@ -306,7 +317,7 @@ The core parsing logic is identical - you just need to handle the HTML rendering
|
|
|
306
317
|
|
|
307
318
|
### v0.1.3
|
|
308
319
|
|
|
309
|
-
- โ
**Always
|
|
320
|
+
- โ
**Always removes** `<script>` and `<noscript>` elements from the HTML
|
|
310
321
|
- โ
**Always includes** provider-specific styles
|
|
311
322
|
- โ
**Always uses** provider's base URL for relative links
|
|
312
323
|
- โ **Removed** `theme` option (styles are provider-specific)
|
|
@@ -335,33 +346,19 @@ pnpm lint
|
|
|
335
346
|
|
|
336
347
|
## Release
|
|
337
348
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
```bash
|
|
341
|
-
npm login
|
|
342
|
-
```
|
|
349
|
+
The [Publish workflow](.github/workflows/publish.yml) publishes the package to npm when a version tag is pushed. It uses npm Trusted Publishing, so you do not need to log in to npm.
|
|
343
350
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
```bash
|
|
347
|
-
pnpm type-check && pnpm lint && pnpm build
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
3. Increase the version. This changes `package.json` and creates a git commit and tag:
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
npm version patch # 0.4.5 โ 0.4.6
|
|
354
|
-
npm version minor # 0.4.5 โ 0.5.0
|
|
355
|
-
npm version major # 0.4.5 โ 1.0.0
|
|
356
|
-
```
|
|
351
|
+
1. Add an entry under "What's Changed".
|
|
357
352
|
|
|
358
|
-
|
|
353
|
+
2. Increase the version. This changes `package.json` and creates a git commit and a `v` tag:
|
|
359
354
|
|
|
360
355
|
```bash
|
|
361
|
-
npm
|
|
356
|
+
npm version patch # 0.5.2 โ 0.5.3
|
|
357
|
+
npm version minor # 0.5.2 โ 0.6.0
|
|
358
|
+
npm version major # 0.5.2 โ 1.0.0
|
|
362
359
|
```
|
|
363
360
|
|
|
364
|
-
|
|
361
|
+
3. Push the commit and the tag. The workflow type-checks, lints, builds and publishes:
|
|
365
362
|
|
|
366
363
|
```bash
|
|
367
364
|
git push --follow-tags
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloro-dev/response-parser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Parse and render AI model responses from ChatGPT, Gemini, Perplexity, and more",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
|
-
"url": "https://github.com/cloro/response-parser.git"
|
|
43
|
+
"url": "https://github.com/cloro-dev/response-parser.git"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rollup/plugin-commonjs": "^25.0.7",
|