react-native-nitro-markdown 0.4.1 → 0.4.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 CHANGED
@@ -3,77 +3,68 @@
3
3
  <img src="./readme/stream-demo.gif" alt="react-native-nitro-markdown stream demo" width="300" />
4
4
  </p>
5
5
 
6
- # react-native-nitro-markdown 🚀
6
+ # react-native-nitro-markdown
7
7
 
8
- > The fastest Markdown parser for React Native. Period.
9
-
10
- [![npm version](https://img.shields.io/npm/v/react-native-nitro-markdown?style=flat-square)](https://www.npmjs.com/package/react-native-nitro-markdown)
11
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
12
- [![Nitro Modules](https://img.shields.io/badge/Powered%20by-Nitro%20Modules-blueviolet?style=flat-square)](https://nitro.margelo.com)
13
-
14
- **react-native-nitro-markdown** is a high-performance Markdown parser built on **[md4c](https://github.com/mity/md4c)** (C++) and **[Nitro Modules](https://nitro.margelo.com)**. It parses complex Markdown, GFM, and LaTeX Math into a structured AST **synchronously** via JSI, bypassing the React Native Bridge entirely.
8
+ Fast, native Markdown parsing and rendering for React Native. Built on md4c (C++) and Nitro Modules (JSI), it turns Markdown into a typed AST synchronously and renders it with a batteries-included React Native renderer.
15
9
 
16
10
  ---
17
11
 
18
- ## Why Nitro? (Benchmarks)
12
+ ## Why this package exists
19
13
 
20
- We benchmarked this library against the most popular JavaScript parsers on a real mobile device (iPhone 15 Pro, Release Mode) using a heavy **237KB** Markdown document.
14
+ JavaScript Markdown parsers do a lot of work on the JS thread and often trigger GC pauses on large documents. This package moves parsing to native C++ and uses JSI to return the AST without going through the RN bridge.
21
15
 
22
- | Parser | Time (ms) | Speedup | Frame Drops (60fps) |
23
- | :-------------------------- | :--------- | :---------------- | :-------------------- |
24
- | **🚀 Nitro Markdown (C++)** | **~29 ms** | **1x (Baseline)** | **~1 frame** (Smooth) |
25
- | 📋 CommonMark (JS) | ~82 ms | 2.8x slower | ~5 frames (Jank) |
26
- | 🏗️ Markdown-It (JS) | ~118 ms | 4.0x slower | ~7 frames (Jank) |
27
- | 💨 Marked (JS) | ~400 ms | 13.5x slower | ~24 frames (Freeze) |
16
+ **How it works:**
28
17
 
29
- > **Takeaway:** JavaScript parsers trigger Garbage Collection pauses. Nitro uses C++ to parse efficiently with zero-copy overhead, keeping your UI thread responsive.
18
+ Markdown string -> md4c C++ parser -> JSON AST -> React Native renderers
30
19
 
31
20
  ---
32
21
 
33
- ## 📦 Installation
22
+ ## Features
34
23
 
35
- Choose your preferred package manager to install the package and its core dependency (`react-native-nitro-modules`).
24
+ - Native C++ parser with JSI access (fast, synchronous parsing)
25
+ - Full renderer included (Markdown component)
26
+ - Headless API for custom renderers or processing
27
+ - GFM support (tables, strikethrough, task lists, autolinks)
28
+ - LaTeX math parsing (inline and block)
29
+ - Streaming support for token-by-token updates
30
+ - Theming and per-node style overrides
31
+ - Built-in renderers exposed for reuse
36
32
 
37
- ### **1. Install Dependencies**
33
+ ---
38
34
 
39
- **npm**
35
+ ## Requirements
40
36
 
41
- ```bash
42
- npm install react-native-nitro-markdown react-native-nitro-modules
43
- ```
37
+ - React Native >= 0.75
38
+ - react-native-nitro-modules
44
39
 
45
- > **Note:** If you want to use **Math** (LaTeX) or certain **Image** features, you should also install the optional peer dependencies:
46
- > `npm install react-native-svg react-native-mathjax-svg`
40
+ Optional (for math rendering):
47
41
 
48
- **Yarn**
42
+ - react-native-mathjax-svg
43
+ - react-native-svg
49
44
 
50
- ```bash
51
- yarn add react-native-nitro-markdown react-native-nitro-modules
52
- ```
45
+ ---
46
+
47
+ ## Installation
53
48
 
54
- **Bun**
49
+ Install the package and Nitro Modules:
55
50
 
56
51
  ```bash
57
52
  bun add react-native-nitro-markdown react-native-nitro-modules
58
53
  ```
59
54
 
60
- **pnpm**
55
+ Optional math dependencies:
61
56
 
62
57
  ```bash
63
- pnpm add react-native-nitro-markdown react-native-nitro-modules
58
+ bun add react-native-mathjax-svg react-native-svg
64
59
  ```
65
60
 
66
- ### **2. Install Native Pods (iOS)**
67
-
68
- **Standard**
61
+ iOS pods:
69
62
 
70
63
  ```bash
71
64
  cd ios && pod install
72
65
  ```
73
66
 
74
- ### **3. Expo Users**
75
-
76
- If you are using Expo, you must run a **Prebuild** (Development Build) because this package contains native C++ code.
67
+ Expo (requires a development build):
77
68
 
78
69
  ```bash
79
70
  bunx expo install react-native-nitro-markdown react-native-nitro-modules
@@ -82,11 +73,7 @@ bunx expo prebuild
82
73
 
83
74
  ---
84
75
 
85
- ## 💻 Usage
86
-
87
- ### Option 1: Batteries Included (Simplest)
88
-
89
- Use the `Markdown` component with clean, neutral styling that stays out of the way:
76
+ ## Quick Start
90
77
 
91
78
  ```tsx
92
79
  import { Markdown } from "react-native-nitro-markdown";
@@ -100,11 +87,52 @@ export function MyComponent() {
100
87
  }
101
88
  ```
102
89
 
103
- If you're rendering on a dark surface, override `theme.colors.text` (or use the `styles` prop) to match your app's palette.
90
+ ---
91
+
92
+ ## Feature Guide
93
+
94
+ Start here (pick the approach that matches your use case):
95
+
96
+ - `Markdown` for static or preloaded content
97
+ - `MarkdownStream` + `useMarkdownSession` for streaming tokens
98
+ - `headless` API for custom rendering or data processing
99
+
100
+ ### 1) Parsing options (GFM and Math)
101
+
102
+ Parsing options are passed using the `options` prop.
103
+
104
+ ```tsx
105
+ <Markdown options={{ gfm: true, math: true }}>{content}</Markdown>
106
+ ```
107
+
108
+ - `gfm` enables GitHub Flavored Markdown features supported by md4c.
109
+ - `math` enables `$...$` and `$$...$$` parsing into math nodes.
104
110
 
105
- ### Option 2: Style Overrides per Node Type
111
+ ### 2) Styling and themes
106
112
 
107
- Apply quick style overrides to specific node types without writing custom renderers:
113
+ You can override tokens using the `theme` prop. Only provide the tokens you want to change.
114
+
115
+ ```tsx
116
+ import { Markdown } from "react-native-nitro-markdown";
117
+
118
+ const theme = {
119
+ colors: {
120
+ text: "#0f172a",
121
+ heading: "#0f172a",
122
+ link: "#2563eb",
123
+ codeBackground: "#f1f5f9",
124
+ },
125
+ showCodeLanguage: true,
126
+ };
127
+
128
+ <Markdown theme={theme}>{content}</Markdown>;
129
+ ```
130
+
131
+ If you use a custom heading font on Android and do not load a bold variant, set `headingWeight: "normal"` to avoid font fallback.
132
+
133
+ ### 3) Per-node style overrides
134
+
135
+ Override the styles for specific node types with `styles`.
108
136
 
109
137
  ```tsx
110
138
  <Markdown
@@ -114,13 +142,13 @@ Apply quick style overrides to specific node types without writing custom render
114
142
  blockquote: { borderLeftColor: "#0ea5e9" },
115
143
  }}
116
144
  >
117
- {markdown}
145
+ {content}
118
146
  </Markdown>
119
147
  ```
120
148
 
121
- ### Option 3: Custom Renderers
149
+ ### 4) Custom renderers
122
150
 
123
- Override specific node types with full control. Custom renderers receive **pre-mapped props** for common values:
151
+ Provide a custom renderer for any node type. You get pre-mapped props for common values.
124
152
 
125
153
  ```tsx
126
154
  import {
@@ -131,142 +159,67 @@ import {
131
159
  } from "react-native-nitro-markdown";
132
160
 
133
161
  const renderers = {
134
- // Pre-mapped `level` prop - no need for node.level!
135
162
  heading: ({ level, children }: HeadingRendererProps) => (
136
163
  <MyHeading level={level}>{children}</MyHeading>
137
164
  ),
138
-
139
- // Pre-mapped `content` and `language` - no getTextContent() needed!
140
165
  code_block: ({ content, language }: CodeBlockRendererProps) => (
141
- <CodeBlock
142
- content={content}
143
- language={language}
144
- style={{ borderWidth: 2 }}
145
- />
166
+ <CodeBlock content={content} language={language} />
146
167
  ),
147
168
  };
148
169
 
149
- <Markdown renderers={renderers} options={{ gfm: true }}>
150
- {markdown}
151
- </Markdown>;
152
- ```
153
-
154
- **Pre-mapped Props by Node Type:**
155
-
156
- - `heading` → `level` (1-6)
157
- - `link` → `href`, `title`
158
- - `image` → `url`, `alt`, `title`
159
- - `code_block` → `content`, `language`
160
- - `code_inline` → `content`
161
- - `list` → `ordered`, `start`
162
- - `task_list_item` → `checked`
163
-
164
- ### Option 4: Token Overrides (Theme)
165
-
166
- Customize the look and feel by passing a partial `theme` object:
167
-
168
- ```tsx
169
- import { Markdown } from "react-native-nitro-markdown";
170
-
171
- const myTheme = {
172
- colors: {
173
- text: "#0f172a",
174
- heading: "#0f172a",
175
- link: "#0ea5e9",
176
- codeBackground: "#e2e8f0",
177
- },
178
- showCodeLanguage: false,
179
- };
180
-
181
- <Markdown theme={myTheme}>{"# Custom Themed Markdown"}</Markdown>;
170
+ <Markdown renderers={renderers}>{content}</Markdown>;
182
171
  ```
183
172
 
184
- Defaults live in `defaultMarkdownTheme` and are intentionally neutral so you can layer your own palette on top.
173
+ Custom renderer behavior:
185
174
 
186
- **Theme Properties:**
175
+ - Return `undefined` to fall back to the built-in renderer.
176
+ - Return `null` to render nothing for that node.
177
+ - The `Renderer` prop lets you render nested children the same way the default renderer does.
187
178
 
188
- - `colors` - All color tokens (text, heading, link, code, codeBackground, codeLanguage, etc.)
189
- - `spacing` - Spacing tokens (xs, s, m, l, xl)
190
- - `fontSizes` - Font sizes (xs, s, m, l, xl, h1-h6)
191
- - `fontFamilies` - Font families for regular, heading, and mono text
192
- - `headingWeight` - Optional weight for headings (useful for Android custom fonts)
193
- - `borderRadius` - Border radius tokens (s, m, l)
194
- - `showCodeLanguage` - Show/hide code block language labels
179
+ Pre-mapped props by node type:
195
180
 
196
- **Android custom fonts note:**
197
- If you use a custom heading font on Android and don’t load a bold variant, set
198
- `headingWeight: "normal"` (or use the `styles` prop) to avoid fallback to a
199
- system serif font.
181
+ | Node type | Extra props |
182
+ | --- | --- |
183
+ | `heading` | `level` |
184
+ | `link` | `href`, `title` |
185
+ | `image` | `url`, `alt`, `title` |
186
+ | `code_block` | `content`, `language` |
187
+ | `code_inline` | `content` |
188
+ | `list` | `ordered`, `start` |
189
+ | `task_list_item` | `checked` |
200
190
 
201
- ### Option 5: Minimal Styling Strategy
191
+ ### 5) Built-in renderers
202
192
 
203
- Start with a clean slate using the `stylingStrategy` prop:
204
-
205
- ```tsx
206
- <Markdown stylingStrategy="minimal" theme={myLightTheme}>
207
- {content}
208
- </Markdown>
209
- ```
210
-
211
- This zeros out all spacing and removes opinionated colors, letting you build up from scratch.
212
-
213
- ### Option 6: Style Props on Individual Renderers
214
-
215
- All built-in renderers accept a `style` prop for fine-grained overrides:
193
+ All built-in renderers are exported so you can reuse them in custom renderers.
216
194
 
217
195
  ```tsx
218
196
  import { Heading, CodeBlock, InlineCode } from "react-native-nitro-markdown";
219
-
220
- // Works in custom renderers
221
- <Heading level={1} style={{ color: "hotpink" }}>Title</Heading>
222
- <CodeBlock content={code} style={{ borderRadius: 0 }} />
223
- <InlineCode style={{ backgroundColor: "#ff0" }}>code</InlineCode>
224
- ```
225
-
226
- ### Option 7: Auto Content Extraction for Code
227
-
228
- The `CodeBlock` and `InlineCode` components now accept a `node` prop for automatic content extraction:
229
-
230
- ```tsx
231
- // Before: Manual extraction required
232
- code_block: ({ node }) => (
233
- <CodeBlock content={getTextContent(node)} language={node.language} />
234
- );
235
-
236
- // After: Just pass the node
237
- code_block: ({ node }) => <CodeBlock node={node} />;
238
-
239
- // Or use the pre-mapped content prop (recommended)
240
- code_block: ({ content, language }) => (
241
- <CodeBlock content={content} language={language} />
242
- );
243
197
  ```
244
198
 
245
- ### Option 8: Headless (Minimal Bundle)
246
-
247
- For maximum control, data processing, or minimal JS overhead:
248
-
249
- ```tsx
250
- import {
251
- parseMarkdown,
252
- getTextContent,
253
- getFlattenedText,
254
- } from "react-native-nitro-markdown/headless";
199
+ Available renderers:
255
200
 
256
- const ast = parseMarkdown("# Hello World");
257
- const text = getTextContent(ast); // "Hello World"
258
- const fullText = getFlattenedText(ast); // "Hello World\n\n" (Normalized with line breaks)
259
- ```
201
+ - `Heading`
202
+ - `Paragraph`
203
+ - `Link`
204
+ - `Blockquote`
205
+ - `HorizontalRule`
206
+ - `CodeBlock`
207
+ - `InlineCode`
208
+ - `List`
209
+ - `ListItem`
210
+ - `TaskListItem`
211
+ - `TableRenderer`
212
+ - `Image`
213
+ - `MathInline`
214
+ - `MathBlock`
260
215
 
261
- ### Option 9: High-Performance Streaming (LLMs)
216
+ ### 6) Streaming (LLM tokens)
262
217
 
263
- When streaming text token-by-token (e.g., from ChatGPT or Gemini), you should batch UI updates to avoid re-rendering on every token:
218
+ Use `MarkdownStream` plus `useMarkdownSession` to stream updates efficiently.
264
219
 
265
220
  ```tsx
266
- import {
267
- MarkdownStream,
268
- useMarkdownSession,
269
- } from "react-native-nitro-markdown";
221
+ import { useEffect } from "react";
222
+ import { MarkdownStream, useMarkdownSession } from "react-native-nitro-markdown";
270
223
 
271
224
  export function AIResponseStream() {
272
225
  const session = useMarkdownSession();
@@ -280,7 +233,6 @@ export function AIResponseStream() {
280
233
  <MarkdownStream
281
234
  session={session.getSession()}
282
235
  options={{ gfm: true }}
283
- updateIntervalMs={60}
284
236
  updateStrategy="raf"
285
237
  useTransitionUpdates
286
238
  />
@@ -288,183 +240,280 @@ export function AIResponseStream() {
288
240
  }
289
241
  ```
290
242
 
291
- **Recommended defaults for token streaming:**
292
- - `updateStrategy="raf"` for smooth, frame-aligned updates
293
- - `updateIntervalMs={50–100}` when using `updateStrategy="interval"`
294
- - Avoid per-token UI updates by batching token appends
243
+ Recommended streaming defaults:
295
244
 
296
- **Streaming props:**
245
+ - `updateStrategy="raf"` for frame-aligned updates
246
+ - `updateIntervalMs` between `50` and `100` when using interval strategy
247
+ - Avoid per-token UI updates by batching appends
297
248
 
298
- | Prop | Type | Default | Description |
299
- | :-- | :-- | :-- | :-- |
300
- | `updateIntervalMs` | `number` | `50` | Throttle UI updates when using interval strategy |
301
- | `updateStrategy` | `"interval" \| "raf"` | `"interval"` | Interval batching or frame-aligned updates |
302
- | `useTransitionUpdates` | `boolean` | `false` | Use React transitions to keep input responsive |
249
+ ### 7) Headless parsing
303
250
 
304
- ### Option 10: Extracting Plain Text
251
+ Use the headless entry when you only need the AST or want to build your own renderer.
305
252
 
306
- You can extract the plain text representation (with proper line breaks) using the `onParseComplete` callback. This is useful for "Copy All" buttons or TTS.
253
+ ```tsx
254
+ import {
255
+ parseMarkdown,
256
+ parseMarkdownWithOptions,
257
+ getTextContent,
258
+ getFlattenedText,
259
+ } from "react-native-nitro-markdown/headless";
260
+
261
+ const ast = parseMarkdown("# Hello World");
262
+ const text = getTextContent(ast);
263
+ const normalized = getFlattenedText(ast);
264
+ ```
265
+
266
+ ### 8) Plain text extraction
267
+
268
+ If you are already using the `Markdown` component, you can get the plain text during parse.
307
269
 
308
270
  ```tsx
309
271
  <Markdown
310
272
  onParseComplete={(result) => {
311
- console.log(result.text); // "Hello World\n\nThis is bold text."
312
- console.log(result.ast); // Full AST
273
+ console.log(result.text);
313
274
  }}
314
275
  >
315
- {markdown}
276
+ {content}
316
277
  </Markdown>
317
278
  ```
318
279
 
280
+ ### 9) Tables, images, and math
281
+
282
+ - Tables are rendered with a horizontal scroll view and measured column widths.
283
+ - Images use React Native `Image` and try to preserve the real aspect ratio.
284
+ - Math nodes render with `react-native-mathjax-svg` if installed; otherwise they fall back to a code-style look.
285
+
319
286
  ---
320
287
 
321
- ## 🎨 Using Context in Custom Renderers
288
+ ## Common Recipes
322
289
 
323
- Access theme and context in custom renderers:
290
+ ### Open links with custom behavior
324
291
 
325
292
  ```tsx
326
- import {
327
- useMarkdownContext,
328
- MarkdownContext,
329
- } from "react-native-nitro-markdown";
330
-
331
- const MyCustomRenderer = ({ children }) => {
332
- const { theme, stylingStrategy } = useMarkdownContext();
293
+ import { Markdown, type LinkRendererProps } from "react-native-nitro-markdown";
294
+ import { Text, Linking } from "react-native";
333
295
 
334
- return <View style={{ padding: theme.spacing.m }}>{children}</View>;
296
+ const renderers = {
297
+ link: ({ href, children }: LinkRendererProps) => (
298
+ <Text
299
+ style={{ textDecorationLine: "underline" }}
300
+ onPress={async () => {
301
+ if (href && (await Linking.canOpenURL(href))) {
302
+ Linking.openURL(href);
303
+ }
304
+ }}
305
+ >
306
+ {children}
307
+ </Text>
308
+ ),
335
309
  };
336
- ```
337
310
 
338
- ---
311
+ <Markdown renderers={renderers}>{content}</Markdown>;
312
+ ```
339
313
 
340
- ## 🛠️ Exported Utilities
314
+ ### Custom image renderer (placeholder + fixed height)
341
315
 
342
316
  ```tsx
343
- // Parser and utilities
344
- export {
345
- parseMarkdown,
346
- parseMarkdownWithOptions,
347
- getTextContent,
348
- getFlattenedText,
349
- } from "./headless";
317
+ import { Markdown, type ImageRendererProps } from "react-native-nitro-markdown";
318
+ import { View, Image, Text } from "react-native";
350
319
 
351
- // Theme tokens
352
- export {
353
- defaultMarkdownTheme,
354
- minimalMarkdownTheme,
355
- mergeThemes,
320
+ const renderers = {
321
+ image: ({ url, title, alt }: ImageRendererProps) => (
322
+ <View>
323
+ <Image source={{ uri: url }} style={{ height: 220, borderRadius: 12 }} />
324
+ {(title || alt) && (
325
+ <Text style={{ marginTop: 6, opacity: 0.6 }}>{title || alt}</Text>
326
+ )}
327
+ </View>
328
+ ),
356
329
  };
330
+ ```
357
331
 
358
- // Context
359
- export { useMarkdownContext, MarkdownContext };
332
+ ### Render HTML nodes as code (opt-in)
360
333
 
361
- // Individual renderers
362
- export {
363
- Heading,
364
- Paragraph,
365
- Link,
366
- Blockquote,
367
- HorizontalRule,
368
- CodeBlock,
369
- InlineCode,
370
- List,
371
- ListItem,
372
- TaskListItem,
373
- TableRenderer,
374
- Image,
375
- MathInline,
376
- MathBlock,
334
+ ```tsx
335
+ import { Markdown, CodeBlock, InlineCode } from "react-native-nitro-markdown";
336
+
337
+ const renderers = {
338
+ html_block: ({ node }) => <CodeBlock content={node.content ?? \"\"} />,
339
+ html_inline: ({ node }) => <InlineCode content={node.content ?? \"\"} />,
377
340
  };
378
341
  ```
379
342
 
380
- ---
343
+ ### Minimal styling + custom palette
381
344
 
382
- ## 🛠️ Headless vs. Non-Headless
345
+ ```tsx
346
+ import { Markdown } from "react-native-nitro-markdown";
383
347
 
384
- | Feature | **Headless** (`/headless`) | **Non-Headless** (`default`) |
385
- | :-------------- | :-------------------------- | :--------------------------------- |
386
- | **Logic** | Raw C++ md4c Parser | Parser + Full UI Renderer |
387
- | **Output** | JSON AST Tree | React Native Views |
388
- | **Best For** | Search Indexing, Custom UIs | Fast Implementation, Documentation |
389
- | **JS Overhead** | ~4 KB | ~60 KB |
348
+ <Markdown
349
+ stylingStrategy="minimal"
350
+ theme={{ colors: { text: "#e2e8f0", link: "#38bdf8" } }}
351
+ >
352
+ {content}
353
+ </Markdown>;
354
+ ```
355
+
356
+ ### Build a search index (headless)
357
+
358
+ ```tsx
359
+ import { parseMarkdown, getFlattenedText } from "react-native-nitro-markdown/headless";
360
+
361
+ const ast = parseMarkdown(content);
362
+ const plainText = getFlattenedText(ast);
363
+ ```
390
364
 
391
365
  ---
392
366
 
393
- ### Basic Parsing API
367
+ ## API Reference
394
368
 
395
- The parsing is synchronous and instant. It returns a fully typed JSON AST:
369
+ ### Markdown component
396
370
 
397
- ```typescript
398
- import { parseMarkdown } from "react-native-nitro-markdown/headless";
371
+ ```tsx
372
+ import { Markdown } from "react-native-nitro-markdown";
373
+ ```
399
374
 
400
- const ast = parseMarkdown(`
401
- # Hello World
402
- This is **bold** text and a [link](https://github.com).
403
- `);
375
+ Props:
376
+
377
+ | Prop | Type | Default | Description |
378
+ | --- | --- | --- | --- |
379
+ | `children` | `string` | required | Markdown string to parse and render |
380
+ | `options` | `{ gfm?: boolean; math?: boolean }` | `undefined` | Parser options |
381
+ | `renderers` | `CustomRenderers` | `{}` | Custom renderers by node type |
382
+ | `theme` | `PartialMarkdownTheme` | `defaultMarkdownTheme` | Theme token overrides |
383
+ | `styles` | `NodeStyleOverrides` | `undefined` | Per-node style overrides |
384
+ | `stylingStrategy` | `"opinionated" \| "minimal"` | `"opinionated"` | Styling baseline |
385
+ | `style` | `StyleProp<ViewStyle>` | `undefined` | Container style |
386
+ | `onParsingInProgress` | `() => void` | `undefined` | Called when parsing starts |
387
+ | `onParseComplete` | `(result) => void` | `undefined` | Called with `{ raw, ast, text }` |
388
+
389
+ ### MarkdownStream
390
+
391
+ ```tsx
392
+ import { MarkdownStream } from "react-native-nitro-markdown";
393
+ ```
394
+
395
+ Props (in addition to all `Markdown` props except `children`):
396
+
397
+ | Prop | Type | Default | Description |
398
+ | --- | --- | --- | --- |
399
+ | `session` | `MarkdownSession` | required | Active session for streaming text |
400
+ | `updateIntervalMs` | `number` | `50` | Throttle interval for updates |
401
+ | `updateStrategy` | `"interval" \| "raf"` | `"interval"` | Update strategy |
402
+ | `useTransitionUpdates` | `boolean` | `false` | Use React transitions |
403
+
404
+ ### Hooks and sessions
405
+
406
+ ```tsx
407
+ import { useMarkdownSession, createMarkdownSession, useStream } from "react-native-nitro-markdown";
404
408
  ```
405
409
 
406
- ### Options
410
+ - `useMarkdownSession()` returns a managed session and helpers: `getSession`, `setIsStreaming`, `stop`, `clear`, `setHighlight`.
411
+ - `createMarkdownSession()` creates a session without React hooks.
412
+ - `useStream(timestamps)` adds a simple sync helper for time-based streaming.
407
413
 
408
- | Option | Type | Default | Description |
409
- | :----- | :-------- | :------ | :----------------------------------------------------------------------------- |
410
- | `gfm` | `boolean` | `false` | Enable GitHub Flavored Markdown (Tables, Strikethrough, Autolinks, TaskLists). |
411
- | `math` | `boolean` | `false` | Enable LaTeX Math support (`$` and `$$`). |
414
+ ### Headless API
415
+
416
+ ```tsx
417
+ import { parseMarkdown, parseMarkdownWithOptions, getTextContent, getFlattenedText } from "react-native-nitro-markdown/headless";
418
+ ```
419
+
420
+ ### Theme utilities
421
+
422
+ ```tsx
423
+ import {
424
+ defaultMarkdownTheme,
425
+ minimalMarkdownTheme,
426
+ mergeThemes,
427
+ } from "react-native-nitro-markdown";
428
+ ```
429
+
430
+ ### Types
431
+
432
+ ```tsx
433
+ import type {
434
+ CustomRenderers,
435
+ NodeStyleOverrides,
436
+ MarkdownTheme,
437
+ PartialMarkdownTheme,
438
+ } from "react-native-nitro-markdown";
439
+ ```
412
440
 
413
441
  ---
414
442
 
415
- ## 📐 AST Structure
443
+ ## Supported Node Types
416
444
 
417
- The parser returns a `MarkdownNode` tree:
445
+ You can customize any of these node types with `renderers` or `styles`.
418
446
 
419
- ```typescript
447
+ `document`, `heading`, `paragraph`, `text`, `bold`, `italic`, `strikethrough`, `link`, `image`, `code_inline`, `code_block`, `blockquote`, `horizontal_rule`, `line_break`, `soft_break`, `table`, `table_head`, `table_body`, `table_row`, `table_cell`, `list`, `list_item`, `task_list_item`, `math_inline`, `math_block`, `html_block`, `html_inline`
448
+
449
+ Note: `html_inline` and `html_block` are parsed but not rendered by default.
450
+
451
+ ---
452
+
453
+ ## AST Shape
454
+
455
+ The headless API returns a typed AST. This is the core shape used by the renderer.
456
+
457
+ ```ts
420
458
  export interface MarkdownNode {
421
- type: NodeType;
459
+ type:
460
+ | "document"
461
+ | "heading"
462
+ | "paragraph"
463
+ | "text"
464
+ | "bold"
465
+ | "italic"
466
+ | "strikethrough"
467
+ | "link"
468
+ | "image"
469
+ | "code_inline"
470
+ | "code_block"
471
+ | "blockquote"
472
+ | "horizontal_rule"
473
+ | "line_break"
474
+ | "soft_break"
475
+ | "table"
476
+ | "table_head"
477
+ | "table_body"
478
+ | "table_row"
479
+ | "table_cell"
480
+ | "list"
481
+ | "list_item"
482
+ | "task_list_item"
483
+ | "math_inline"
484
+ | "math_block"
485
+ | "html_block"
486
+ | "html_inline";
422
487
  content?: string;
423
488
  children?: MarkdownNode[];
424
489
  level?: number;
425
490
  href?: string;
426
- checked?: boolean;
491
+ title?: string;
492
+ alt?: string;
427
493
  language?: string;
428
- align?: "left" | "center" | "right";
494
+ ordered?: boolean;
495
+ start?: number;
496
+ checked?: boolean;
497
+ align?: string;
429
498
  isHeader?: boolean;
430
499
  }
431
500
  ```
432
501
 
433
502
  ---
434
503
 
435
- ## 🧮 LaTeX Math Support
504
+ ## Troubleshooting
436
505
 
437
- We parse math delimiters (`$` and `$$`) natively using the `MD_FLAG_LATEXMATHSPANS` flag in `md4c`.
438
-
439
- To render the math, use a library like `react-native-mathjax-svg`:
440
-
441
- ```tsx
442
- case 'math_inline':
443
- return <MathView math={node.content} style={styles.math} />;
444
- case 'math_block':
445
- return <MathView math={node.content} style={styles.mathBlock} />;
446
- ```
506
+ - Math renders as plain text: install `react-native-mathjax-svg` and `react-native-svg`.
507
+ - iOS build errors: run `pod install` after installing dependencies.
508
+ - Expo: you must use a development build (`expo prebuild` + `expo run`), not Expo Go.
509
+ - Android heading font looks wrong: set `headingWeight: "normal"` when your font has no bold variant.
447
510
 
448
511
  ---
449
512
 
450
- ## 📊 Package Size
451
-
452
- | Metric | Size |
453
- | :------------------- | :------ |
454
- | **Packed (tarball)** | ~75 kB |
455
- | **Unpacked** | ~325 kB |
456
- | **Total files** | 55 |
513
+ ## Contributing
457
514
 
458
- ---
515
+ See `CONTRIBUTING.md` for the workflow and development commands.
459
516
 
460
- ## 🤝 Contributing
461
-
462
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
463
-
464
- ## 📄 License
517
+ ## License
465
518
 
466
519
  MIT
467
-
468
- ---
469
-
470
- Built with ❤️ using [Nitro Modules](https://nitro.margelo.com) and [md4c](https://github.com/mity/md4c).
@@ -142,7 +142,9 @@ const TableRenderer = ({
142
142
  style: styles.tableScroll,
143
143
  bounces: false,
144
144
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
145
- style: styles.table,
145
+ style: [styles.table, {
146
+ backgroundColor: style?.backgroundColor ?? theme.colors.surface ?? "#111827"
147
+ }],
146
148
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
147
149
  style: styles.headerRow,
148
150
  children: headers.map((cell, colIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -158,7 +160,7 @@ const TableRenderer = ({
158
160
  })
159
161
  }, `header-${colIndex}`))
160
162
  }), rows.map((row, rowIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
161
- style: [styles.bodyRow, rowIndex === rows.length - 1 && styles.lastRow, rowIndex % 2 === 1 && styles.oddRow],
163
+ style: [styles.bodyRow, rowIndex === rows.length - 1 && styles.lastRow, rowIndex % 2 === 0 ? styles.evenRow : styles.oddRow],
162
164
  children: row.map((cell, colIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
163
165
  style: [styles.bodyCell, {
164
166
  width: columnWidths[colIndex],
@@ -228,8 +230,7 @@ const createTableStyles = theme => {
228
230
  borderRadius: borderRadius.m,
229
231
  overflow: "hidden",
230
232
  borderWidth: 1,
231
- borderColor: colors.tableBorder || "#374151",
232
- backgroundColor: colors.surface || "#111827"
233
+ borderColor: colors.tableBorder || "#374151"
233
234
  },
234
235
  headerRow: {
235
236
  flexDirection: "row",
@@ -242,6 +243,9 @@ const createTableStyles = theme => {
242
243
  borderBottomWidth: 1,
243
244
  borderBottomColor: colors.tableBorder || "#374151"
244
245
  },
246
+ evenRow: {
247
+ backgroundColor: colors.tableRowEven || "transparent"
248
+ },
245
249
  oddRow: {
246
250
  backgroundColor: colors.tableRowOdd || "rgba(255,255,255,0.02)"
247
251
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_MarkdownContext","_jsxRuntime","extractTableData","node","headers","rows","alignments","child","children","type","row","cell","push","align","rowCells","columnWidthsReducer","state","action","payload","TableRenderer","Renderer","style","theme","useMarkdownContext","useMemo","columnCount","length","styles","createTableStyles","columnWidths","dispatch","useReducer","measuredWidths","useRef","Map","measuredCells","Set","widthsCalculated","onCellLayout","useCallback","cellKey","width","current","set","add","expectedCells","col","allCellsMeasured","every","key","has","maxWidths","Array","fill","headerWidth","get","Math","max","cellWidth","getAlignment","index","hasWidths","jsxs","View","container","measurementContainer","jsx","measurementRow","map","colIndex","measurementCell","onLayout","e","nativeEvent","layout","CellContent","rowIndex","ScrollView","horizontal","showsHorizontalScrollIndicator","tableScroll","bounces","table","headerRow","headerCell","alignItems","lastCell","textStyle","headerText","bodyRow","lastRow","oddRow","bodyCell","cellText","exports","Text","content","cellContentWrapper","idx","depth","inListItem","parentIsText","colors","borderRadius","m","StyleSheet","create","marginVertical","spacing","s","position","opacity","pointerEvents","left","flexDirection","paddingVertical","paddingHorizontal","flexGrow","overflow","borderWidth","borderColor","tableBorder","backgroundColor","surface","tableHeader","borderBottomWidth","borderBottomColor","tableRowOdd","flexShrink","minWidth","borderRightWidth","borderRightColor","justifyContent","color","tableHeaderText","fontSize","fontWeight","fontFamily","fontFamilies","regular","Platform","OS","includeFontPadding","text","lineHeight","flexWrap"],"sourceRoot":"../../../src","sources":["renderers/table.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AAaA,IAAAE,gBAAA,GAAAF,OAAA;AAAgF,IAAAG,WAAA,GAAAH,OAAA;AAShF,MAAMI,gBAAgB,GAAIC,IAAkB,IAAgB;EAC1D,MAAMC,OAAuB,GAAG,EAAE;EAClC,MAAMC,IAAsB,GAAG,EAAE;EACjC,MAAMC,UAAkC,GAAG,EAAE;EAE7C,KAAK,MAAMC,KAAK,IAAIJ,IAAI,CAACK,QAAQ,IAAI,EAAE,EAAE;IACvC,IAAID,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MAC/B,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAAIE,GAAG,CAACD,IAAI,KAAK,WAAW,EAAE;UAC5B,KAAK,MAAME,IAAI,IAAID,GAAG,CAACF,QAAQ,IAAI,EAAE,EAAE;YACrCJ,OAAO,CAACQ,IAAI,CAACD,IAAI,CAAC;YAClBL,UAAU,CAACM,IAAI,CAACD,IAAI,CAACE,KAAK,CAAC;UAC7B;QACF;MACF;IACF,CAAC,MAAM,IAAIN,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MACtC,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAAIE,GAAG,CAACD,IAAI,KAAK,WAAW,EAAE;UAC5B,MAAMK,QAAwB,GAAG,EAAE;U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AAI,SAAS;MACjDW,cAAc,EAAE;IAClB,CAAC;IACD9C,QAAQ,EAAE;MACR4C,gBAAgB,EAAE;IACpB,CAAC;IACD1C,UAAU,EAAE;MACV6C,KAAK,EAAE/B,MAAM,CAACgC,eAAe,IAAI,SAAS;MAC1CC,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE,KAAK;MACjBC,UAAU,EAAEnH,KAAK,CAACoH,YAAY,EAAEC,OAAO;MACvC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACDjD,QAAQ,EAAE;MACRwC,KAAK,EAAE/B,MAAM,CAACyC,IAAI,IAAI,SAAS;MAC/BR,QAAQ,EAAE,EAAE;MACZS,UAAU,EAAE,EAAE;MACdP,UAAU,EAAEnH,KAAK,CAACoH,YAAY,EAAEC,OAAO;MACvC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACD7C,kBAAkB,EAAE;MAClBiB,aAAa,EAAE,KAAK;MACpB+B,QAAQ,EAAE,MAAM;MAChB5D,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_MarkdownContext","_jsxRuntime","extractTableData","node","headers","rows","alignments","child","children","type","row","cell","push","align","rowCells","columnWidthsReducer","state","action","payload","TableRenderer","Renderer","style","theme","useMarkdownContext","useMemo","columnCount","length","styles","createTableStyles","columnWidths","dispatch","useReducer","measuredWidths","useRef","Map","measuredCells","Set","widthsCalculated","onCellLayout","useCallback","cellKey","width","current","set","add","expectedCells","col","allCellsMeasured","every","key","has","maxWidths","Array","fill","headerWidth","get","Math","max","cellWidth","getAlignment","index","hasWidths","jsxs","View","container","measurementContainer","jsx","measurementRow","map","colIndex","measurementCell","onLayout","e","nativeEvent","layout","CellContent","rowIndex","ScrollView","horizontal","showsHorizontalScrollIndicator","tableScroll","bounces","table","backgroundColor","colors","surface","headerRow","headerCell","alignItems","lastCell","textStyle","headerText","bodyRow","lastRow","evenRow","oddRow","bodyCell","cellText","exports","Text","content","cellContentWrapper","idx","depth","inListItem","parentIsText","borderRadius","m","StyleSheet","create","marginVertical","spacing","s","position","opacity","pointerEvents","left","flexDirection","paddingVertical","paddingHorizontal","flexGrow","overflow","borderWidth","borderColor","tableBorder","tableHeader","borderBottomWidth","borderBottomColor","tableRowEven","tableRowOdd","flexShrink","minWidth","borderRightWidth","borderRightColor","justifyContent","color","tableHeaderText","fontSize","fontWeight","fontFamily","fontFamilies","regular","Platform","OS","includeFontPadding","text","lineHeight","flexWrap"],"sourceRoot":"../../../src","sources":["renderers/table.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AAaA,IAAAE,gBAAA,GAAAF,OAAA;AAAgF,IAAAG,WAAA,GAAAH,OAAA;AAShF,MAAMI,gBAAgB,GAAIC,IAAkB,IAAgB;EAC1D,MAAMC,OAAuB,GAAG,EAAE;EAClC,MAAMC,IAAsB,GAAG,EAAE;EACjC,MAAMC,UAAkC,GAAG,EAAE;EAE7C,KAAK,MAAMC,KAAK,IAAIJ,IAAI,CAACK,QAAQ,IAAI,EAAE,EAAE;IACvC,IAAID,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MAC/B,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAAIE,GAAG,CAACD,IAAI,KAAK,WAAW,EAAE;UAC5B,KAAK,MAAME,IAAI,IAAID,GAAG,CAACF,QAAQ,IAAI,EAAE,EAAE;YACrCJ,OAAO,CAACQ,IAAI,CAACD,IAAI,CAAC;YAClBL,UAAU,CAACM,IAAI,CAACD,IAAI,CAACE,KAAK,CAAC;UAC7B;QACF;MACF;IACF,CAAC,MAAM,IAAIN,KAAK,CAACE,IAAI,KAAK,YA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ACnBC,iBAAiB,EAAE,EAAE;MACrBY,QAAQ,EAAE,EAAE;MACZC,gBAAgB,EAAE,CAAC;MACnBC,gBAAgB,EAAEjD,MAAM,CAACwC,WAAW,IAAI;IAC1C,CAAC;IACD5B,QAAQ,EAAE;MACRkC,UAAU,EAAE,CAAC;MACbZ,eAAe,EAAE,EAAE;MACnBC,iBAAiB,EAAE,EAAE;MACrBY,QAAQ,EAAE,EAAE;MACZC,gBAAgB,EAAE,CAAC;MACnBC,gBAAgB,EAAEjD,MAAM,CAACwC,WAAW,IAAI,SAAS;MACjDU,cAAc,EAAE;IAClB,CAAC;IACD7C,QAAQ,EAAE;MACR2C,gBAAgB,EAAE;IACpB,CAAC;IACDzC,UAAU,EAAE;MACV4C,KAAK,EAAEnD,MAAM,CAACoD,eAAe,IAAI,SAAS;MAC1CC,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE,KAAK;MACjBC,UAAU,EAAErH,KAAK,CAACsH,YAAY,EAAEC,OAAO;MACvC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACD/C,QAAQ,EAAE;MACRsC,KAAK,EAAEnD,MAAM,CAAC6D,IAAI,IAAI,SAAS;MAC/BR,QAAQ,EAAE,EAAE;MACZS,UAAU,EAAE,EAAE;MACdP,UAAU,EAAErH,KAAK,CAACsH,YAAY,EAAEC,OAAO;MACvC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACD3C,kBAAkB,EAAE;MAClBgB,aAAa,EAAE,KAAK;MACpB8B,QAAQ,EAAE,MAAM;MAChB3D,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -138,7 +138,9 @@ export const TableRenderer = ({
138
138
  style: styles.tableScroll,
139
139
  bounces: false,
140
140
  children: /*#__PURE__*/_jsxs(View, {
141
- style: styles.table,
141
+ style: [styles.table, {
142
+ backgroundColor: style?.backgroundColor ?? theme.colors.surface ?? "#111827"
143
+ }],
142
144
  children: [/*#__PURE__*/_jsx(View, {
143
145
  style: styles.headerRow,
144
146
  children: headers.map((cell, colIndex) => /*#__PURE__*/_jsx(View, {
@@ -154,7 +156,7 @@ export const TableRenderer = ({
154
156
  })
155
157
  }, `header-${colIndex}`))
156
158
  }), rows.map((row, rowIndex) => /*#__PURE__*/_jsx(View, {
157
- style: [styles.bodyRow, rowIndex === rows.length - 1 && styles.lastRow, rowIndex % 2 === 1 && styles.oddRow],
159
+ style: [styles.bodyRow, rowIndex === rows.length - 1 && styles.lastRow, rowIndex % 2 === 0 ? styles.evenRow : styles.oddRow],
158
160
  children: row.map((cell, colIndex) => /*#__PURE__*/_jsx(View, {
159
161
  style: [styles.bodyCell, {
160
162
  width: columnWidths[colIndex],
@@ -223,8 +225,7 @@ const createTableStyles = theme => {
223
225
  borderRadius: borderRadius.m,
224
226
  overflow: "hidden",
225
227
  borderWidth: 1,
226
- borderColor: colors.tableBorder || "#374151",
227
- backgroundColor: colors.surface || "#111827"
228
+ borderColor: colors.tableBorder || "#374151"
228
229
  },
229
230
  headerRow: {
230
231
  flexDirection: "row",
@@ -237,6 +238,9 @@ const createTableStyles = theme => {
237
238
  borderBottomWidth: 1,
238
239
  borderBottomColor: colors.tableBorder || "#374151"
239
240
  },
241
+ evenRow: {
242
+ backgroundColor: colors.tableRowEven || "transparent"
243
+ },
240
244
  oddRow: {
241
245
  backgroundColor: colors.tableRowOdd || "rgba(255,255,255,0.02)"
242
246
  },
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useRef","useReducer","useCallback","View","Text","StyleSheet","ScrollView","Platform","useMarkdownContext","jsx","_jsx","jsxs","_jsxs","extractTableData","node","headers","rows","alignments","child","children","type","row","cell","push","align","rowCells","columnWidthsReducer","state","action","payload","TableRenderer","Renderer","style","theme","columnCount","length","styles","createTableStyles","columnWidths","dispatch","measuredWidths","Map","measuredCells","Set","widthsCalculated","onCellLayout","cellKey","width","current","set","add","expectedCells","col","allCellsMeasured","every","key","has","maxWidths","Array","fill","headerWidth","get","Math","max","cellWidth","getAlignment","index","hasWidths","container","measurementContainer","measurementRow","map","colIndex","measurementCell","onLayout","e","nativeEvent","layout","CellContent","rowIndex","horizontal","showsHorizontalScrollIndicator","tableScroll","bounces","table","headerRow","headerCell","alignItems","lastCell","textStyle","headerText","bodyRow","lastRow","oddRow","bodyCell","cellText","content","cellContentWrapper","idx","depth","inListItem","parentIsText","colors","borderRadius","m","create","marginVertical","spacing","s","position","opacity","pointerEvents","left","flexDirection","paddingVertical","paddingHorizontal","flexGrow","overflow","borderWidth","borderColor","tableBorder","backgroundColor","surface","tableHeader","borderBottomWidth","borderBottomColor","tableRowOdd","flexShrink","minWidth","borderRightWidth","borderRightColor","justifyContent","color","tableHeaderText","fontSize","fontWeight","fontFamily","fontFamilies","regular","OS","includeFontPadding","text","lineHeight","flexWrap"],"sourceRoot":"../../../src","sources":["renderers/table.tsx"],"mappings":";;AAAA,SACEA,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,WAAW,QAIN,OAAO;AACd,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,UAAU,EACVC,QAAQ,QAKH,cAAc;AAGrB,SAASC,kBAAkB,QAAgC,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAShF,MAAMC,gBAAgB,GAAIC,IAAkB,IAAgB;EAC1D,MAAMC,OAAuB,GAAG,EAAE;EAClC,MAAMC,IAAsB,GAAG,EAAE;EACjC,MAAMC,UAAkC,GAAG,EAAE;EAE7C,KAAK,MAAMC,KAAK,IAAIJ,IAAI,CAACK,QAAQ,IAAI,EAAE,EAAE;IACvC,IAAID,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MAC/B,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAA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AACwG,YAAY,EAAEC,OAAO;MACvC,IAAInI,QAAQ,CAACoI,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACD7C,QAAQ,EAAE;MACRqC,KAAK,EAAE9B,MAAM,CAACuC,IAAI,IAAI,SAAS;MAC/BP,QAAQ,EAAE,EAAE;MACZQ,UAAU,EAAE,EAAE;MACdN,UAAU,EAAEvG,KAAK,CAACwG,YAAY,EAAEC,OAAO;MACvC,IAAInI,QAAQ,CAACoI,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACD3C,kBAAkB,EAAE;MAClBgB,aAAa,EAAE,KAAK;MACpB8B,QAAQ,EAAE,MAAM;MAChBxD,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useRef","useReducer","useCallback","View","Text","StyleSheet","ScrollView","Platform","useMarkdownContext","jsx","_jsx","jsxs","_jsxs","extractTableData","node","headers","rows","alignments","child","children","type","row","cell","push","align","rowCells","columnWidthsReducer","state","action","payload","TableRenderer","Renderer","style","theme","columnCount","length","styles","createTableStyles","columnWidths","dispatch","measuredWidths","Map","measuredCells","Set","widthsCalculated","onCellLayout","cellKey","width","current","set","add","expectedCells","col","allCellsMeasured","every","key","has","maxWidths","Array","fill","headerWidth","get","Math","max","cellWidth","getAlignment","index","hasWidths","container","measurementContainer","measurementRow","map","colIndex","measurementCell","onLayout","e","nativeEvent","layout","CellContent","rowIndex","horizontal","showsHorizontalScrollIndicator","tableScroll","bounces","table","backgroundColor","colors","surface","headerRow","headerCell","alignItems","lastCell","textStyle","headerText","bodyRow","lastRow","evenRow","oddRow","bodyCell","cellText","content","cellContentWrapper","idx","depth","inListItem","parentIsText","borderRadius","m","create","marginVertical","spacing","s","position","opacity","pointerEvents","left","flexDirection","paddingVertical","paddingHorizontal","flexGrow","overflow","borderWidth","borderColor","tableBorder","tableHeader","borderBottomWidth","borderBottomColor","tableRowEven","tableRowOdd","flexShrink","minWidth","borderRightWidth","borderRightColor","justifyContent","color","tableHeaderText","fontSize","fontWeight","fontFamily","fontFamilies","regular","OS","includeFontPadding","text","lineHeight","flexWrap"],"sourceRoot":"../../../src","sources":["renderers/table.tsx"],"mappings":";;AAAA,SACEA,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,WAAW,QAIN,OAAO;AACd,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,UAAU,EACVC,QAAQ,QAKH,cAAc;AAGrB,SAASC,kBAAkB,QAAgC,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAShF,MAAMC,gBAAgB,GAAIC,IAAkB,IAAgB;EAC1D,MAAMC,OAAuB,GAAG,EAAE;EAClC,MAAMC,IAAsB,GAAG,EAAE;EACjC,MAAMC,UAAkC,GAAG,EAAE;EAE7C,KAAK,MAAMC,KAAK,IAAIJ,IAAI,CAACK,QAAQ,IAAI,EAAE,EAAE;IACvC,IAAID,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MAC/B,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAAIE,GAAG,CAACD,IAAI,KAAK,WAAW,EAAE;UAC5B,KAAK,MAAME,IAAI,IAAID,GAAG,CAACF,QAAQ,IAAI,EAAE,EAAE;YACrCJ,OAAO,CAACQ,IAAI,CAACD,IAAI,CAAC;YAClBL,UAAU,CAACM,IAAI,CAACD,IAAI,CAACE,KAAK,CAAC;UAC7B;QACF;MACF;IACF,CAAC,MAAM,IAAIN,KAAK,CAACE,IAAI,KAAK,YAAY,EAAE;MACtC,KAAK,MAAMC,GAAG,IAAIH,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAE;QACtC,IAAIE,GAAG,CAACD,IAAI,KAAK,WAAW,EAAE;UAC5B,MAAMK,QAAwB,GAAG,EAAE;UACnC,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AK,CAAC0G,YAAY,EAAEC,OAAO;MACvC,IAAIrI,QAAQ,CAACsI,EAAE,KAAK,SAAS,IAAI;QAAEC,kBAAkB,EAAE;MAAM,CAAC;IAChE,CAAC;IACDzC,kBAAkB,EAAE;MAClBe,aAAa,EAAE,KAAK;MACpB6B,QAAQ,EAAE,MAAM;MAChBvD,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-markdown",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "High-performance Markdown parser for React Native using Nitro Modules and md4c",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -195,7 +195,7 @@ export const TableRenderer: FC<TableRendererProps> = ({
195
195
  style={styles.tableScroll}
196
196
  bounces={false}
197
197
  >
198
- <View style={styles.table}>
198
+ <View style={[styles.table, { backgroundColor: style?.backgroundColor ?? theme.colors.surface ?? "#111827" }]}>
199
199
  <View style={styles.headerRow}>
200
200
  {headers.map((cell, colIndex) => (
201
201
  <View
@@ -225,7 +225,7 @@ export const TableRenderer: FC<TableRendererProps> = ({
225
225
  style={[
226
226
  styles.bodyRow,
227
227
  rowIndex === rows.length - 1 && styles.lastRow,
228
- rowIndex % 2 === 1 && styles.oddRow,
228
+ rowIndex % 2 === 0 ? styles.evenRow : styles.oddRow,
229
229
  ]}
230
230
  >
231
231
  {row.map((cell, colIndex) => (
@@ -311,7 +311,6 @@ const createTableStyles = (theme: MarkdownTheme) => {
311
311
  overflow: "hidden",
312
312
  borderWidth: 1,
313
313
  borderColor: colors.tableBorder || "#374151",
314
- backgroundColor: colors.surface || "#111827",
315
314
  },
316
315
  headerRow: {
317
316
  flexDirection: "row",
@@ -324,6 +323,9 @@ const createTableStyles = (theme: MarkdownTheme) => {
324
323
  borderBottomWidth: 1,
325
324
  borderBottomColor: colors.tableBorder || "#374151",
326
325
  },
326
+ evenRow: {
327
+ backgroundColor: colors.tableRowEven || "transparent",
328
+ },
327
329
  oddRow: {
328
330
  backgroundColor: colors.tableRowOdd || "rgba(255,255,255,0.02)",
329
331
  },