github-markdown-adf 1.0.1 → 1.2.0
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 +23 -3
- package/dist/browser/index.iife.js +17 -32
- package/dist/browser/index.js +17 -32
- package/dist/index.cjs +83 -99
- package/dist/index.d.cts +14 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +14 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +84 -75
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/github-markdown-adf)
|
|
4
4
|
[](https://github.com/joroden/github-markdown-adf/actions)
|
|
5
|
+
[](https://badge.socket.dev/npm/package/github-markdown-adf)
|
|
5
6
|
[](https://unlicense.org)
|
|
6
7
|
|
|
7
8
|
Bidirectional **GitHub Flavored Markdown (GFM) to / from Atlassian Document Format (ADF)** converter.
|
|
@@ -137,20 +138,39 @@ import { mdToAdf, adfToMd } from 'github-markdown-adf';
|
|
|
137
138
|
|
|
138
139
|
### `mdToAdf(markdown: string): AdfDoc`
|
|
139
140
|
|
|
140
|
-
Converts a GFM string to an ADF document object. Parses using
|
|
141
|
+
Converts a GFM string to an ADF document object. Parses using mdast and micromark GFM extensions, with support for tables, task lists, strikethrough, and GitHub Alert syntax (`> [!NOTE]`, `> [!WARNING]`, etc.).
|
|
141
142
|
|
|
142
|
-
### `adfToMd(adf: AdfDoc): string`
|
|
143
|
+
### `adfToMd(adf: AdfDoc, options?: AdfToMdOptions): string`
|
|
143
144
|
|
|
144
145
|
Converts an ADF document object to a GFM string. Handles all standard ADF node and mark types and produces clean, readable output targeting GitHub Flavored Markdown.
|
|
145
146
|
|
|
147
|
+
## Options
|
|
148
|
+
|
|
149
|
+
`adfToMd` accepts an optional second argument to control rendering behaviour.
|
|
150
|
+
|
|
151
|
+
### `AdfToMdOptions`
|
|
152
|
+
|
|
153
|
+
| Option | Type | Default | Description |
|
|
154
|
+
|---|---|---|---|
|
|
155
|
+
| `mentions` | `boolean` | `true` | When `true`, renders mention nodes as the display text if available, otherwise as `@{id}`. When `false`, renders as plain text: display text if available, otherwise just the bare `{id}` without an `@` prefix. |
|
|
156
|
+
|
|
157
|
+
### Usage example
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// Render mentions as plain text instead of @-tagged references
|
|
161
|
+
const md = adfToMd(adfDoc, { mentions: false });
|
|
162
|
+
```
|
|
163
|
+
|
|
146
164
|
## TypeScript Types
|
|
147
165
|
|
|
148
|
-
All ADF types are exported for use in your own code:
|
|
166
|
+
All ADF types and option interfaces are exported for use in your own code:
|
|
149
167
|
|
|
150
168
|
```typescript
|
|
151
169
|
import type { AdfDoc, AdfNode, AdfMark, AdfInlineNode, AdfTopLevelBlockNode } from 'github-markdown-adf';
|
|
152
170
|
// Also available: ParagraphNode, HeadingNode, TableNode, PanelNode, CodeBlockNode,
|
|
153
171
|
// BulletListNode, OrderedListNode, TaskListNode, TextNode, MentionNode, ...and more
|
|
172
|
+
|
|
173
|
+
import type { AdfToMdOptions } from 'github-markdown-adf';
|
|
154
174
|
```
|
|
155
175
|
|
|
156
176
|
## Requirements
|