markdown-to-jsx 9.7.16 → 9.8.1
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 +15 -3
- package/dist/html.cjs +42 -42
- package/dist/html.d.cts +28 -26
- package/dist/html.d.ts +28 -26
- package/dist/html.js +42 -42
- package/dist/html.js.map +6 -6
- package/dist/index.cjs +38 -38
- package/dist/index.d.cts +28 -26
- package/dist/index.d.ts +28 -26
- package/dist/index.js +38 -38
- package/dist/index.js.map +6 -6
- package/dist/markdown.cjs +53 -53
- package/dist/markdown.d.cts +2 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +53 -53
- package/dist/markdown.js.map +6 -6
- package/dist/native.cjs +40 -40
- package/dist/native.d.cts +82 -29
- package/dist/native.d.ts +82 -29
- package/dist/native.js +40 -40
- package/dist/native.js.map +6 -6
- package/dist/react.cjs +36 -36
- package/dist/react.d.cts +28 -26
- package/dist/react.d.ts +28 -26
- package/dist/react.js +36 -36
- package/dist/react.js.map +6 -6
- package/dist/solid.cjs +37 -37
- package/dist/solid.d.cts +28 -26
- package/dist/solid.d.ts +28 -26
- package/dist/solid.js +37 -37
- package/dist/solid.js.map +7 -7
- package/dist/vue.cjs +38 -38
- package/dist/vue.d.cts +28 -26
- package/dist/vue.d.ts +28 -26
- package/dist/vue.js +38 -38
- package/dist/vue.js.map +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,15 +300,27 @@ function App() {
|
|
|
300
300
|
|
|
301
301
|
- `onLinkPress?: (url: string, title?: string) => void` - Custom handler for link presses (defaults to `Linking.openURL`)
|
|
302
302
|
- `onLinkLongPress?: (url: string, title?: string) => void` - Handler for link long presses
|
|
303
|
-
- `styles?:
|
|
303
|
+
- `styles?: NativeStyles` - Per-key style overrides keyed by element type. Each key is narrowed to the style accepted by its target component (`TextStyle` for inline content and headings, `ViewStyle` for containers, `ImageStyle` for images).
|
|
304
304
|
- `wrapperProps?: ViewProps | TextProps` - Props for the wrapper component (defaults to `View` for block, `Text` for inline)
|
|
305
305
|
|
|
306
|
+
**Overrides:**
|
|
307
|
+
|
|
308
|
+
Overrides on native work the same as on web — `overrides` keys correspond to HTML tag names and fire for parsed markdown as well as raw HTML. For example, override `code` to swap inline backticks and the inner element of fenced code blocks, override `pre` to wrap fenced code, override `input` to render real checkbox visuals for GFM tasks, and override `ul`/`ol`/`li` to swap list containers and rows. Bullets and numbers remain library-controlled inside `li`.
|
|
309
|
+
|
|
310
|
+
When both a renderer-supplied style (`styles.codeInline`, `styles.gfmTask`, etc.) and `overrides[tag].props.style` are set, they merge as a React Native style array — override-level styling wins on conflict.
|
|
311
|
+
|
|
312
|
+
**GFM task checkboxes:**
|
|
313
|
+
|
|
314
|
+
Task checkboxes (`- [x]`, `- [ ]`) route through an `<input type="checkbox">` tag that maps to `View` by default. Use `styles.gfmTask` to style the container, or override `input` to replace the checkbox visual entirely (for a real `<Image>` checkbox, animated state, etc.). Your override receives `checked`, `type: 'checkbox'`, `readOnly`, the merged `style`, and a default `<Text>` child rendering `[x]` or `[ ]` so the marker stays visible without an override. The marker child is library-controlled and not separately styleable; consumers that fully customize the visual should ignore the child and render their own indicator from `props.checked`.
|
|
315
|
+
|
|
316
|
+
The list item wrapper around a task gets `flexDirection: 'row'` and `alignItems: 'center'` applied by default so the checkbox and label sit on the same row out of the box. Override these by passing your own `styles.listItem` — `mergeStyle` keeps the row defaults underneath, so any property you set wins on collision (e.g. supply `alignItems: 'flex-start'` for tasks with multi-line labels).
|
|
317
|
+
|
|
306
318
|
**HTML Tag Mapping:**
|
|
307
319
|
HTML tags are automatically mapped to React Native components:
|
|
308
320
|
|
|
309
321
|
- `<img>` → `Image` component
|
|
310
|
-
- Block elements (`<div>`, `<section>`, `<article>`, `<blockquote>`, `<ul>`, `<ol>`, `<li>`, `<table>`, etc.) → `View` component
|
|
311
|
-
- Inline elements (`<span>`, `<strong>`, `<em>`, `<a>`, etc.) → `Text` component
|
|
322
|
+
- Block elements (`<div>`, `<section>`, `<article>`, `<blockquote>`, `<hr>`, `<input>`, `<ul>`, `<ol>`, `<li>`, `<table>`, etc.) → `View` component
|
|
323
|
+
- Inline elements (`<span>`, `<strong>`, `<em>`, `<a>`, headings, `<code>`, etc.) → `Text` component
|
|
312
324
|
- Type 1 blocks (`<pre>`, `<script>`, `<style>`, `<textarea>`) → `View` component
|
|
313
325
|
|
|
314
326
|
**Note:** Links are underlined by default for better accessibility and discoverability. You can override this via the `styles.link` option.
|