@jacobbubu/md-zh-format 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jacob Bubu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,302 @@
1
+ # @jacobbubu/md-zh-format
2
+
3
+ [中文文档(简体)](./README_zh.md)
4
+
5
+ Format Markdown for Chinese-English mixed typography with a deterministic pipeline:
6
+
7
+ 1. Run Prettier on markdown body.
8
+ 2. Optionally promote headings to start from H1.
9
+ 3. Apply CJK mixed-layout normalization.
10
+ 4. Preserve frontmatter by default.
11
+
12
+ ## Quick Start
13
+
14
+ ### 1) Try without installing (npx)
15
+
16
+ ```bash
17
+ cat > demo.md <<'MD'
18
+ ---
19
+ title: 在Azure中部署3台VM
20
+ ---
21
+
22
+ ## 标题
23
+
24
+ 在Azure中部署3台VM。
25
+ MD
26
+
27
+ npx @jacobbubu/md-zh-format demo.md
28
+ ```
29
+
30
+ Expected output (excerpt):
31
+
32
+ ```md
33
+ ---
34
+ title: 在Azure中部署3台VM
35
+ ---
36
+
37
+ # 标题
38
+
39
+ 在 Azure 中部署 3 台 VM。
40
+ ```
41
+
42
+ ### 2) Safe workflow for real files
43
+
44
+ ```bash
45
+ # check-only mode (does not modify files)
46
+ md-zh-format docs/a.md docs/b.md --check
47
+
48
+ # apply changes in-place
49
+ md-zh-format docs/a.md docs/b.md --write
50
+ ```
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ # as project dependency
56
+ npm i @jacobbubu/md-zh-format
57
+ ```
58
+
59
+ Optional global install:
60
+
61
+ ```bash
62
+ npm i -g @jacobbubu/md-zh-format
63
+ ```
64
+
65
+ ## CLI
66
+
67
+ ```bash
68
+ md-zh-format <input.md> [options]
69
+ ```
70
+
71
+ ### Options
72
+
73
+ - `-w, --write`: overwrite input files in-place.
74
+ - `-o, --output <path>`: write output to a target file (single input only).
75
+ - `--check`: check-only mode, exits `1` when files would change.
76
+ - `--normalize-only`: run Prettier + mixed-layout rules, skip heading promotion.
77
+ - `--print-width <num>`: Prettier `printWidth` (default: `80`).
78
+ - `--prose-wrap <mode>`: Prettier `proseWrap` (`always | never | preserve`, default: `preserve`).
79
+ - `--tab-width <num>`: Prettier `tabWidth` (default: `2`).
80
+ - `--use-tabs` / `--no-use-tabs`: Prettier `useTabs` (default: `false`).
81
+ - `-h, --help`: show help.
82
+ - `-v, --version`: show version.
83
+
84
+ ### Common Commands
85
+
86
+ ```bash
87
+ # print formatted result to stdout
88
+ md-zh-format article.md
89
+
90
+ # overwrite one file
91
+ md-zh-format article.md --write
92
+
93
+ # write to a different file
94
+ md-zh-format article.md --output article.formatted.md
95
+
96
+ # check in CI
97
+ md-zh-format docs/a.md docs/b.md --check
98
+
99
+ # tune Prettier behavior before CJK normalization
100
+ md-zh-format article.md --print-width 100 --prose-wrap always --tab-width 4
101
+ ```
102
+
103
+ ### Exit Codes
104
+
105
+ - `0`: success. In `--check` mode, means no changes needed.
106
+ - `1`: `--check` mode only, formatting is required.
107
+ - `2`: invalid arguments or runtime error.
108
+
109
+ ## What Gets Changed
110
+
111
+ - Spaces between Han and Latin/number boundaries.
112
+ - Spaces between numbers and common units (`10Gbps -> 10 Gbps`).
113
+ - `%` and `°` remain attached to numbers (`15 % -> 15%`).
114
+ - Chinese-context quotes normalized to `“…”` / `‘…’`.
115
+ - Chinese-context parentheses normalized with the `English term (中文释义)` exception.
116
+ - Extra spaces around punctuation cleaned up.
117
+
118
+ ## What Is Preserved
119
+
120
+ - YAML frontmatter block is preserved by default.
121
+ - Markdown-sensitive segments are protected:
122
+ - fenced/indented code blocks
123
+ - inline code
124
+ - links/images
125
+ - URLs
126
+ - HTML tags / CommonMark HTML blocks
127
+ - math expressions
128
+ - Markdown hard-break trailing spaces (` `) are preserved.
129
+
130
+ ## API
131
+
132
+ ### Exports
133
+
134
+ - `formatMarkdownWithPrettier`
135
+ - `resolveMarkdownPrettierOptions`
136
+ - `DEFAULT_MARKDOWN_PRETTIER_OPTIONS`
137
+ - `normalizeChsEngLayout`
138
+ - `prettifyMarkdownContent`
139
+ - `prettifyMarkdownFile`
140
+ - `findEarliestHeadingTitle`
141
+
142
+ Types:
143
+
144
+ - `MarkdownPrettierOptions`
145
+ - `MarkdownPrettierProseWrap`
146
+ - `PrettifyOptions`
147
+ - `PrettifyResult`
148
+ - `FrontmatterData`
149
+
150
+ ### API Example
151
+
152
+ ```ts
153
+ import {
154
+ prettifyMarkdownContent,
155
+ type MarkdownPrettierOptions,
156
+ } from "@jacobbubu/md-zh-format";
157
+
158
+ const prettierOptions: MarkdownPrettierOptions = {
159
+ printWidth: 80,
160
+ proseWrap: "preserve",
161
+ tabWidth: 2,
162
+ useTabs: false,
163
+ };
164
+
165
+ const result = await prettifyMarkdownContent(
166
+ "---\n" + "title: Demo\n" + "---\n\n" + "## 在Azure中部署3台VM。\n",
167
+ "/tmp/demo.md",
168
+ {
169
+ prettier: prettierOptions,
170
+ preserveFrontmatter: true,
171
+ promoteHeadings: true,
172
+ },
173
+ );
174
+
175
+ console.log(result.prettifiedContent);
176
+ ```
177
+
178
+ ## Local Example Scripts
179
+
180
+ This repository includes runnable examples in `examples/basic`.
181
+
182
+ ```bash
183
+ # API example: read examples/basic/input.md and write examples/basic/output.md
184
+ npm run example:api
185
+
186
+ # CLI example against the same input file
187
+ npm run example:cli
188
+ ```
189
+
190
+ Files:
191
+
192
+ - [examples/basic/input.md](examples/basic/input.md)
193
+ - [examples/basic/api.ts](examples/basic/api.ts)
194
+
195
+ ## Agent Skill Support
196
+
197
+ This repository includes an LLM-callable skill package at `skills/md-zh-format`.
198
+
199
+ Key files:
200
+
201
+ - [skills/md-zh-format/SKILL.md](skills/md-zh-format/SKILL.md)
202
+ - [skills/md-zh-format/agents/openai.yaml](skills/md-zh-format/agents/openai.yaml)
203
+ - [skills/md-zh-format/scripts/format_markdown.sh](skills/md-zh-format/scripts/format_markdown.sh)
204
+
205
+ Install into Codex skill directory:
206
+
207
+ ```bash
208
+ mkdir -p "$CODEX_HOME/skills"
209
+ cp -R skills/md-zh-format "$CODEX_HOME/skills/md-zh-format"
210
+ ```
211
+
212
+ Then invoke it in agent prompts with `$md-zh-format`.
213
+
214
+ Validate skill behavior in this repository:
215
+
216
+ ```bash
217
+ # verify skill files + wrapper behavior (--check/--write/--check)
218
+ npm run verify:skill
219
+
220
+ # verify real claude trigger path
221
+ # prerequisite: local Claude CLI is installed and logged in
222
+ npm run verify:skill:claude
223
+
224
+ # run tests + wrapper verification
225
+ npm run verify:all
226
+
227
+ # run tests + wrapper verification + real Claude trigger verification
228
+ npm run verify:all:claude
229
+ ```
230
+
231
+ ## Development
232
+
233
+ ```bash
234
+ npm install
235
+ npm run build
236
+ npm test
237
+ ```
238
+
239
+ ## Code & Docs Formatting
240
+
241
+ Prettier is configured for code and documentation files.
242
+
243
+ ```bash
244
+ # format all supported files
245
+ npm run format
246
+
247
+ # check formatting
248
+ npm run format:check
249
+ ```
250
+
251
+ On commit, Husky `pre-commit` runs `lint-staged` to apply Prettier on staged files.
252
+
253
+ ## Release Automation (semantic-release)
254
+
255
+ This repository uses `semantic-release` for automated versioning and publishing.
256
+
257
+ ### Commit Convention
258
+
259
+ Use Conventional Commits:
260
+
261
+ - `feat:` triggers a minor release.
262
+ - `fix:` triggers a patch release.
263
+ - `perf:` triggers a patch release.
264
+ - `feat!:` / `fix!:` or `BREAKING CHANGE:` footer triggers a major release.
265
+ - `docs:`, `test:`, `chore:` usually do not publish a new version.
266
+
267
+ Examples:
268
+
269
+ ```text
270
+ feat(cli): add --normalize-only option
271
+ fix(prettify): preserve frontmatter raw block
272
+ feat!: drop Node 18 support
273
+ ```
274
+
275
+ ### Local Release Checks
276
+
277
+ ```bash
278
+ npm run commitlint
279
+ npm run format:staged
280
+ npm run release:dry-run
281
+ ```
282
+
283
+ ### GitHub Actions
284
+
285
+ - Release workflow: [.github/workflows/release.yml](.github/workflows/release.yml)
286
+ - Commit message lint workflow: [.github/workflows/commitlint.yml](.github/workflows/commitlint.yml)
287
+
288
+ ### Required Repository Setup
289
+
290
+ - npm package exists under `@jacobbubu/md-zh-format`.
291
+ - GitHub repository URL is `https://github.com/jacobbubu/md-zh-format.git`.
292
+ - Configure npm auth in CI:
293
+ - preferred: npm trusted publishing (OIDC)
294
+ - alternative: `NPM_TOKEN` in GitHub repository secrets
295
+ - `GITHUB_TOKEN` is provided by GitHub Actions.
296
+
297
+ Configuration files:
298
+
299
+ - [commitlint.config.cjs](commitlint.config.cjs)
300
+ - [.releaserc.cjs](.releaserc.cjs)
301
+ - [CHANGELOG.md](CHANGELOG.md)
302
+ - [.husky/commit-msg](.husky/commit-msg)
package/dist/cli.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import { type MarkdownPrettierOptions } from "./index.js";
3
+ export interface CliOptions {
4
+ inputPaths: string[];
5
+ write: boolean;
6
+ outputPath?: string;
7
+ check: boolean;
8
+ normalizeOnly: boolean;
9
+ prettier: MarkdownPrettierOptions;
10
+ help: boolean;
11
+ version: boolean;
12
+ }
13
+ export interface CliIo {
14
+ stdout: (text: string) => void;
15
+ stderr: (text: string) => void;
16
+ }
17
+ export declare function parseCliArgs(argv: string[]): CliOptions;
18
+ export declare function runCli(argv: string[], io?: CliIo): Promise<number>;
19
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAMA,OAAO,EAEL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAuDD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAkGvD;AAyBD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,KAAkB,GACrB,OAAO,CAAC,MAAM,CAAC,CAoFjB"}
package/dist/cli.js ADDED
@@ -0,0 +1,242 @@
1
+ #!/usr/bin/env node
2
+ import * as fs from "node:fs/promises";
3
+ import * as path from "node:path";
4
+ import { createRequire } from "node:module";
5
+ import process from "node:process";
6
+ import { fileURLToPath } from "node:url";
7
+ import { prettifyMarkdownContent, } from "./index.js";
8
+ const require = createRequire(import.meta.url);
9
+ const packageJson = require("../package.json");
10
+ const CLI_VERSION = packageJson.version ?? "0.0.0";
11
+ const ALLOWED_PROSE_WRAP = new Set([
12
+ "always",
13
+ "never",
14
+ "preserve",
15
+ ]);
16
+ const DEFAULT_IO = {
17
+ stdout: (text) => process.stdout.write(text),
18
+ stderr: (text) => process.stderr.write(text),
19
+ };
20
+ function parsePositiveInteger(rawValue, optionName) {
21
+ const parsed = Number.parseInt(rawValue, 10);
22
+ if (!Number.isInteger(parsed) || parsed <= 0) {
23
+ throw new Error(`${optionName} requires a positive integer.`);
24
+ }
25
+ return parsed;
26
+ }
27
+ function getOptionValue(argv, index, optionName) {
28
+ const value = argv[index + 1];
29
+ if (!value || value.startsWith("-")) {
30
+ throw new Error(`${optionName} requires a value.`);
31
+ }
32
+ return value;
33
+ }
34
+ function getHelpText() {
35
+ return [
36
+ "md-zh-format - Markdown formatter for Chinese-English mixed typography",
37
+ "",
38
+ "Usage:",
39
+ " md-zh-format <input.md> [options]",
40
+ " md-zh-format <a.md> <b.md> --write",
41
+ "",
42
+ "Options:",
43
+ " -w, --write Overwrite input files in-place",
44
+ " -o, --output <path> Write output to a target file (single input only)",
45
+ " --check Only check formatting changes (exit 1 if changed)",
46
+ " --normalize-only Run Prettier + mixed-layout rules, skip heading promotion",
47
+ " --print-width <num> Prettier printWidth (default: 80)",
48
+ " --prose-wrap <mode> Prettier proseWrap (always|never|preserve, default: preserve)",
49
+ " --tab-width <num> Prettier tabWidth (default: 2)",
50
+ " --use-tabs Prettier useTabs=true",
51
+ " --no-use-tabs Prettier useTabs=false (default: false)",
52
+ " -h, --help Show help",
53
+ " -v, --version Show version",
54
+ "",
55
+ "Behavior:",
56
+ " - Default pipeline: format body with Prettier, promote headings, then apply CJK layout rules",
57
+ " - Frontmatter is preserved as raw text by default",
58
+ " - Without --write/--output, result is printed to stdout",
59
+ ].join("\n");
60
+ }
61
+ export function parseCliArgs(argv) {
62
+ const options = {
63
+ inputPaths: [],
64
+ write: false,
65
+ check: false,
66
+ normalizeOnly: false,
67
+ prettier: {},
68
+ help: false,
69
+ version: false,
70
+ };
71
+ for (let i = 0; i < argv.length; i++) {
72
+ const arg = argv[i];
73
+ switch (arg) {
74
+ case "-h":
75
+ case "--help":
76
+ options.help = true;
77
+ break;
78
+ case "-v":
79
+ case "--version":
80
+ options.version = true;
81
+ break;
82
+ case "-w":
83
+ case "--write":
84
+ options.write = true;
85
+ break;
86
+ case "--check":
87
+ options.check = true;
88
+ break;
89
+ case "--normalize-only":
90
+ options.normalizeOnly = true;
91
+ break;
92
+ case "--print-width": {
93
+ const value = getOptionValue(argv, i, arg);
94
+ options.prettier.printWidth = parsePositiveInteger(value, arg);
95
+ i += 1;
96
+ break;
97
+ }
98
+ case "--prose-wrap": {
99
+ const value = getOptionValue(argv, i, arg);
100
+ if (!ALLOWED_PROSE_WRAP.has(value)) {
101
+ throw new Error(`${arg} must be one of: always, never, preserve.`);
102
+ }
103
+ options.prettier.proseWrap = value;
104
+ i += 1;
105
+ break;
106
+ }
107
+ case "--tab-width": {
108
+ const value = getOptionValue(argv, i, arg);
109
+ options.prettier.tabWidth = parsePositiveInteger(value, arg);
110
+ i += 1;
111
+ break;
112
+ }
113
+ case "--use-tabs":
114
+ options.prettier.useTabs = true;
115
+ break;
116
+ case "--no-use-tabs":
117
+ options.prettier.useTabs = false;
118
+ break;
119
+ case "-o":
120
+ case "--output": {
121
+ const value = getOptionValue(argv, i, arg);
122
+ options.outputPath = value;
123
+ i += 1;
124
+ break;
125
+ }
126
+ default:
127
+ if (arg.startsWith("-")) {
128
+ throw new Error(`Unknown option: ${arg}`);
129
+ }
130
+ options.inputPaths.push(arg);
131
+ break;
132
+ }
133
+ }
134
+ if (options.write && options.outputPath) {
135
+ throw new Error("--write and --output cannot be used together.");
136
+ }
137
+ if (options.check && (options.write || options.outputPath)) {
138
+ throw new Error("--check cannot be combined with --write or --output.");
139
+ }
140
+ if (options.outputPath && options.inputPaths.length !== 1) {
141
+ throw new Error("--output only supports a single input file.");
142
+ }
143
+ if (options.inputPaths.length > 1 &&
144
+ !options.write &&
145
+ !options.check &&
146
+ !options.outputPath) {
147
+ throw new Error("Multiple input files require --write or --check mode.");
148
+ }
149
+ return options;
150
+ }
151
+ async function formatOneFile(inputPath, normalizeOnly, prettierOptions) {
152
+ const absolutePath = path.resolve(inputPath);
153
+ const original = await fs.readFile(absolutePath, "utf-8");
154
+ const normalizedInput = original.replace(/\r\n/g, "\n");
155
+ const formatted = (await prettifyMarkdownContent(normalizedInput, absolutePath, {
156
+ prettier: prettierOptions,
157
+ promoteHeadings: !normalizeOnly,
158
+ })).prettifiedContent;
159
+ return {
160
+ absolutePath,
161
+ original: normalizedInput,
162
+ formatted,
163
+ };
164
+ }
165
+ export async function runCli(argv, io = DEFAULT_IO) {
166
+ let options;
167
+ try {
168
+ options = parseCliArgs(argv);
169
+ }
170
+ catch (error) {
171
+ const message = error instanceof Error ? error.message : String(error);
172
+ io.stderr(`Error: ${message}\n\n${getHelpText()}\n`);
173
+ return 2;
174
+ }
175
+ if (options.help) {
176
+ io.stdout(`${getHelpText()}\n`);
177
+ return 0;
178
+ }
179
+ if (options.version) {
180
+ io.stdout(`${CLI_VERSION}\n`);
181
+ return 0;
182
+ }
183
+ if (options.inputPaths.length === 0) {
184
+ io.stderr(`Error: missing input file path.\n\n${getHelpText()}\n`);
185
+ return 2;
186
+ }
187
+ const results = [];
188
+ for (const inputPath of options.inputPaths) {
189
+ try {
190
+ const formatted = await formatOneFile(inputPath, options.normalizeOnly, options.prettier);
191
+ results.push(formatted);
192
+ }
193
+ catch (error) {
194
+ const message = error instanceof Error ? error.message : String(error);
195
+ io.stderr(`Error: failed to process ${inputPath}: ${message}\n`);
196
+ return 2;
197
+ }
198
+ }
199
+ if (options.check) {
200
+ const changed = results.filter((item) => item.formatted !== item.original);
201
+ if (changed.length > 0) {
202
+ for (const item of changed) {
203
+ io.stdout(`${item.absolutePath}\n`);
204
+ }
205
+ return 1;
206
+ }
207
+ return 0;
208
+ }
209
+ if (options.write) {
210
+ for (const item of results) {
211
+ if (item.formatted === item.original) {
212
+ continue;
213
+ }
214
+ await fs.writeFile(item.absolutePath, item.formatted, "utf-8");
215
+ }
216
+ return 0;
217
+ }
218
+ if (options.outputPath) {
219
+ const firstResult = results[0];
220
+ if (!firstResult) {
221
+ return 2;
222
+ }
223
+ const outputPath = path.resolve(options.outputPath);
224
+ await fs.writeFile(outputPath, firstResult.formatted, "utf-8");
225
+ return 0;
226
+ }
227
+ const firstResult = results[0];
228
+ if (!firstResult) {
229
+ return 2;
230
+ }
231
+ io.stdout(firstResult.formatted);
232
+ return 0;
233
+ }
234
+ async function main() {
235
+ const exitCode = await runCli(process.argv.slice(2));
236
+ process.exitCode = exitCode;
237
+ }
238
+ const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : "";
239
+ if (invokedPath === fileURLToPath(import.meta.url)) {
240
+ void main();
241
+ }
242
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,uBAAuB,GAGxB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAyB,CAAC;AACvE,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AACnD,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAA4B;IAC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O,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzE,IAAI,WAAW,KAAK,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACnD,KAAK,IAAI,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { DEFAULT_MARKDOWN_PRETTIER_OPTIONS, formatMarkdownWithPrettier, normalizeChsEngLayout, prettifyMarkdownContent, prettifyMarkdownFile, resolveMarkdownPrettierOptions, findEarliestHeadingTitle, } from "./prettify/index.js";
2
+ export type { PrettifyResult, FrontmatterData, PrettifyOptions, MarkdownPrettierOptions, MarkdownPrettierProseWrap, } from "./prettify/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC9B,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { DEFAULT_MARKDOWN_PRETTIER_OPTIONS, formatMarkdownWithPrettier, normalizeChsEngLayout, prettifyMarkdownContent, prettifyMarkdownFile, resolveMarkdownPrettierOptions, findEarliestHeadingTitle, } from "./prettify/index.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC9B,wBAAwB,GACzB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function normalizeChsEngLayout(input: string): string;
2
+ //# sourceMappingURL=chs-eng-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chs-eng-layout.d.ts","sourceRoot":"","sources":["../../src/prettify/chs-eng-layout.ts"],"names":[],"mappings":"AA2fA,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3D"}