You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`unwrap`|`boolean \| string \| string[]`|`false`| Remove wrapper tags from the tree, hoisting their children (MDC `unwrap` behaviour). `true` unwraps `p`; a comma/whitespace-separated string or array unwraps the listed tags; `'*'` matches any tag. Tags apply sequentially (each descends one level), and adjacent text is merged into a single string. |
366
367
|`html`|`boolean`|`true`| Parse embedded HTML tags into AST nodes |
367
368
|`linkify`|`boolean`|`true`| Auto-convert URL-like text into links. Set `false` to disable |
368
369
|`headingIds`|`boolean`|`true`| Auto-generate `id` attributes for `h1`–`h6` headings. Set `false` to disable |
369
370
|`plugins`|`ComarkPlugin[]`|`[]`| Array of plugins to apply |
370
371
372
+
### Inline rendering
373
+
374
+
Use `unwrap: 'p'` (or just `unwrap: true`) to render markdown without the
375
+
wrapping `<p>`, which is handy for buttons, badges, and other inline hosts.
376
+
Adjacent text is merged into a single string, matching MDC's `unwrap`:
377
+
378
+
```ts
379
+
awaitparse('Hello **world**', { unwrap: 'p' })
380
+
// nodes: ['Hello ', ['strong', {}, 'world']]
381
+
382
+
awaitparse('a\n\nb', { unwrap: true })
383
+
// nodes: ['ab'] (paragraphs merged, no separator)
384
+
```
385
+
386
+
Tags are applied **sequentially**, each descending one level into the result of
387
+
the previous one — so a space-separated (or comma-separated) list peels nested
388
+
wrappers. `'*'` matches any tag:
389
+
390
+
```ts
391
+
// Unwrap the <ul>, then the <li> inside it
392
+
awaitparse('- Buy milk', { unwrap: 'ul li' })
393
+
// nodes: ['Buy milk']
394
+
```
395
+
396
+
On the framework components this is exposed as an `unwrap` shorthand prop:
0 commit comments