adf2markdown 0.0.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/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +134 -0
- package/dist/index.js.map +10 -0
- package/dist/src/adf2md.d.ts +16 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rodrigo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# adf2markdown
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Convert Atlassian ADF (Jira/Confluence) to clean Markdown — a lightweight JS library designed to make Jira tickets readable and understandable by LLMs.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install adf2markdown
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { adf2markdown } from "adf2markdown";
|
|
17
|
+
|
|
18
|
+
const adf = {
|
|
19
|
+
version: 1,
|
|
20
|
+
type: "doc",
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: "paragraph",
|
|
24
|
+
content: [{ text: "This is a sample ADF document.", type: "text" }],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const markdown = adf2markdown(adf);
|
|
30
|
+
console.log(markdown); // "This is a sample ADF document."
|
|
31
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { adf2md, type Adf } from "./src/adf2md";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/adf2md.ts
|
|
2
|
+
function getChildren(node) {
|
|
3
|
+
return node?.content ?? [];
|
|
4
|
+
}
|
|
5
|
+
function renderEachChildren(node, context, renderChild) {
|
|
6
|
+
return getChildren(node).map((child, i, children) => renderChild(child, {
|
|
7
|
+
...context,
|
|
8
|
+
ancestors: [node, ...context.ancestors],
|
|
9
|
+
siblings: children.slice(0, i)
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
function renderChildren(node, context, renderChild = renderNode) {
|
|
13
|
+
return renderEachChildren(node, context, renderChild).join(context.join);
|
|
14
|
+
}
|
|
15
|
+
var markRenders = {
|
|
16
|
+
strong: (text) => `**${text}**`,
|
|
17
|
+
em: (text) => `_${text}_`,
|
|
18
|
+
strike: (text) => `~~${text}~~`,
|
|
19
|
+
code: (text) => `\`${text}\``,
|
|
20
|
+
underline: (text) => `<u>${text}</u>`,
|
|
21
|
+
link: (text, mark) => `[${text}](${mark.attrs?.href ?? ""})`,
|
|
22
|
+
subsup: (text, mark) => mark.attrs?.type === "sub" ? `<sub>${text}</sub>` : `<sup>${text}</sup>`
|
|
23
|
+
};
|
|
24
|
+
var renders = {
|
|
25
|
+
text(node) {
|
|
26
|
+
const identity = (text2) => text2;
|
|
27
|
+
const marks = node.marks ?? [];
|
|
28
|
+
const text = node.text ?? "";
|
|
29
|
+
return marks.reduce((text2, mark) => (markRenders[mark.type] ?? identity)(text2, mark), text);
|
|
30
|
+
},
|
|
31
|
+
heading(node, context) {
|
|
32
|
+
const level = Number(node.attrs?.level ?? 1);
|
|
33
|
+
const hashes = "#".repeat(level);
|
|
34
|
+
return `${hashes} ${renderChildren(node, { ...context, join: " " })}`;
|
|
35
|
+
},
|
|
36
|
+
orderedList: (node, context) => renderChildren(node, { ...context, join: `
|
|
37
|
+
` }),
|
|
38
|
+
bulletList: (node, context) => renderChildren(node, { ...context, join: `
|
|
39
|
+
` }),
|
|
40
|
+
decisionItem(node, context) {
|
|
41
|
+
return `> ${renderChildren(node, { ...context, join: " " })}`;
|
|
42
|
+
},
|
|
43
|
+
listItem(node, context) {
|
|
44
|
+
const parent = context.ancestors[0];
|
|
45
|
+
const listTypes = ["bulletList", "orderedList"];
|
|
46
|
+
const isParentList = parent && listTypes.includes(parent.type);
|
|
47
|
+
const isParentOrderedList = parent?.type === "orderedList";
|
|
48
|
+
return renderChildren(node, context, (child) => {
|
|
49
|
+
const isChildText = child.type === "text" || child.type === "paragraph";
|
|
50
|
+
if (isParentList && isChildText) {
|
|
51
|
+
const level = context.ancestors.filter((ancestor) => listTypes.includes(ancestor.type)).length;
|
|
52
|
+
const indentSymbol = isParentOrderedList ? " " : " ";
|
|
53
|
+
const indent = indentSymbol.repeat(level - 1);
|
|
54
|
+
const symbol = isParentOrderedList ? `${context.siblings.length + 1}.` : "-";
|
|
55
|
+
return `${indent}${symbol} ${renderNode(child, { ...context, join: " " })}`;
|
|
56
|
+
}
|
|
57
|
+
return renderNode(child, context);
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
taskItem(node, context) {
|
|
61
|
+
const state = node.attrs?.state === "DONE" ? "x" : " ";
|
|
62
|
+
return `[${state}] ${renderChildren(node, { ...context, join: " " })}`;
|
|
63
|
+
},
|
|
64
|
+
blockquote(node, context) {
|
|
65
|
+
return renderChildren(node, context).split(`
|
|
66
|
+
`).map((line) => `> ${line}`).join(`
|
|
67
|
+
`);
|
|
68
|
+
},
|
|
69
|
+
codeBlock(node, context) {
|
|
70
|
+
const language = node.attrs?.language ?? "";
|
|
71
|
+
return `\`\`\`${language}
|
|
72
|
+
${renderChildren(node, { ...context, join: `
|
|
73
|
+
` })}
|
|
74
|
+
\`\`\``;
|
|
75
|
+
},
|
|
76
|
+
panel(node, context) {
|
|
77
|
+
const panelType = String(node.attrs?.panelType ?? "info");
|
|
78
|
+
const title = panelType + ":";
|
|
79
|
+
const content = renderChildren(node, context);
|
|
80
|
+
return `> **${title}**
|
|
81
|
+
${content.split(`
|
|
82
|
+
`).map((line) => `> ${line}`).join(`
|
|
83
|
+
`)}`;
|
|
84
|
+
},
|
|
85
|
+
table(node, context) {
|
|
86
|
+
const rows = renderEachChildren(node, context, (row) => {
|
|
87
|
+
return renderEachChildren(row, { ...context, join: " " }, renderNode);
|
|
88
|
+
});
|
|
89
|
+
const columnWidths = [];
|
|
90
|
+
for (const row of rows) {
|
|
91
|
+
for (const [i, cell] of row.entries()) {
|
|
92
|
+
columnWidths[i] = Math.max(columnWidths[i] ?? 0, cell.length);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const wrap = (text) => `| ${text} |`;
|
|
96
|
+
const formattedRows = rows.map((row) => wrap(row.map((cell, i) => cell.padEnd(columnWidths[i] ?? 0)).join(" | ")));
|
|
97
|
+
const hasHeader = getChildren(getChildren(node)[0]).some((cell) => cell.type === "tableHeader");
|
|
98
|
+
if (hasHeader) {
|
|
99
|
+
const separatorRow = wrap(columnWidths.map((width) => "-".repeat(width)).join(" | "));
|
|
100
|
+
formattedRows.splice(1, 0, separatorRow);
|
|
101
|
+
}
|
|
102
|
+
return formattedRows.join(`
|
|
103
|
+
`);
|
|
104
|
+
},
|
|
105
|
+
paragraph: (node, context) => renderChildren(node, { ...context, join: "" }),
|
|
106
|
+
rule: () => "---",
|
|
107
|
+
inlineCard: (node) => `[${node.attrs?.url ?? ""}](${node.attrs?.url ?? ""})`,
|
|
108
|
+
emoji: (node) => String(node.attrs?.text ?? node.attrs?.shortName ?? ""),
|
|
109
|
+
date: (node) => new Date(Number(node.attrs?.timestamp ?? 0)).toISOString(),
|
|
110
|
+
status: (node) => `[${node.attrs?.text ?? ""}]`,
|
|
111
|
+
mention: (node) => String(node.attrs?.text ?? ""),
|
|
112
|
+
hardBreak: () => "<br/>",
|
|
113
|
+
media(node) {
|
|
114
|
+
const alt = node.attrs?.alt ?? "";
|
|
115
|
+
const linkMark = node.marks?.find((mark) => mark.type === "link");
|
|
116
|
+
const url = linkMark?.attrs?.href ?? node.attrs?.url ?? "";
|
|
117
|
+
return ``;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function renderNode(node, context) {
|
|
121
|
+
return (renders[node.type] ?? renderChildren)(node, context);
|
|
122
|
+
}
|
|
123
|
+
function adf2md(adf) {
|
|
124
|
+
return renderNode(adf, { join: `
|
|
125
|
+
|
|
126
|
+
`, ancestors: [], siblings: [] }) + `
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
adf2md
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
//# debugId=42C2425BDB34A12164756E2164756E21
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["..\\src\\adf2md.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"// https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/\n// https://developer.atlassian.com/platform/forge/ui-kit/components/adf-renderer/\n\ninterface Context {\n ancestors: Node[];\n siblings: Node[];\n join: string;\n}\n\ninterface Mark {\n type: string;\n attrs?: Record<string, unknown>;\n}\n\ninterface Node {\n type: string;\n text?: string;\n content?: Node[];\n marks?: Mark[];\n attrs?: Record<string, unknown>;\n}\n\nexport interface Adf extends Node {\n version: number;\n}\n\nfunction getChildren(node?: Node | null): Node[] {\n return node?.content ?? [];\n}\n\ntype RenderChild<Result> = (child: Node, context: Context) => Result;\n\nfunction renderEachChildren<Result>(node: Node, context: Context, renderChild: RenderChild<Result>): Result[] {\n return getChildren(node).map((child, i, children) =>\n renderChild(child, {\n ...context,\n ancestors: [node, ...context.ancestors],\n siblings: children.slice(0, i),\n }),\n );\n}\n\nfunction renderChildren(node: Node, context: Context, renderChild = renderNode) {\n return renderEachChildren(node, context, renderChild).join(context.join);\n}\n\ntype MarkRender = (text: string, mark: Mark) => string;\n\nconst markRenders: Record<string, MarkRender> = {\n strong: (text) => `**${text}**`,\n em: (text) => `_${text}_`,\n strike: (text) => `~~${text}~~`,\n code: (text) => `\\`${text}\\``,\n underline: (text) => `<u>${text}</u>`,\n link: (text, mark) => `[${text}](${mark.attrs?.href ?? \"\"})`,\n subsup: (text, mark) => (mark.attrs?.type === \"sub\" ? `<sub>${text}</sub>` : `<sup>${text}</sup>`),\n};\n\ntype Render = (node: Node, context: Context) => string;\n\nconst renders: Record<string, Render> = {\n text(node) {\n const identity = (text: string) => text;\n const marks = node.marks ?? [];\n const text = node.text ?? \"\";\n\n return marks.reduce((text, mark) => (markRenders[mark.type] ?? identity)(text, mark), text);\n },\n\n heading(node, context) {\n const level = Number(node.attrs?.level ?? 1);\n const hashes = \"#\".repeat(level);\n return `${hashes} ${renderChildren(node, { ...context, join: \" \" })}`;\n },\n\n orderedList: (node, context) => renderChildren(node, { ...context, join: \"\\n\" }),\n bulletList: (node, context) => renderChildren(node, { ...context, join: \"\\n\" }),\n\n decisionItem(node, context) {\n return `> ${renderChildren(node, { ...context, join: \" \" })}`;\n },\n\n listItem(node, context) {\n const parent = context.ancestors[0];\n const listTypes = [\"bulletList\", \"orderedList\"];\n const isParentList = parent && listTypes.includes(parent.type);\n const isParentOrderedList = parent?.type === \"orderedList\";\n\n return renderChildren(node, context, (child: Node) => {\n const isChildText = child.type === \"text\" || child.type === \"paragraph\";\n\n if (isParentList && isChildText) {\n const level = context.ancestors.filter((ancestor) => listTypes.includes(ancestor.type)).length;\n const indentSymbol = isParentOrderedList ? \" \" : \" \";\n const indent = indentSymbol.repeat(level - 1);\n const symbol = isParentOrderedList ? `${context.siblings.length + 1}.` : \"-\";\n return `${indent}${symbol} ${renderNode(child, { ...context, join: \" \" })}`;\n }\n\n return renderNode(child, context);\n });\n },\n\n taskItem(node, context) {\n const state = node.attrs?.state === \"DONE\" ? \"x\" : \" \";\n return `[${state}] ${renderChildren(node, { ...context, join: \" \" })}`;\n },\n\n blockquote(node, context) {\n return renderChildren(node, context)\n .split(\"\\n\")\n .map((line) => `> ${line}`)\n .join(\"\\n\");\n },\n\n codeBlock(node, context) {\n const language = node.attrs?.language ?? \"\";\n return `\\`\\`\\`${language}\\n${renderChildren(node, { ...context, join: \"\\n\" })}\\n\\`\\`\\``;\n },\n\n panel(node, context) {\n const panelType = String(node.attrs?.panelType ?? \"info\");\n const title = panelType + \":\";\n const content = renderChildren(node, context);\n\n return `> **${title}**\\n${content\n .split(\"\\n\")\n .map((line) => `> ${line}`)\n .join(\"\\n\")}`;\n },\n\n table(node, context) {\n const rows = renderEachChildren(node, context, (row: Node) => {\n return renderEachChildren(row, { ...context, join: \" \" }, renderNode);\n });\n\n const columnWidths: number[] = [];\n for (const row of rows) {\n for (const [i, cell] of row.entries()) {\n columnWidths[i] = Math.max(columnWidths[i] ?? 0, cell.length);\n }\n }\n\n const wrap = (text: string) => `| ${text} |`;\n\n const formattedRows = rows.map((row) => wrap(row.map((cell, i) => cell.padEnd(columnWidths[i] ?? 0)).join(\" | \")));\n\n const hasHeader = getChildren(getChildren(node)[0]).some((cell) => cell.type === \"tableHeader\");\n if (hasHeader) {\n const separatorRow = wrap(columnWidths.map((width) => \"-\".repeat(width)).join(\" | \"));\n formattedRows.splice(1, 0, separatorRow);\n }\n\n return formattedRows.join(\"\\n\");\n },\n\n paragraph: (node, context) => renderChildren(node, { ...context, join: \"\" }),\n rule: () => \"---\",\n inlineCard: (node) => `[${node.attrs?.url ?? \"\"}](${node.attrs?.url ?? \"\"})`,\n emoji: (node) => String(node.attrs?.text ?? node.attrs?.shortName ?? \"\"),\n date: (node) => new Date(Number(node.attrs?.timestamp ?? 0)).toISOString(),\n status: (node) => `[${node.attrs?.text ?? \"\"}]`,\n mention: (node) => String(node.attrs?.text ?? \"\"),\n hardBreak: () => \"<br/>\",\n media(node) {\n const alt = node.attrs?.alt ?? \"\";\n const linkMark = node.marks?.find((mark) => mark.type === \"link\");\n const url = linkMark?.attrs?.href ?? node.attrs?.url ?? \"\";\n return ``;\n },\n};\n\nfunction renderNode(node: Node, context: Context): string {\n return (renders[node.type] ?? renderChildren)(node, context);\n}\n\nexport function adf2md(adf: Adf): string {\n return renderNode(adf, { join: \"\\n\\n\", ancestors: [], siblings: [] }) + \"\\n\";\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AA0BA,SAAS,WAAW,CAAC,MAA4B;AAAA,EAC/C,OAAO,MAAM,WAAW,CAAC;AAAA;AAK3B,SAAS,kBAA0B,CAAC,MAAY,SAAkB,aAA4C;AAAA,EAC5G,OAAO,YAAY,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,aACtC,YAAY,OAAO;AAAA,OACd;AAAA,IACH,WAAW,CAAC,MAAM,GAAG,QAAQ,SAAS;AAAA,IACtC,UAAU,SAAS,MAAM,GAAG,CAAC;AAAA,EAC/B,CAAC,CACH;AAAA;AAGF,SAAS,cAAc,CAAC,MAAY,SAAkB,cAAc,YAAY;AAAA,EAC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,SAAS,MAAM,GAAG,CAAC;AAAA,EAC3E,MAAM,MAAM;AAAA,EACZ,YAAY,CAAC,SAAS,IAAI,KAAK,OAAO,OAAO,OAAO,KAAK,OAAO,OAAO;AAAA,EACvE,OAAO,CAAC,SAAS,OAAO,KAAK,OAAO,QAAQ,KAAK,OAAO,aAAa,EAAE;AAAA,EACvE,MAAM,CAAC,SAAS,IAAI,KAAK,OAAO,KAAK,OAAO,aAAa,CAAC,CAAC,EAAE,YAAY;AAAA,EACzE,QAAQ,CAAC,SAAS,IAAI,KAAK,OAAO,QAAQ;AAAA,EAC1C,SAAS,CAAC,SAAS,OAAO,KAAK,OAAO,QAAQ,EAAE;AAAA,EAChD,WAAW,MAAM;AAAA,EACjB,KAAK,CAAC,MAAM;AAAA,IACV,MAAM,MAAM,KAAK,OAAO,OAAO;AAAA,IAC/B,MAAM,WAAW,KAAK,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,MAAM;AAAA,IAChE,MAAM,MAAM,UAAU,OAAO,QAAQ,KAAK,OAAO,OAAO;AAAA,IACxD,OAAO,KAAK,QAAQ;AAAA;AAExB;AAEA,SAAS,UAAU,CAAC,MAAY,SAA0B;AAAA,EACxD,QAAQ,QAAQ,KAAK,SAAS,gBAAgB,MAAM,OAAO;AAAA;AAGtD,SAAS,MAAM,CAAC,KAAkB;AAAA,EACvC,OAAO,WAAW,KAAK,EAAE,MAAM;AAAA;AAAA,GAAQ,WAAW,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,IAAI;AAAA;AAAA;",
|
|
8
|
+
"debugId": "42C2425BDB34A12164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Mark {
|
|
2
|
+
type: string;
|
|
3
|
+
attrs?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
interface Node {
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
content?: Node[];
|
|
9
|
+
marks?: Mark[];
|
|
10
|
+
attrs?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface Adf extends Node {
|
|
13
|
+
version: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function adf2md(adf: Adf): string;
|
|
16
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adf2markdown",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist"
|
|
6
|
+
],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "bun build index.ts --outdir ./dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.json --declaration --declarationMap --emitDeclarationOnly --outDir dist",
|
|
17
|
+
"publish": "bun run build && bun publish",
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"lint": "oxlint",
|
|
20
|
+
"lint:fix": "oxlint --fix",
|
|
21
|
+
"format": "oxfmt",
|
|
22
|
+
"format:check": "oxfmt --check",
|
|
23
|
+
"prepare": "husky",
|
|
24
|
+
"typeCheck": "tsc --noEmit",
|
|
25
|
+
"knip": "knip"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/bun": "latest",
|
|
29
|
+
"husky": "^9.1.7",
|
|
30
|
+
"knip": "^5.83.1",
|
|
31
|
+
"oxfmt": "^0.32.0",
|
|
32
|
+
"oxlint": "^1.47.0",
|
|
33
|
+
"typescript": "^5.9.3"
|
|
34
|
+
}
|
|
35
|
+
}
|