@cloro-dev/response-parser 0.5.1 โ 0.5.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 +11 -4
- 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,11 @@ 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.2
|
|
242
|
+
|
|
243
|
+
- โ
**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
|
|
244
|
+
- โ
**Fixed** The `package.json` repository URL now points to `cloro-dev/response-parser`
|
|
245
|
+
|
|
239
246
|
### v0.5.1
|
|
240
247
|
|
|
241
248
|
- โ
**Fixed** ChatGPT `removeSources` now hides the open sources dialog of the mobile page
|
|
@@ -306,7 +313,7 @@ The core parsing logic is identical - you just need to handle the HTML rendering
|
|
|
306
313
|
|
|
307
314
|
### v0.1.3
|
|
308
315
|
|
|
309
|
-
- โ
**Always
|
|
316
|
+
- โ
**Always removes** `<script>` and `<noscript>` elements from the HTML
|
|
310
317
|
- โ
**Always includes** provider-specific styles
|
|
311
318
|
- โ
**Always uses** provider's base URL for relative links
|
|
312
319
|
- โ **Removed** `theme` option (styles are provider-specific)
|
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.2",
|
|
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",
|