{"_id":"@aiapicore/react-intelliparser","_rev":"3-1e3878977c5650ffc2675ed41ae66804","name":"@aiapicore/react-intelliparser","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@aiapicore/react-intelliparser","version":"0.1.0","keywords":["react","llm","ai","openai","anthropic","markdown","parser","renderer","syntax-highlight","mermaid","katex","xml","json","typescript"],"author":{"url":"https://github.com/mirmashhouri","name":"mirmashhouri"},"license":"MIT","_id":"@aiapicore/react-intelliparser@0.1.0","maintainers":[{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"}],"homepage":"https://github.com/aiapicore/react-intelliparser#readme","bugs":{"url":"https://github.com/aiapicore/react-intelliparser/issues"},"dist":{"shasum":"2f2ddb10f4c165ae7087ad95fb10f3f31f34a185","tarball":"https://registry.npmjs.org/@aiapicore/react-intelliparser/-/react-intelliparser-0.1.0.tgz","fileCount":10,"integrity":"sha512-s6qA+5hJE3q2U50NsXdcwcGW7+s3NPBVI8r1e1p8QdEREpmTwPjpFKtm55UUXwQeEHMoKlpRZVU+tXqAEipWcQ==","signatures":[{"sig":"MEQCIAhgXLtCXww2uNsb11c70zHBsKWQghFEWezUwG+43RH4AiAzSNOIsxxPExX45hu9G19nxiEUtHfE5dWV0utGNiz5Ng==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":145523},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./styles.css":"./dist/styles/intelliparser.css"},"gitHead":"ee225284bec5f56f9ab0daa608e91ab28f75da5d","scripts":{"dev":"vite","lint":"eslint .","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.{ts,tsx}\"","test:ui":"vitest --ui","build:watch":"tsup --watch","prepublishOnly":"npm run build"},"_npmUser":{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"},"repository":{"url":"git+https://github.com/aiapicore/react-intelliparser.git","type":"git"},"_npmVersion":"11.6.2","description":"Smart React component that auto-detects and renders any content type from LLM/AI responses — Markdown, JSON, XML, code, Mermaid, math, and more.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"katex":"^0.16.47","js-yaml":"^4.1.1","mermaid":"^11.15.0","rehype-raw":"^7.0.0","remark-gfm":"^4.0.1","remark-math":"^6.0.0","rehype-katex":"^7.0.1","react-markdown":"^10.1.0","fast-xml-parser":"^5.8.0","rehype-sanitize":"^6.0.0","react-syntax-highlighter":"^16.1.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vite":"^8.0.12","react":"^19.2.6","eslint":"^10.3.0","vitest":"^4.1.6","globals":"^17.6.0","prettier":"^3.8.3","react-dom":"^19.2.6","@eslint/js":"^10.0.1","@vitest/ui":"^4.1.6","typescript":"~6.0.2","@types/node":"^24.12.3","@types/katex":"^0.16.8","@types/react":"^19.2.14","@types/js-yaml":"^4.0.9","@types/react-dom":"^19.2.3","typescript-eslint":"^8.59.2","@vitejs/plugin-react":"^6.0.1","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.2","@types/react-syntax-highlighter":"^15.5.13"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-intelliparser_0.1.0_1779187948927_0.9928651436070262","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aiapicore/react-intelliparser","version":"0.1.1","keywords":["react","llm","ai","openai","anthropic","markdown","parser","renderer","syntax-highlight","mermaid","katex","xml","json","typescript"],"author":{"url":"https://github.com/mirmashhouri","name":"mirmashhouri"},"license":"MIT","_id":"@aiapicore/react-intelliparser@0.1.1","maintainers":[{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"}],"homepage":"https://react-intelliparser.vercel.app/","bugs":{"url":"https://github.com/aiapicore/react-intelliparser/issues"},"dist":{"shasum":"ae38ed47dee54513f073e3c591853e343082e05a","tarball":"https://registry.npmjs.org/@aiapicore/react-intelliparser/-/react-intelliparser-0.1.1.tgz","fileCount":10,"integrity":"sha512-E3Fu+tOW87SGS/EIB3O+UH+ymr86/ouOaOP3Bo9cc7qHyeixk9dbe0GE1jGt0g/PPUv4LEm/2TMnvaVDdQzO0A==","signatures":[{"sig":"MEUCIGlFLuCXrOHde/e4zgz8hHv02g6mek8DF08bvZ26eu5qAiEAnGG4H7J2KM4ugOqS0Iza7jAHjYgPpD+Fe58tXs/347I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":145612},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./styles.css":"./dist/styles/intelliparser.css"},"gitHead":"ee225284bec5f56f9ab0daa608e91ab28f75da5d","scripts":{"dev":"vite","lint":"eslint .","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.{ts,tsx}\"","test:ui":"vitest --ui","build:watch":"tsup --watch","prepublishOnly":"npm run build"},"_npmUser":{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"},"repository":{"url":"git+https://github.com/aiapicore/react-intelliparser.git","type":"git"},"_npmVersion":"11.6.2","description":"Smart React component that auto-detects and renders any content type from LLM/AI responses — Markdown, JSON, XML, code, Mermaid, math, and more.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"katex":"^0.16.47","js-yaml":"^4.1.1","mermaid":"^11.15.0","rehype-raw":"^7.0.0","remark-gfm":"^4.0.1","remark-math":"^6.0.0","rehype-katex":"^7.0.1","react-markdown":"^10.1.0","fast-xml-parser":"^5.8.0","rehype-sanitize":"^6.0.0","react-syntax-highlighter":"^16.1.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vite":"^8.0.12","react":"^19.2.6","eslint":"^10.3.0","vitest":"^4.1.6","globals":"^17.6.0","prettier":"^3.8.3","react-dom":"^19.2.6","@eslint/js":"^10.0.1","@vitest/ui":"^4.1.6","typescript":"~6.0.2","@types/node":"^24.12.3","@types/katex":"^0.16.8","@types/react":"^19.2.14","@types/js-yaml":"^4.0.9","@types/react-dom":"^19.2.3","typescript-eslint":"^8.59.2","@vitejs/plugin-react":"^6.0.1","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.2","@types/react-syntax-highlighter":"^15.5.13"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-intelliparser_0.1.1_1779188186599_0.19267118345221879","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"_id":"@aiapicore/react-intelliparser@0.1.2","bugs":{"url":"https://github.com/aiapicore/react-intelliparser/issues"},"dist":{"shasum":"da1d2aba763d9a57435b3e403ce067f85ad9e2ee","tarball":"https://registry.npmjs.org/@aiapicore/react-intelliparser/-/react-intelliparser-0.1.2.tgz","fileCount":10,"integrity":"sha512-S98g0QMWkd8iKQnfl/KMnqL8XcDVPyNEJO04aXwBHxPCSJV2nTZYWY7aJoaGxeDllEPzGtcpAUNy6MG25owjGw==","signatures":[{"sig":"MEYCIQDMaSWaMUBeV6uSqllP3S6F/es8T8/2/6tHkXz6qM8oegIhAO6Ly5Zdoz4c9/8+M7PD1Gun38Q6aTty/ndlfs2dH8Yz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIC6PjIjMfKyWvHI73m0q99GSB8DhYCcDNaXm85Hk0SqPAiAi83BFjyaCrv/a8tPJOMWUhkQblcMeDSnWS/ayfPbBWw=="}],"unpackedSize":2828906},"main":"./dist/index.cjs","name":"@aiapicore/react-intelliparser","type":"module","types":"./dist/index.d.ts","author":{"url":"https://github.com/mirmashhouri","name":"mirmashhouri"},"module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./styles.css":"./dist/styles/intelliparser.css"},"gitHead":"e9dbb0060df6714fc4c9140a61aefca3d5d9a318","license":"MIT","scripts":{"dev":"vite","lint":"eslint .","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.{ts,tsx}\"","test:ui":"vitest --ui","build:watch":"tsup --watch","prepublishOnly":"npm run build"},"version":"0.1.2","_npmUser":{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"},"homepage":"https://react-intelliparser.vercel.app/","keywords":["react","llm","ai","openai","anthropic","markdown","parser","renderer","syntax-highlight","mermaid","katex","xml","json","typescript"],"repository":{"url":"git+https://github.com/aiapicore/react-intelliparser.git","type":"git"},"_npmVersion":"11.6.2","description":"Smart React component that auto-detects and renders any content type from LLM/AI responses — Markdown, JSON, XML, code, Mermaid, math, and more.","directories":{},"maintainers":[{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"}],"_nodeVersion":"22.20.0","dependencies":{"katex":"^0.16.47","js-yaml":"^4.1.1","mermaid":"^11.15.0","rehype-raw":"^7.0.0","remark-gfm":"^4.0.1","remark-math":"^6.0.0","rehype-katex":"^7.0.1","react-markdown":"^10.1.0","fast-xml-parser":"^5.8.0","rehype-sanitize":"^6.0.0","react-syntax-highlighter":"^16.1.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vite":"^8.0.12","react":"^19.2.6","eslint":"^10.3.0","vitest":"^4.1.6","globals":"^17.6.0","prettier":"^3.8.3","react-dom":"^19.2.6","@eslint/js":"^10.0.1","@vitest/ui":"^4.1.6","typescript":"~6.0.2","@types/node":"^24.12.3","@types/katex":"^0.16.8","@types/react":"^19.2.14","@types/js-yaml":"^4.0.9","@types/react-dom":"^19.2.3","typescript-eslint":"^8.59.2","@vitejs/plugin-react":"^6.0.1","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.2","@types/react-syntax-highlighter":"^15.5.13"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-intelliparser_0.1.2_1790771947659_0.7507014504703533"}}},"time":{"created":"2026-05-19T10:52:28.866Z","modified":"2026-09-30T12:39:08.022Z","0.1.0":"2026-05-19T10:52:29.084Z","0.1.1":"2026-05-19T10:56:26.759Z","0.1.2":"2026-09-30T12:39:07.793Z"},"bugs":{"url":"https://github.com/aiapicore/react-intelliparser/issues"},"author":{"url":"https://github.com/mirmashhouri","name":"mirmashhouri"},"license":"MIT","homepage":"https://react-intelliparser.vercel.app/","keywords":["react","llm","ai","openai","anthropic","markdown","parser","renderer","syntax-highlight","mermaid","katex","xml","json","typescript"],"repository":{"url":"git+https://github.com/aiapicore/react-intelliparser.git","type":"git"},"description":"Smart React component that auto-detects and renders any content type from LLM/AI responses — Markdown, JSON, XML, code, Mermaid, math, and more.","maintainers":[{"name":"mirmashhouri","email":"mirmashhouri@gmail.com"}],"readme":"# @aiapicore/react-intelliparser\r\n\r\n> Drop any string from an LLM, API, or CMS — get clean, structured React UI.\r\n\r\n[![npm](https://img.shields.io/npm/v/@aiapicore/react-intelliparser)](https://www.npmjs.com/package/@aiapicore/react-intelliparser)\r\n[![license](https://img.shields.io/npm/l/@aiapicore/react-intelliparser)](./LICENSE)\r\n[![types](https://img.shields.io/npm/types/@aiapicore/react-intelliparser)](https://www.npmjs.com/package/@aiapicore/react-intelliparser)\r\n[![demo](https://img.shields.io/badge/demo-live-blue)](https://react-intelliparser.vercel.app/)\r\n\r\n**react-intelliparser** is a React + TypeScript component purpose-built for rendering AI and LLM responses. It automatically detects what kind of content each part of a raw string is — Markdown, JSON, XML, HTML, YAML, CSV, code, Mermaid diagrams, math equations, plain URLs, or plain text — then renders it with the right component. Zero configuration required.\r\n\r\n---\r\n\r\n## The problem it solves\r\n\r\nLLM APIs (OpenAI, Anthropic, Gemini, etc.) return raw strings that mix multiple content types in a single response:\r\n\r\n```\r\nHere's the data you asked for:\r\n\r\n\\`\\`\\`json\r\n{\"user\": \"Alice\", \"score\": 98}\r\n\\`\\`\\`\r\n\r\nAnd here's the flow:\r\n\r\n\\`\\`\\`mermaid\r\nflowchart LR\r\n  A[Client] --> B[API] --> C[DB]\r\n\\`\\`\\`\r\n```\r\n\r\nWithout react-intelliparser, you write custom parsing logic for every project. With it, you pass the raw string and get properly rendered output — automatically.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Auto-detection** of 11 content types, with language hints for code and Mermaid fences\r\n- **Serialized string support** — handles `\\n` / `\\\"` escaped strings direct from LLM streaming APIs without pre-processing\r\n- Markdown with full GFM support (tables, task lists, strikethrough, blockquotes)\r\n- Syntax-highlighted code blocks with a one-click copy button\r\n- Pretty-printed JSON and XML with proper indentation\r\n- Sanitized HTML rendering (strips `<script>`, `on*` handlers, `javascript:` URLs)\r\n- YAML display and CSV-to-table rendering\r\n- Mermaid diagrams rendered as SVG (opt-in)\r\n- Math equations via KaTeX (opt-in)\r\n- Custom renderer override for any content type\r\n- Secure by default — XSS protection on all HTML paths\r\n- Full TypeScript support — ships type declarations\r\n- Dual ESM + CJS build, tree-shakeable\r\n\r\n---\r\n\r\n## Setup\r\n\r\n### 1. Install\r\n\r\n```bash\r\nnpm install @aiapicore/react-intelliparser\r\n```\r\n\r\n> **Peer dependencies:** `react >= 18`, `react-dom >= 18`\r\n\r\n---\r\n\r\n### 2. Add the stylesheet\r\n\r\nImport the CSS once in your app entry file (e.g. `main.tsx` or `index.tsx`). This covers code block styling, Mermaid layout, and table styles.\r\n\r\n```tsx\r\n// main.tsx\r\nimport \"katex/dist/katex.min.css\";              // required if enableMath: true\r\nimport \"@aiapicore/react-intelliparser/styles.css\";\r\n```\r\n\r\nIf you don't use math, you can skip the KaTeX import.\r\n\r\n---\r\n\r\n### 3. Use the component\r\n\r\n```tsx\r\nimport { IntelliParser } from \"@aiapicore/react-intelliparser\";\r\n\r\nexport function ChatMessage({ content }: { content: string }) {\r\n  return <IntelliParser content={content} />;\r\n}\r\n```\r\n\r\nThat's it — pass any raw string and the library detects and renders every segment automatically.\r\n\r\n---\r\n\r\n### 4. Enable optional renderers\r\n\r\nMermaid diagrams and math equations are opt-in (they add bundle weight). Enable them via the `options` prop:\r\n\r\n```tsx\r\n<IntelliParser\r\n  content={content}\r\n  options={{\r\n    enableMermaid: true,   // renders ```mermaid blocks as SVG\r\n    enableMath: true,      // renders ```math / $$...$$ via KaTeX\r\n  }}\r\n/>\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n```tsx\r\nimport { IntelliParser } from \"@aiapicore/react-intelliparser\";\r\nimport \"@aiapicore/react-intelliparser/styles.css\";\r\n\r\nexport function ChatMessage({ content }: { content: string }) {\r\n  return <IntelliParser content={content} />;\r\n}\r\n```\r\n\r\nPass any raw string — the library figures out the rest.\r\n\r\n---\r\n\r\n## Real-world example: rendering an LLM response\r\n\r\n```tsx\r\nimport { IntelliParser } from \"@aiapicore/react-intelliparser\";\r\nimport \"@aiapicore/react-intelliparser/styles.css\";\r\n\r\n// Raw string exactly as returned from an OpenAI / Anthropic API call\r\nconst llmResponse = `\r\nHere's the user record you asked for:\r\n\r\n\\`\\`\\`json\r\n{\r\n  \"id\": 42,\r\n  \"name\": \"Alice\",\r\n  \"role\": \"admin\",\r\n  \"active\": true\r\n}\r\n\\`\\`\\`\r\n\r\nThe system architecture looks like this:\r\n\r\n\\`\\`\\`mermaid\r\nflowchart LR\r\n  Client --> API --> Database\r\n\\`\\`\\`\r\n\r\nYou can read more at https://docs.example.com\r\n`;\r\n\r\nexport function App() {\r\n  return (\r\n    <IntelliParser\r\n      content={llmResponse}\r\n      options={{ enableMermaid: true, enableMath: true }}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n---\r\n\r\n## Serialized API responses\r\n\r\nLLM streaming APIs sometimes deliver content as a JSON-escaped string — newlines as literal `\\n`, quotes as `\\\"` — rather than a parsed string with real newlines. react-intelliparser detects this automatically and unescapes it before parsing, so you can pass the raw API payload directly:\r\n\r\n```ts\r\n// Content straight from an API response body — no pre-processing needed\r\nconst raw = \"The result is:\\\\n\\\\n\\`\\`\\`json\\\\n{\\\"score\\\": 98}\\\\n\\`\\`\\`\\\\n\\\\nSee https://example.com\";\r\n\r\n<IntelliParser content={raw} />\r\n// Renders: paragraph → JSON code block → URL link\r\n```\r\n\r\n---\r\n\r\n## All options\r\n\r\n```tsx\r\n<IntelliParser\r\n  content={content}\r\n  options={{\r\n    sanitizeHtml: true,        // Sanitize HTML output (default: true)\r\n    enableMarkdown: true,      // Render Markdown (default: true)\r\n    enableHtml: true,          // Render HTML blocks (default: true)\r\n    enableXml: true,           // Render XML blocks (default: true)\r\n    enableJson: true,          // Render JSON blocks (default: true)\r\n    enableYaml: true,          // Render YAML blocks (default: true)\r\n    enableCsv: true,           // Render CSV as tables (default: true)\r\n    enableCodeHighlight: true, // Syntax-highlight code blocks (default: true)\r\n    enableMermaid: false,      // Render Mermaid diagrams (default: false)\r\n    enableMath: false,         // Render math with KaTeX (default: false)\r\n    enableCopyButton: true,    // Show copy button on code blocks (default: true)\r\n    prettifyCode: true,        // Auto-indent JSON and XML (default: true)\r\n  }}\r\n/>\r\n```\r\n\r\n| Option | Default | Description |\r\n|---|---|---|\r\n| `sanitizeHtml` | `true` | Strip dangerous tags and attributes from HTML |\r\n| `enableMarkdown` | `true` | Render Markdown with remark-gfm |\r\n| `enableHtml` | `true` | Render HTML blocks |\r\n| `enableXml` | `true` | Format and render XML |\r\n| `enableJson` | `true` | Pretty-print and render JSON |\r\n| `enableYaml` | `true` | Display YAML in monospace |\r\n| `enableCsv` | `true` | Render CSV as an HTML table |\r\n| `enableCodeHighlight` | `true` | Prism syntax highlighting |\r\n| `enableMermaid` | `false` | Render Mermaid diagrams as SVG |\r\n| `enableMath` | `false` | Render math expressions with KaTeX |\r\n| `enableCopyButton` | `true` | Copy button on code blocks |\r\n| `prettifyCode` | `true` | Auto-indent JSON and XML |\r\n\r\n---\r\n\r\n## Supported content types\r\n\r\n| Type | How it's detected | Renderer |\r\n|---|---|---|\r\n| Markdown | headings, emphasis, lists, links, blockquotes, GFM tables, inline math | `MarkdownBlock` |\r\n| JSON | `{…}` or `[…]` that parses successfully | `JsonBlock` |\r\n| XML | well-formed XML that isn't HTML | `XmlBlock` |\r\n| HTML | `<!DOCTYPE html>` or a known HTML tag, including inline and void elements | `HtmlBlock` |\r\n| YAML | valid structured YAML beginning with a compact mapping key or `---`, or a `yaml` / `yml` fence | `YamlBlock` |\r\n| CSV | consistent comma-separated rows with a compact header, or a `csv` fence; quoted commas and multiline cells supported | `CsvBlock` → `<table>` |\r\n| Code | fenced ` ``` ` with any language hint | `CodeBlock` |\r\n| Mermaid | fenced ` ```mermaid ` | `MermaidBlock` |\r\n| Math | `math` / `latex` fence or a standalone `$$…$$` block; `$…$` within prose uses Markdown | `MathBlock` / `MarkdownBlock` |\r\n| URL | bare `https://` or `http://` link | `UrlBlock` |\r\n| Plain text | everything else | `TextBlock` |\r\n\r\nDetection priority: **Fenced blocks / display math → JSON → HTML → XML → YAML → CSV → Markdown → URL → Text**\r\n\r\nFences accept backticks or tildes (three or more), up to three leading spaces, and optional metadata after the language hint. An unclosed fence is treated as a block extending to the end of the response. `md` / `markdown` and `text` / `txt` / `plaintext` hints choose their corresponding renderers.\r\n\r\nUnfenced detection is conservative: source code and Mermaid require fences, and YAML lists use Markdown list rendering unless fenced or preceded by a YAML document marker. Prose can share syntax with YAML or CSV; use a language fence when the intended format is ambiguous. Mixed responses should fence structured data; unfenced chunks are classified as a whole.\r\n\r\n---\r\n\r\n## Custom renderers\r\n\r\nOverride the component for any content type:\r\n\r\n```tsx\r\nimport { IntelliParser } from \"@aiapicore/react-intelliparser\";\r\n\r\n<IntelliParser\r\n  content={content}\r\n  renderers={{\r\n    json: ({ segment }) => (\r\n      <pre style={{ background: \"#0f172a\", color: \"#7dd3fc\", padding: \"1rem\" }}>\r\n        {JSON.stringify(JSON.parse(segment.content), null, 2)}\r\n      </pre>\r\n    ),\r\n    code: ({ segment }) => (\r\n      <div className=\"my-code-block\">\r\n        <span className=\"lang\">{segment.language}</span>\r\n        <pre><code>{segment.content}</code></pre>\r\n      </div>\r\n    ),\r\n  }}\r\n/>\r\n```\r\n\r\n---\r\n\r\n## Using `detectSegments` directly\r\n\r\n```ts\r\nimport { detectSegments, normalizeContent } from \"@aiapicore/react-intelliparser\";\r\n\r\nconst segments = detectSegments(normalizeContent(rawString));\r\n// [\r\n//   { type: \"markdown\", content: \"# Title\\n\\nHello.\" },\r\n//   { type: \"code\", language: \"tsx\", content: \"const x = 1;\" },\r\n//   { type: \"json\", content: '{\"key\":\"value\"}' },\r\n// ]\r\n```\r\n\r\n`normalizeContent` handles line-ending normalization and automatic deserialization of JSON-escaped strings. Valid JSON objects and arrays retain their internal escapes, and serialized strings are decoded once so literal backslashes in code remain intact.\r\n\r\n---\r\n\r\n## TypeScript types\r\n\r\n```ts\r\nimport type {\r\n  ContentSegment,\r\n  ContentSegmentType,\r\n  IntelliParserOptions,\r\n  IntelliParserProps,\r\n} from \"@aiapicore/react-intelliparser\";\r\n\r\n// ContentSegmentType:\r\n// \"text\" | \"markdown\" | \"html\" | \"xml\" | \"json\"\r\n// | \"yaml\" | \"csv\" | \"code\" | \"mermaid\" | \"math\" | \"url\"\r\n```\r\n\r\n---\r\n\r\n## Security\r\n\r\n- HTML is always sanitized before rendering — `<script>`, `<iframe>`, `on*` event attributes, and `javascript:` URLs are stripped.\r\n- The `sanitizeHtml` option additionally enables `rehype-sanitize` in the Markdown pipeline.\r\n- `dangerouslySetInnerHTML` is used only in `HtmlBlock`, after sanitization.\r\n- Mermaid runs with `securityLevel: \"strict\"` to prevent XSS in diagrams.\r\n\r\n---\r\n\r\n## Development\r\n\r\n```bash\r\n# Install dependencies\r\nnpm install\r\n\r\n# Start live playground (split-pane editor + live preview)\r\nnpm run dev\r\n\r\n# Run tests\r\nnpm test\r\n\r\n# Build for publishing (ESM + CJS + types)\r\nnpm run build\r\n\r\n# Verify detection and rendering through both built package entry points\r\nnode tests/packageSmoke.mjs\r\n```\r\n\r\n---\r\n\r\n## Publishing\r\n\r\n```bash\r\n# Log in to npm with org access\r\nnpm login\r\n\r\n# Build\r\nnpm run build\r\n\r\n# Publish scoped package publicly\r\nnpm publish --access public\r\n```\r\n\r\n---\r\n\r\n## License\r\n\r\n[MIT](./LICENSE) — © [mirmashhouri](https://github.com/mirmashhouri) / [aiapicore](https://github.com/aiapicore)\r\n","readmeFilename":"README.md"}