Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/format/docx/format-docx.ts
6450 views
1
/*
2
* format-docx.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
*/
7
8
import { kFilterParams } from "../../config/constants.ts";
9
import { Format } from "../../config/types.ts";
10
import { mergeConfigs } from "../../core/config.ts";
11
import { formatResourcePath } from "../../core/resources.ts";
12
import { createWordprocessorFormat } from "../formats-shared.ts";
13
14
const kIconCaution = "icon-caution";
15
const kIconImportant = "icon-important";
16
const kIconNote = "icon-note";
17
const kIconTip = "icon-tip";
18
const kIconWarning = "icon-warning";
19
20
export function docxFormat(): Format {
21
return mergeConfigs(
22
createWordprocessorFormat("MS Word", "docx"),
23
{
24
formatExtras: () => {
25
return {
26
[kFilterParams]: {
27
[kIconCaution]: iconPath("caution.png"),
28
[kIconImportant]: iconPath("important.png"),
29
[kIconNote]: iconPath("note.png"),
30
[kIconTip]: iconPath("tip.png"),
31
[kIconWarning]: iconPath("warning.png"),
32
},
33
};
34
},
35
extensions: {
36
book: {
37
selfContainedOutput: true,
38
},
39
},
40
},
41
);
42
}
43
44
function iconPath(icon: string) {
45
return formatResourcePath("docx", icon);
46
}
47
48