@cenk1cenk2/md-printer 2.15.18 → 2.16.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.
@@ -1,6 +1,5 @@
1
1
  import { RequiredTemplateFiles, TEMPLATE_DIRECTORY, TemplateFiles } from "../constants/template.constants.mjs";
2
2
  import { InputFileType, OutputFileType } from "../constants/file.constants.mjs";
3
- import "../constants/index.mjs";
4
3
  import tailwind from "@tailwindcss/postcss";
5
4
  import { watch } from "chokidar";
6
5
  import graymatter from "gray-matter";
@@ -29,13 +28,13 @@ var MDPrinter = class extends Command {
29
28
  char: "f",
30
29
  options: Object.values(InputFileType),
31
30
  description: "File type to be processed. By default it is detected by the file extension.",
32
- default: InputFileType.MARKDOWN
31
+ default: "md"
33
32
  }),
34
33
  ["output-filetype"]: Flags.string({
35
34
  char: "F",
36
35
  options: Object.values(OutputFileType),
37
36
  description: "File type to be processed. By default it is detected by the file extension.",
38
- default: OutputFileType.PDF
37
+ default: "pdf"
39
38
  }),
40
39
  stdout: Flags.boolean({
41
40
  char: "O",
@@ -99,14 +98,14 @@ var MDPrinter = class extends Command {
99
98
  ctx.content = await this.fs.read(ctx.file);
100
99
  } else ctx.content = this.flags.stdin;
101
100
  switch (this.flags["input-filetype"] ? this.flags["input-filetype"] : extname(ctx.file).replace(/^\./, "")) {
102
- case InputFileType.MARKDOWN: {
101
+ case "md": {
103
102
  const data = graymatter(ctx.content);
104
103
  ctx.content = data.content;
105
104
  ctx.metadata = data.data;
106
105
  break;
107
106
  }
108
- case InputFileType.YAML:
109
- case InputFileType.YAML_SHORT:
107
+ case "yaml":
108
+ case "yml":
110
109
  ctx.metadata = await this.app.get(ParserService).parse(ctx.file, ctx.content);
111
110
  break;
112
111
  default: throw new Error("File type is not accepted.");
@@ -120,42 +119,42 @@ var MDPrinter = class extends Command {
120
119
  if (!this.fs.exists(current)) throw new Error(`Template does not exists: ${current}`);
121
120
  }));
122
121
  const paths = {
123
- [TemplateFiles.SETTINGS]: join(ctx.templates, TemplateFiles.SETTINGS),
124
- [TemplateFiles.CSS]: join(ctx.templates, TemplateFiles.CSS),
125
- [TemplateFiles.TAILWIND_CSS]: join(ctx.templates, TemplateFiles.TAILWIND_CSS),
126
- [TemplateFiles.HEADER]: join(ctx.templates, TemplateFiles.HEADER),
127
- [TemplateFiles.FOOTER]: join(ctx.templates, TemplateFiles.FOOTER),
128
- [TemplateFiles.TEMPLATE]: join(ctx.templates, TemplateFiles.TEMPLATE)
122
+ ["settings.json"]: join(ctx.templates, "settings.json"),
123
+ ["main.css"]: join(ctx.templates, "main.css"),
124
+ ["tailwind.css"]: join(ctx.templates, "tailwind.css"),
125
+ ["header.html"]: join(ctx.templates, "header.html"),
126
+ ["footer.html"]: join(ctx.templates, "footer.html"),
127
+ ["template.html.j2"]: join(ctx.templates, "template.html.j2")
129
128
  };
130
- ctx.options = await this.cs.extend([paths[TemplateFiles.SETTINGS], {
129
+ ctx.options = await this.cs.extend([paths["settings.json"], {
131
130
  dest: this.args?.output ?? ctx.metadata?.dest ?? `${basename(this.args.file, extname(this.args.file))}.${this.flags["output-filetype"]}`,
132
131
  document_title: ctx.metadata?.document_title ?? this.flags.title ?? this.args.file,
133
132
  launch_options: { executablePath: this.flags.browser }
134
133
  }]);
135
134
  this.flags.stdout ??= ctx.metadata.stdout;
136
135
  if (this.flags.stdout) ctx.options.dest = "stdout";
137
- if (this.flags["output-filetype"] === OutputFileType.HTML || ctx.metadata["output-filetype"] === OutputFileType.HTML) ctx.options.as_html = true;
136
+ if (this.flags["output-filetype"] === "html" || ctx.metadata["output-filetype"] === "html") ctx.options.as_html = true;
138
137
  this.logger.debug("Options: %o", ctx.options);
139
- if (this.fs.exists(paths[TemplateFiles.HEADER])) {
138
+ if (this.fs.exists(paths["header.html"])) {
140
139
  this.logger.debug("Header exists for template.");
141
- ctx.options.pdf_options.headerTemplate = await this.fs.read(paths[TemplateFiles.HEADER]);
140
+ ctx.options.pdf_options.headerTemplate = await this.fs.read(paths["header.html"]);
142
141
  }
143
- if (this.fs.exists(paths[TemplateFiles.FOOTER])) {
142
+ if (this.fs.exists(paths["footer.html"])) {
144
143
  this.logger.debug("Footer exists for template.");
145
- ctx.options.pdf_options.footerTemplate = await this.fs.read(paths[TemplateFiles.FOOTER]);
144
+ ctx.options.pdf_options.footerTemplate = await this.fs.read(paths["footer.html"]);
146
145
  }
147
- if (this.fs.exists(paths[TemplateFiles.TEMPLATE])) {
146
+ if (this.fs.exists(paths["template.html.j2"])) {
148
147
  this.logger.debug("Design template exists for template.");
149
- ctx.template = await this.fs.read(paths[TemplateFiles.TEMPLATE]);
148
+ ctx.template = await this.fs.read(paths["template.html.j2"]);
150
149
  this.logger.debug("Metadata: %o", ctx.metadata);
151
150
  }
152
- if (this.fs.exists(paths[TemplateFiles.CSS])) {
151
+ if (this.fs.exists(paths["main.css"])) {
153
152
  this.logger.debug("CSS exists for template.");
154
- ctx.options.css = await this.fs.read(paths[TemplateFiles.CSS]);
153
+ ctx.options.css = await this.fs.read(paths["main.css"]);
155
154
  }
156
- if (this.fs.exists(paths[TemplateFiles.TAILWIND_CSS])) {
157
- this.logger.debug("Tailwind CSS exists for template: %s -> %s", paths[TemplateFiles.TAILWIND_CSS]);
158
- ctx.options.css = await postcss([tailwind({ base: ctx.templates })]).process(await this.fs.read(paths[TemplateFiles.TAILWIND_CSS]), { from: paths[TemplateFiles.TAILWIND_CSS] }).then((result) => result.css);
155
+ if (this.fs.exists(paths["tailwind.css"])) {
156
+ this.logger.debug("Tailwind CSS exists for template: %s -> %s", paths["tailwind.css"]);
157
+ ctx.options.css = await postcss([tailwind({ base: ctx.templates })]).process(await this.fs.read(paths["tailwind.css"]), { from: paths["tailwind.css"] }).then((result) => result.css);
159
158
  }
160
159
  } }]);
161
160
  }
@@ -8,7 +8,7 @@ let TemplateFiles = /* @__PURE__ */ function(TemplateFiles) {
8
8
  TemplateFiles["SETTINGS"] = "settings.json";
9
9
  return TemplateFiles;
10
10
  }({});
11
- const RequiredTemplateFiles = [TemplateFiles.SETTINGS];
11
+ const RequiredTemplateFiles = ["settings.json"];
12
12
  const TEMPLATE_DIRECTORY = "templates";
13
13
 
14
14
  //#endregion
@@ -151,5 +151,5 @@
151
151
  "enableJsonFlag": false
152
152
  }
153
153
  },
154
- "version": "2.15.17"
154
+ "version": "2.15.20"
155
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/md-printer",
3
- "version": "2.15.18",
3
+ "version": "2.16.0",
4
4
  "description": "A markdown printer.",
5
5
  "module": "dist/index.mjs",
6
6
  "type": "module",
@@ -85,34 +85,33 @@
85
85
  "md-to-pdf": "^5.2.5",
86
86
  "nunjucks": "^3.2.4",
87
87
  "postcss": "^8.5.8",
88
- "puppeteer": "^24.38.0",
88
+ "puppeteer": "^24.39.0",
89
89
  "showdown": "^2.1.0",
90
90
  "source-map-support": "^0.5.21",
91
91
  "tailwindcss": "^4.2.1",
92
92
  "yaml": "^2.8.2"
93
93
  },
94
94
  "devDependencies": {
95
- "@cenk1cenk2/cz-cc": "^2.2.9",
96
- "@cenk1cenk2/eslint-config": "^3.2.2",
95
+ "@cenk1cenk2/cz-cc": "^2.2.14",
96
+ "@cenk1cenk2/eslint-config": "^3.2.3",
97
97
  "@tsconfig/node24": "^24.0.4",
98
- "@types/config": "^3.3.5",
99
98
  "@types/fs-extra": "^11.0.4",
100
- "@types/node": "^24.12.0",
99
+ "@types/node": "^24.12.2",
101
100
  "@types/nunjucks": "^3.2.6",
102
101
  "@types/showdown": "^2.0.6",
103
- "eslint": "^10.0.3",
102
+ "eslint": "^10.2.1",
104
103
  "execa": "^9.6.1",
105
- "globby": "^16.1.1",
106
- "lint-staged": "^16.3.2",
107
- "oclif": "^4.22.87",
108
- "prettier": "^3.8.1",
104
+ "globby": "^16.2.0",
105
+ "lint-staged": "^16.4.0",
106
+ "oclif": "^4.23.0",
107
+ "prettier": "^3.8.3",
109
108
  "prettier-plugin-jinja-template": "^2.1.0",
110
109
  "simple-git-hooks": "^2.13.1",
111
110
  "theme-colors": "^0.1.0",
112
111
  "tpm": "^1.4.14",
113
112
  "ts-node": "^10.9.2",
114
113
  "tsconfig-paths": "^4.2.0",
115
- "tsdown": "^0.21.1",
114
+ "tsdown": "^0.21.10",
116
115
  "typescript": "^5.9.3"
117
116
  },
118
117
  "config": {
@@ -120,5 +119,5 @@
120
119
  "path": "./node_modules/@cenk1cenk2/cz-cc"
121
120
  }
122
121
  },
123
- "packageManager": "pnpm@10.32.0"
122
+ "packageManager": "pnpm@10.33.2"
124
123
  }
@@ -1,5 +1,5 @@
1
1
  @import url(https://unpkg.com/github-markdown-css/github-markdown-light.css);
2
- @import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@400);
2
+ @import url('https://fonts.bunny.net/css?family=montserrat:100,200,300,400,500,600,700,800,900&display=swap');
3
3
  @import url(https://fonts.googleapis.com/css2?family=Roboto+Mono);
4
4
 
5
5
  .markdown-body {
@@ -7,6 +7,20 @@
7
7
  font-family: 'Montserrat', sans-serif;
8
8
  }
9
9
 
10
+ .markdown-body h1,
11
+ .markdown-body h2 {
12
+ font-weight: 800;
13
+ }
14
+
15
+ .markdown-body h3,
16
+ .markdown-body h4,
17
+ .markdown-body h5,
18
+ .markdown-body h6,
19
+ .markdown-body strong,
20
+ .markdown-body b {
21
+ font-weight: 700;
22
+ }
23
+
10
24
  .page-break {
11
25
  page-break-after: always;
12
26
  }
@@ -1,11 +1,14 @@
1
+ @import url('https://fonts.bunny.net/css?family=montserrat:100,200,300,400,500,600,700,800,900&display=swap');
2
+
1
3
  @import 'tailwindcss';
2
4
  @plugin '@tailwindcss/typography';
3
5
 
4
- @import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@400) layer(utilities);
5
-
6
6
  @theme {
7
- --font-family-sans: Montserrat;
8
- --font-family-serif: Montserrat;
7
+ --font-sans: 'Montserrat';
8
+ --font-serif: 'Montserrat';
9
+ --font-weight-semibold: 700;
10
+ --font-weight-bold: 800;
11
+ --font-weight-extrabold: 900;
9
12
  --color-primary-500: #cd0043;
10
13
  --color-gray-50: oklch(98.5% 0.002 247.839);
11
14
  --color-gray-100: #abb2bf;
@@ -28,6 +31,10 @@
28
31
  border-color: var(--color-gray-200, currentcolor);
29
32
  }
30
33
 
34
+ body {
35
+ font-family: var(--font-sans);
36
+ }
37
+
31
38
  address {
32
39
  @apply text-sm;
33
40
  }
@@ -38,7 +45,7 @@ address {
38
45
  }
39
46
 
40
47
  .prose h1 {
41
- font-weight: 700;
48
+ font-weight: 800;
42
49
  padding-top: 0.1875rem;
43
50
  /* 0.75 * 0.25rem */
44
51
  padding-bottom: 0.1875rem;
@@ -48,6 +55,7 @@ address {
48
55
  }
49
56
 
50
57
  .prose h2 {
58
+ font-weight: 800;
51
59
  padding-top: 0.125rem;
52
60
  /* 0.5 * 0.25rem */
53
61
  padding-bottom: 0.125rem;
@@ -57,6 +65,7 @@ address {
57
65
  }
58
66
 
59
67
  .prose h3 {
68
+ font-weight: 700;
60
69
  padding-top: 0.0625rem;
61
70
  /* 0.25 * 0.25rem */
62
71
  padding-bottom: 0.0625rem;
@@ -1,5 +1,6 @@
1
+ @import url('https://fonts.bunny.net/css?family=montserrat:100,200,300,400,500,600,700,800,900&display=swap');
2
+
1
3
  @import url(https://unpkg.com/github-markdown-css/github-markdown-light.css);
2
- @import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@400);
3
4
  @import url(https://fonts.googleapis.com/css2?family=Roboto+Mono);
4
5
 
5
6
  .markdown-body {
@@ -7,6 +8,20 @@
7
8
  font-family: 'Montserrat', sans-serif;
8
9
  }
9
10
 
11
+ .markdown-body h1,
12
+ .markdown-body h2 {
13
+ font-weight: 800;
14
+ }
15
+
16
+ .markdown-body h3,
17
+ .markdown-body h4,
18
+ .markdown-body h5,
19
+ .markdown-body h6,
20
+ .markdown-body strong,
21
+ .markdown-body b {
22
+ font-weight: 700;
23
+ }
24
+
10
25
  .page-break {
11
26
  page-break-after: always;
12
27
  }
@@ -1,7 +1,14 @@
1
+ @import url('https://fonts.bunny.net/css?family=montserrat:100,200,300,400,500,600,700,800,900&display=swap');
2
+
1
3
  @import 'tailwindcss';
2
4
  @plugin '@tailwindcss/typography';
3
5
 
4
6
  @theme {
7
+ --font-sans: 'Montserrat';
8
+ --font-serif: 'Montserrat';
9
+ --font-weight-semibold: 700;
10
+ --font-weight-bold: 800;
11
+ --font-weight-extrabold: 900;
5
12
  --color-primary-500: #cd0043;
6
13
  --color-gray-50: oklch(98.5% 0.002 247.839);
7
14
  --color-gray-100: #abb2bf;
@@ -24,6 +31,10 @@
24
31
  border-color: var(--color-gray-200, currentcolor);
25
32
  }
26
33
 
34
+ body {
35
+ font-family: var(--font-sans);
36
+ }
37
+
27
38
  address {
28
39
  @apply text-sm;
29
40
  }
@@ -34,7 +45,7 @@ address {
34
45
  }
35
46
 
36
47
  .prose h1 {
37
- font-weight: 700;
48
+ font-weight: 800;
38
49
  padding-top: 0.1875rem;
39
50
  /* 0.75 * 0.25rem */
40
51
  padding-bottom: 0.1875rem;
@@ -44,6 +55,7 @@ address {
44
55
  }
45
56
 
46
57
  .prose h2 {
58
+ font-weight: 800;
47
59
  padding-top: 0.125rem;
48
60
  /* 0.5 * 0.25rem */
49
61
  padding-bottom: 0.125rem;
@@ -53,6 +65,7 @@ address {
53
65
  }
54
66
 
55
67
  .prose h3 {
68
+ font-weight: 700;
56
69
  padding-top: 0.0625rem;
57
70
  /* 0.25 * 0.25rem */
58
71
  padding-bottom: 0.0625rem;
@@ -19,7 +19,7 @@ module.exports = {
19
19
  textDecoration: 'none'
20
20
  },
21
21
  h1: {
22
- fontWeight: 700,
22
+ fontWeight: 800,
23
23
  paddingTop: theme('padding.0.75'),
24
24
  paddingBottom: theme('padding.0.75'),
25
25
  marginBottom: 0,
@@ -1,9 +1,19 @@
1
- @import 'tailwindcss';
1
+ @import url('https://fonts.bunny.net/css?family=montserrat:100,200,300,400,500,600,700,800,900&display=swap');
2
2
 
3
- @import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@400) layer(utilities);
3
+ @import 'tailwindcss';
4
4
 
5
5
  @config './tailwind.config.cjs';
6
6
 
7
+ @theme {
8
+ --font-weight-semibold: 700;
9
+ --font-weight-bold: 800;
10
+ --font-weight-extrabold: 900;
11
+ }
12
+
13
+ body {
14
+ font-family: 'Montserrat';
15
+ }
16
+
7
17
  /*
8
18
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
9
19
  so we've added these compatibility styles to make sure everything still