-
-
Notifications
You must be signed in to change notification settings - Fork 592
Open
Description
Context
This becomes handy when we want to transform a LaTeX, AsciiDoc, etc. document into docx.
Example:
// Parser
function parse(input: string) : Paragraph[] {
// ...
return [
new Paragraph({
children: "..."
})
]
}
// Later
const paras = parse(`
Hello
World!
`);
const mapped = paras.flatMap(p => {
return p.map({
indent: { left: 720, right: 720 },
spacing: { before: 240, after: 120 },
alignment: AlignmentType.RIGHT,
})
});Right now Paragraphs are "immutable" in TypeScript and accomplishing this needs casting to any:
const result = parseToParagraphs(body).map((par) => {
const runs = (par as any).root;
return new Paragraph({
indent: { left: 720, right: 720 },
spacing: { before: 240, after: 120 },
children: runs,
});
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels