markdown-to-adf 0.2.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +328 -0
  4. package/SECURITY.md +3 -0
  5. package/dist/builders/index.d.ts +22 -0
  6. package/dist/builders/index.d.ts.map +1 -0
  7. package/dist/builders/index.js +22 -0
  8. package/dist/builders/index.js.map +1 -0
  9. package/dist/builders/marks.d.ts +43 -0
  10. package/dist/builders/marks.d.ts.map +1 -0
  11. package/dist/builders/marks.js +54 -0
  12. package/dist/builders/marks.js.map +1 -0
  13. package/dist/builders/nodes.d.ts +133 -0
  14. package/dist/builders/nodes.d.ts.map +1 -0
  15. package/dist/builders/nodes.js +234 -0
  16. package/dist/builders/nodes.js.map +1 -0
  17. package/dist/converter/block-parser.d.ts +38 -0
  18. package/dist/converter/block-parser.d.ts.map +1 -0
  19. package/dist/converter/block-parser.js +426 -0
  20. package/dist/converter/block-parser.js.map +1 -0
  21. package/dist/converter.d.ts +39 -0
  22. package/dist/converter.d.ts.map +1 -0
  23. package/dist/converter.js +81 -0
  24. package/dist/converter.js.map +1 -0
  25. package/dist/index.d.ts +29 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +30 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/markdown/parser.d.ts +11 -0
  30. package/dist/markdown/parser.d.ts.map +1 -0
  31. package/dist/markdown/parser.js +16 -0
  32. package/dist/markdown/parser.js.map +1 -0
  33. package/dist/presets/index.d.ts +23 -0
  34. package/dist/presets/index.d.ts.map +1 -0
  35. package/dist/presets/index.js +90 -0
  36. package/dist/presets/index.js.map +1 -0
  37. package/dist/types/adf.d.ts +252 -0
  38. package/dist/types/adf.d.ts.map +1 -0
  39. package/dist/types/adf.js +7 -0
  40. package/dist/types/adf.js.map +1 -0
  41. package/dist/types/index.d.ts +6 -0
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/dist/types/index.js +5 -0
  44. package/dist/types/index.js.map +1 -0
  45. package/dist/types/options.d.ts +141 -0
  46. package/dist/types/options.d.ts.map +1 -0
  47. package/dist/types/options.js +5 -0
  48. package/dist/types/options.js.map +1 -0
  49. package/dist/utils/inline-parser.d.ts +16 -0
  50. package/dist/utils/inline-parser.d.ts.map +1 -0
  51. package/dist/utils/inline-parser.js +174 -0
  52. package/dist/utils/inline-parser.js.map +1 -0
  53. package/docs/compatibility.md +30 -0
  54. package/docs/presets.md +22 -0
  55. package/docs/warnings.md +20 -0
  56. package/package.json +68 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Markdown-it parser configuration used by the converter.
3
+ */
4
+ import MarkdownIt from 'markdown-it';
5
+ /**
6
+ * Creates a configured markdown-it instance for parsing markdown to tokens.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare function createMarkdownParser(): MarkdownIt;
11
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/markdown/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAIjD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Markdown-it parser configuration used by the converter.
3
+ */
4
+ import MarkdownIt from 'markdown-it';
5
+ import markdownItTaskLists from 'markdown-it-task-lists';
6
+ /**
7
+ * Creates a configured markdown-it instance for parsing markdown to tokens.
8
+ *
9
+ * @internal
10
+ */
11
+ export function createMarkdownParser() {
12
+ return new MarkdownIt({ html: false, breaks: false, linkify: true })
13
+ .enable(['table', 'strikethrough'])
14
+ .use(markdownItTaskLists, { enabled: true });
15
+ }
16
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/markdown/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACjE,MAAM,CAAC,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;SAClC,GAAG,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Predefined conversion presets for common Jira contexts.
3
+ */
4
+ import type { ConversionOptions, ContextPreset } from '../types/options.js';
5
+ /**
6
+ * Resolves a preset name to its full configuration.
7
+ *
8
+ * @param preset - The preset name to resolve
9
+ * @returns The full configuration for the preset
10
+ *
11
+ * @internal
12
+ */
13
+ export declare function resolvePreset(preset: ContextPreset): Required<Omit<ConversionOptions, 'preset'>>;
14
+ /**
15
+ * Merges user options with preset configuration.
16
+ *
17
+ * @param options - User-provided options
18
+ * @returns Fully resolved options with all defaults applied
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function resolveOptions(options?: ConversionOptions): Required<Omit<ConversionOptions, 'preset'>>;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA6D5E;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAEhG;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,iBAAsB,GAC9B,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAY7C"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Predefined conversion presets for common Jira contexts.
3
+ */
4
+ /**
5
+ * Configuration for each context preset.
6
+ *
7
+ * @internal
8
+ */
9
+ const PRESET_CONFIGS = {
10
+ /**
11
+ * Default preset - works in most contexts.
12
+ * Conservative settings that avoid unsupported features.
13
+ */
14
+ default: {
15
+ useHeadings: false,
16
+ maxHeadingLevel: 6,
17
+ preserveLineBreaks: false,
18
+ strictMode: false,
19
+ warnOnRiskyNodes: false,
20
+ defaultCodeLanguage: 'text',
21
+ },
22
+ /**
23
+ * Comment preset - for Jira issue comments.
24
+ * Most restrictive: no headings, converts to bold paragraphs.
25
+ */
26
+ comment: {
27
+ useHeadings: false,
28
+ maxHeadingLevel: 6,
29
+ preserveLineBreaks: false,
30
+ strictMode: false,
31
+ warnOnRiskyNodes: true,
32
+ defaultCodeLanguage: 'text',
33
+ },
34
+ /**
35
+ * Task preset - for Task-type Jira issues.
36
+ * No heading support, converts headings to bold paragraphs.
37
+ */
38
+ task: {
39
+ useHeadings: false,
40
+ maxHeadingLevel: 6,
41
+ preserveLineBreaks: false,
42
+ strictMode: false,
43
+ warnOnRiskyNodes: false,
44
+ defaultCodeLanguage: 'text',
45
+ },
46
+ /**
47
+ * Story preset - for Story/Epic Jira issues.
48
+ * Full ADF support including actual heading nodes.
49
+ */
50
+ story: {
51
+ useHeadings: true,
52
+ maxHeadingLevel: 6,
53
+ preserveLineBreaks: false,
54
+ strictMode: false,
55
+ warnOnRiskyNodes: false,
56
+ defaultCodeLanguage: 'text',
57
+ },
58
+ };
59
+ /**
60
+ * Resolves a preset name to its full configuration.
61
+ *
62
+ * @param preset - The preset name to resolve
63
+ * @returns The full configuration for the preset
64
+ *
65
+ * @internal
66
+ */
67
+ export function resolvePreset(preset) {
68
+ return PRESET_CONFIGS[preset];
69
+ }
70
+ /**
71
+ * Merges user options with preset configuration.
72
+ *
73
+ * @param options - User-provided options
74
+ * @returns Fully resolved options with all defaults applied
75
+ *
76
+ * @internal
77
+ */
78
+ export function resolveOptions(options = {}) {
79
+ const preset = options.preset ?? 'default';
80
+ const presetConfig = resolvePreset(preset);
81
+ return {
82
+ useHeadings: options.useHeadings ?? presetConfig.useHeadings,
83
+ maxHeadingLevel: options.maxHeadingLevel ?? presetConfig.maxHeadingLevel,
84
+ preserveLineBreaks: options.preserveLineBreaks ?? presetConfig.preserveLineBreaks,
85
+ strictMode: options.strictMode ?? presetConfig.strictMode,
86
+ warnOnRiskyNodes: options.warnOnRiskyNodes ?? presetConfig.warnOnRiskyNodes,
87
+ defaultCodeLanguage: options.defaultCodeLanguage ?? presetConfig.defaultCodeLanguage,
88
+ };
89
+ }
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,MAAM,cAAc,GAAuE;IACzF;;;OAGG;IACH,OAAO,EAAE;QACP,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,MAAM;KAC5B;IAED;;;OAGG;IACH,OAAO,EAAE;QACP,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,IAAI;QACtB,mBAAmB,EAAE,MAAM;KAC5B;IAED;;;OAGG;IACH,IAAI,EAAE;QACJ,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,MAAM;KAC5B;IAED;;;OAGG;IACH,KAAK,EAAE;QACL,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,MAAM;KAC5B;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,MAAqB;IACjD,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,UAA6B,EAAE;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC;IAC3C,MAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,YAAY,CAAC,WAAW;QAC5D,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,YAAY,CAAC,eAAe;QACxE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,YAAY,CAAC,kBAAkB;QACjF,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC,UAAU;QACzD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,YAAY,CAAC,gBAAgB;QAC3E,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,YAAY,CAAC,mBAAmB;KACrF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Atlassian Document Format (ADF) type definitions.
3
+ *
4
+ * @see https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/
5
+ */
6
+ /**
7
+ * The root ADF document node.
8
+ * All ADF documents must start with this node type.
9
+ */
10
+ export interface ADFDocument {
11
+ readonly type: 'doc';
12
+ readonly version: 1;
13
+ readonly content: ReadonlyArray<ADFBlockNode>;
14
+ }
15
+ /**
16
+ * Block-level nodes that can appear in a document.
17
+ * These define the structural elements like paragraphs, headings, lists, etc.
18
+ */
19
+ export type ADFBlockNode = ADFParagraph | ADFHeading | ADFBulletList | ADFOrderedList | ADFTaskList | ADFCodeBlock | ADFBlockQuote | ADFRule | ADFPanel | ADFTable;
20
+ /**
21
+ * Inline nodes that can appear within block nodes.
22
+ * These contain the actual content like text, links, emojis, etc.
23
+ */
24
+ export type ADFInlineNode = ADFText | ADFHardBreak | ADFInlineCard | ADFMention | ADFEmoji;
25
+ /**
26
+ * A paragraph node containing inline content.
27
+ */
28
+ export interface ADFParagraph {
29
+ readonly type: 'paragraph';
30
+ readonly content?: ReadonlyArray<ADFInlineNode>;
31
+ }
32
+ /**
33
+ * A heading node with configurable level (1-6).
34
+ *
35
+ * @remarks
36
+ * Headings are not supported in all Jira issue types.
37
+ * Use the `comment` or `task` presets to convert headings to bold text.
38
+ */
39
+ export interface ADFHeading {
40
+ readonly type: 'heading';
41
+ readonly attrs: {
42
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
43
+ };
44
+ readonly content: ReadonlyArray<ADFInlineNode>;
45
+ }
46
+ /**
47
+ * An unordered (bullet) list.
48
+ */
49
+ export interface ADFBulletList {
50
+ readonly type: 'bulletList';
51
+ readonly content: ReadonlyArray<ADFListItem>;
52
+ }
53
+ /**
54
+ * An ordered (numbered) list.
55
+ */
56
+ export interface ADFOrderedList {
57
+ readonly type: 'orderedList';
58
+ readonly content: ReadonlyArray<ADFListItem>;
59
+ }
60
+ /**
61
+ * A task list (checkbox list).
62
+ */
63
+ export interface ADFTaskList {
64
+ readonly type: 'taskList';
65
+ readonly attrs: {
66
+ readonly localId: string;
67
+ };
68
+ readonly content: ReadonlyArray<ADFTaskItem>;
69
+ }
70
+ /**
71
+ * A task list item with checkbox state.
72
+ */
73
+ export interface ADFTaskItem {
74
+ readonly type: 'taskItem';
75
+ readonly attrs: {
76
+ readonly localId: string;
77
+ readonly state: 'TODO' | 'DONE';
78
+ };
79
+ readonly content: ReadonlyArray<ADFInlineNode>;
80
+ }
81
+ /**
82
+ * A list item that can contain paragraphs or nested lists.
83
+ */
84
+ export interface ADFListItem {
85
+ readonly type: 'listItem';
86
+ readonly content: ReadonlyArray<ADFParagraph | ADFBulletList | ADFOrderedList>;
87
+ }
88
+ /**
89
+ * A code block with optional syntax highlighting.
90
+ */
91
+ export interface ADFCodeBlock {
92
+ readonly type: 'codeBlock';
93
+ readonly attrs?: {
94
+ readonly language?: string;
95
+ };
96
+ readonly content: ReadonlyArray<ADFText>;
97
+ }
98
+ /**
99
+ * A block quote containing other block nodes.
100
+ */
101
+ export interface ADFBlockQuote {
102
+ readonly type: 'blockQuote';
103
+ readonly content: ReadonlyArray<ADFBlockNode>;
104
+ }
105
+ /**
106
+ * A horizontal rule (divider).
107
+ */
108
+ export interface ADFRule {
109
+ readonly type: 'rule';
110
+ }
111
+ /**
112
+ * A panel (callout) with different styles.
113
+ */
114
+ export interface ADFPanel {
115
+ readonly type: 'panel';
116
+ readonly attrs: {
117
+ readonly panelType: 'info' | 'note' | 'warning' | 'error' | 'success';
118
+ };
119
+ readonly content: ReadonlyArray<ADFBlockNode>;
120
+ }
121
+ /**
122
+ * Text content with optional formatting marks.
123
+ */
124
+ export interface ADFText {
125
+ readonly type: 'text';
126
+ readonly text: string;
127
+ readonly marks?: ReadonlyArray<ADFMark>;
128
+ }
129
+ /**
130
+ * A hard line break (like Shift+Enter).
131
+ */
132
+ export interface ADFHardBreak {
133
+ readonly type: 'hardBreak';
134
+ }
135
+ /**
136
+ * An inline card (preview of a URL).
137
+ */
138
+ export interface ADFInlineCard {
139
+ readonly type: 'inlineCard';
140
+ readonly attrs: {
141
+ readonly url: string;
142
+ };
143
+ }
144
+ /**
145
+ * A mention of a user or entity.
146
+ */
147
+ export interface ADFMention {
148
+ readonly type: 'mention';
149
+ readonly attrs: {
150
+ readonly id: string;
151
+ readonly text?: string;
152
+ };
153
+ }
154
+ /**
155
+ * An emoji reference.
156
+ */
157
+ export interface ADFEmoji {
158
+ readonly type: 'emoji';
159
+ readonly attrs: {
160
+ readonly shortName: string;
161
+ readonly id?: string;
162
+ readonly text?: string;
163
+ };
164
+ }
165
+ /**
166
+ * Text formatting marks that can be applied to text nodes.
167
+ */
168
+ export type ADFMark = ADFStrongMark | ADFEmMark | ADFCodeMark | ADFStrikeMark | ADFUnderlineMark | ADFLinkMark | ADFTextColorMark;
169
+ /**
170
+ * Bold text formatting.
171
+ */
172
+ export interface ADFStrongMark {
173
+ readonly type: 'strong';
174
+ }
175
+ /**
176
+ * Italic text formatting.
177
+ */
178
+ export interface ADFEmMark {
179
+ readonly type: 'em';
180
+ }
181
+ /**
182
+ * Inline code formatting.
183
+ */
184
+ export interface ADFCodeMark {
185
+ readonly type: 'code';
186
+ }
187
+ /**
188
+ * Strikethrough text formatting.
189
+ */
190
+ export interface ADFStrikeMark {
191
+ readonly type: 'strike';
192
+ }
193
+ /**
194
+ * Underlined text formatting.
195
+ */
196
+ export interface ADFUnderlineMark {
197
+ readonly type: 'underline';
198
+ }
199
+ /**
200
+ * Hyperlink with URL and optional title.
201
+ */
202
+ export interface ADFLinkMark {
203
+ readonly type: 'link';
204
+ readonly attrs: {
205
+ readonly href: string;
206
+ readonly title?: string;
207
+ };
208
+ }
209
+ /**
210
+ * Text color formatting.
211
+ */
212
+ export interface ADFTextColorMark {
213
+ readonly type: 'textColor';
214
+ readonly attrs: {
215
+ readonly color: string;
216
+ };
217
+ }
218
+ /**
219
+ * A table node containing rows.
220
+ */
221
+ export interface ADFTable {
222
+ readonly type: 'table';
223
+ readonly attrs?: {
224
+ readonly isNumberColumnEnabled?: boolean;
225
+ readonly layout?: 'default' | 'wide' | 'full-width';
226
+ };
227
+ readonly content: ReadonlyArray<ADFTableRow>;
228
+ }
229
+ /**
230
+ * A table row containing cells.
231
+ */
232
+ export interface ADFTableRow {
233
+ readonly type: 'tableRow';
234
+ readonly content: ReadonlyArray<ADFTableCell | ADFTableHeader>;
235
+ }
236
+ /**
237
+ * A table header cell.
238
+ */
239
+ export interface ADFTableHeader {
240
+ readonly type: 'tableHeader';
241
+ readonly attrs?: Record<string, unknown>;
242
+ readonly content: ReadonlyArray<ADFParagraph>;
243
+ }
244
+ /**
245
+ * A table data cell.
246
+ */
247
+ export interface ADFTableCell {
248
+ readonly type: 'tableCell';
249
+ readonly attrs?: Record<string, unknown>;
250
+ readonly content: ReadonlyArray<ADFParagraph>;
251
+ }
252
+ //# sourceMappingURL=adf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adf.d.ts","sourceRoot":"","sources":["../../src/types/adf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,UAAU,GACV,aAAa,GACb,cAAc,GACd,WAAW,GACX,YAAY,GACZ,aAAa,GACb,OAAO,GACP,QAAQ,GACR,QAAQ,CAAC;AAEb;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CACjD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACvC,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CA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AAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;QACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;KACrD,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,GAAG,cAAc,CAAC,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAC/C"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Atlassian Document Format (ADF) type definitions.
3
+ *
4
+ * @see https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=adf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adf.js","sourceRoot":"","sources":["../../src/types/adf.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Public type exports for markdown-to-adf.
3
+ */
4
+ export type { ADFDocument, ADFBlockNode, ADFInlineNode, ADFParagraph, ADFHeading, ADFBulletList, ADFOrderedList, ADFListItem, ADFCodeBlock, ADFBlockQuote, ADFRule, ADFPanel, ADFText, ADFHardBreak, ADFInlineCard, ADFMention, ADFEmoji, ADFMark, ADFStrongMark, ADFEmMark, ADFCodeMark, ADFStrikeMark, ADFUnderlineMark, ADFLinkMark, ADFTextColorMark, } from './adf.js';
5
+ export type { ContextPreset, ConversionOptions, ConversionResult, ConversionWarning, } from './options.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,aAAa,EACb,UAAU,EACV,QAAQ,EACR,OAAO,EACP,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Public type exports for markdown-to-adf.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Configuration options for markdown to ADF conversion.
3
+ */
4
+ import type { ADFDocument } from './adf.js';
5
+ /**
6
+ * Predefined context presets for common Jira use cases.
7
+ *
8
+ * @remarks
9
+ * Different Jira contexts support different ADF features:
10
+ * - `comment`: Restrictive schema, no headings, suitable for issue comments
11
+ * - `task`: No headings (headings convert to bold), suitable for Task-type issues
12
+ * - `story`: Full ADF support including headings, suitable for Story/Epic issues
13
+ * - `default`: Balanced preset that works in most contexts
14
+ */
15
+ export type ContextPreset = 'comment' | 'task' | 'story' | 'default';
16
+ /**
17
+ * Options for customizing markdown to ADF conversion behavior.
18
+ */
19
+ export interface ConversionOptions {
20
+ /**
21
+ * Use a predefined preset optimized for a specific Jira context.
22
+ *
23
+ * @defaultValue 'default'
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // For issue comments (no headings)
28
+ * markdownToAdf(markdown, { preset: 'comment' });
29
+ *
30
+ * // For Task-type issues (headings convert to bold)
31
+ * markdownToAdf(markdown, { preset: 'task' });
32
+ *
33
+ * // For Story/Epic issues (full heading support)
34
+ * markdownToAdf(markdown, { preset: 'story' });
35
+ * ```
36
+ */
37
+ preset?: ContextPreset;
38
+ /**
39
+ * Whether to use actual heading nodes (h1-h6) in the ADF output.
40
+ *
41
+ * @remarks
42
+ * Headings are not supported in all Jira contexts:
43
+ * - ❌ Issue comments
44
+ * - ❌ Task-type issues
45
+ * - ✅ Story/Epic issues (and some others)
46
+ *
47
+ * When `false`, markdown headings (##) are converted to bold paragraphs.
48
+ *
49
+ * @defaultValue false
50
+ */
51
+ useHeadings?: boolean;
52
+ /**
53
+ * Maximum heading level to allow (1-6).
54
+ * Headings deeper than this will be converted to bold paragraphs.
55
+ *
56
+ * @defaultValue 6
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * // Only allow h1 and h2
61
+ * markdownToAdf(markdown, { maxHeadingLevel: 2 });
62
+ * ```
63
+ */
64
+ maxHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
65
+ /**
66
+ * Whether to preserve line breaks as hard breaks in paragraphs.
67
+ *
68
+ * @remarks
69
+ * When `true`, single line breaks become `<hardBreak>` nodes.
70
+ * When `false`, consecutive lines are merged into a single paragraph.
71
+ *
72
+ * @defaultValue false
73
+ */
74
+ preserveLineBreaks?: boolean;
75
+ /**
76
+ * Whether to throw errors on unsupported markdown syntax.
77
+ *
78
+ * @remarks
79
+ * When `true`, throws an error if markdown contains features incompatible
80
+ * with the selected preset (e.g., headings in comments).
81
+ * When `false`, silently ignores or converts unsupported features to plain text.
82
+ *
83
+ * @defaultValue false
84
+ */
85
+ strictMode?: boolean;
86
+ /**
87
+ * Whether to emit warnings for nodes that are technically valid but known to be flaky.
88
+ *
89
+ * @remarks
90
+ * Useful for Jira contexts where some nodes are inconsistently supported.
91
+ *
92
+ * @defaultValue false
93
+ */
94
+ warnOnRiskyNodes?: boolean;
95
+ /**
96
+ * Default language for code blocks without a language specifier.
97
+ *
98
+ * @defaultValue 'text'
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * markdownToAdf(markdown, { defaultCodeLanguage: 'javascript' });
103
+ * ```
104
+ */
105
+ defaultCodeLanguage?: string;
106
+ }
107
+ /**
108
+ * Result of a markdown to ADF conversion.
109
+ */
110
+ export interface ConversionResult {
111
+ /**
112
+ * The generated ADF document.
113
+ */
114
+ adf: ADFDocument;
115
+ /**
116
+ * Warnings generated during conversion (e.g., unsupported features).
117
+ */
118
+ warnings: readonly ConversionWarning[];
119
+ }
120
+ /**
121
+ * A warning about potentially lossy or unsupported conversion.
122
+ */
123
+ export interface ConversionWarning {
124
+ /**
125
+ * The type of warning.
126
+ */
127
+ type: 'unsupported_feature' | 'lossy_conversion' | 'invalid_syntax' | 'risky_feature';
128
+ /**
129
+ * Human-readable warning message.
130
+ */
131
+ message: string;
132
+ /**
133
+ * Line number where the warning occurred (1-indexed), if available.
134
+ */
135
+ line?: number;
136
+ /**
137
+ * The original markdown that triggered the warning.
138
+ */
139
+ markdown?: string;
140
+ }
141
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAExC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;;;;OASG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,qBAAqB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,eAAe,CAAC;IAEtF;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Configuration options for markdown to ADF conversion.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Utilities for parsing inline markdown-it tokens into ADF inline nodes.
3
+ */
4
+ import type { Token } from 'markdown-it';
5
+ import type { ADFInlineNode } from '../types/adf.js';
6
+ interface InlineParseOptions {
7
+ preserveLineBreaks: boolean;
8
+ stripTaskCheckbox?: boolean;
9
+ }
10
+ interface InlineParseResult {
11
+ nodes: ADFInlineNode[];
12
+ taskChecked: boolean;
13
+ }
14
+ export declare function parseInlineTokens(tokens: readonly Token[] | null | undefined, options: InlineParseOptions): InlineParseResult;
15
+ export {};
16
+ //# sourceMappingURL=inline-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-parser.d.ts","sourceRoot":"","sources":["../../src/utils/inline-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAW,MAAM,iBAAiB,CAAC;AAI9D,UAAU,kBAAkB;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI,GAAG,SAAS,EAC3C,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CA4GnB"}