From 67a935ed47710569ced64591f75575bb5d5b342d Mon Sep 17 00:00:00 2001 From: syy11cn Date: Sun, 29 May 2022 19:12:43 +0800 Subject: [PATCH] feat(core): add headers and footers styles --- packages/core/package.json | 2 -- packages/core/src/config.ts | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 31fea36..f54aa6a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -24,8 +24,6 @@ }, "dependencies": { "docx": "^7.3.0", - "file-saver": "^2.0.5", - "image-size": "^1.0.1", "resolve-from": "^5.0.0", "yargs": "^17.4.1" } diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index e165001..4c16a4a 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -42,7 +42,7 @@ export const defaultConfig: IMarkdownReportConfig = { // Code. { id: StyleId.code, - name: StyleId.code, + name: StyleName.code, basedOn: StyleId.normal, run: { size: ptToHalfPt(10), @@ -62,6 +62,36 @@ export const defaultConfig: IMarkdownReportConfig = { alignment: AlignmentType.LEFT, }, }, + // Header. + { + id: StyleId.header, + name: StyleName.header, + basedOn: StyleId.normal, + run: { + size: ptToHalfPt(10.5), + }, + paragraph: { + indent: { + firstLine: 0, + }, + alignment: AlignmentType.CENTER, + spacing: { + after: 0, + line: lineHeightTimesToNumber(1), + }, + }, + }, + // Footer. + { + id: StyleId.footer, + name: StyleName.footer, + basedOn: StyleId.header, + paragraph: { + spacing: { + line: lineHeightTimesToNumber(3), + }, + }, + }, // Heading 1. { id: StyleId.h1, @@ -77,7 +107,7 @@ export const defaultConfig: IMarkdownReportConfig = { }, paragraph: { spacing: { - before: ptToTwip(30), + // before: ptToTwip(30), after: ptToTwip(30), }, alignment: AlignmentType.CENTER,