adf2markdown 1.1.0 → 1.1.2
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/dist/index.d.ts +1 -0
- package/dist/index.js +134 -0
- package/dist/index.js.map +10 -0
- package/dist/src/adf2markdown.d.ts +16 -0
- package/dist/src/adf2markdown.test.d.ts +1 -0
- package/package.json +2 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { adf2markdown, type Adf } from "./src/adf2markdown";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/adf2markdown.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 adf2markdown(adf) {
|
|
124
|
+
return renderNode(adf, { join: `
|
|
125
|
+
|
|
126
|
+
`, ancestors: [], siblings: [] }) + `
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
adf2markdown
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
//# debugId=18C31A676A58776064756E2164756E21
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/adf2markdown.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 adf2markdown(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,EAC9E,OAAO,mBAAmB,MAAM,SAAS,WAAW,EAAE,KAAK,QAAQ,IAAI;AAAA;AAKzE,IAAM,cAA0C;AAAA,EAC9C,QAAQ,CAAC,SAAS,KAAK;AAAA,EACvB,IAAI,CAAC,SAAS,IAAI;AAAA,EAClB,QAAQ,CAAC,SAAS,KAAK;AAAA,EACvB,MAAM,CAAC,SAAS,KAAK;AAAA,EACrB,WAAW,CAAC,SAAS,MAAM;AAAA,EAC3B,MAAM,CAAC,MAAM,SAAS,IAAI,SAAS,KAAK,OAA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AAI,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,YAAY,CAAC,KAAkB;AAAA,EAC7C,OAAO,WAAW,KAAK,EAAE,MAAM;AAAA;AAAA,GAAQ,WAAW,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,IAAI;AAAA;AAAA;",
|
|
8
|
+
"debugId": "18C31A676A58776064756E2164756E21",
|
|
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 adf2markdown(adf: Adf): string;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adf2markdown",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"adf",
|
|
6
6
|
"atlassian",
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"default": "./dist/index.js"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "bun build index.ts --outdir ./dist --format esm --target node --sourcemap=linked && tsc
|
|
29
|
-
"publish": "bun run build && bun publish",
|
|
28
|
+
"build": "bun build index.ts --outdir ./dist --format esm --target node --sourcemap=linked && tsc --declaration --emitDeclarationOnly --outDir dist --noEmit false",
|
|
30
29
|
"check": "bun audit && bun run format:check && bun run knip && bun run lint && bun run typeCheck && bun test",
|
|
31
30
|
"test": "bun test",
|
|
32
31
|
"lint": "oxlint",
|