@helping-ai-workflow/md2doc 3.7.0 → 3.9.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/README.md CHANGED
@@ -74,9 +74,14 @@ also pass `--open`.
74
74
  | `--no-open` | Skip the viewer launch. |
75
75
  | `--quiet` | Suppress per-file progress messages. |
76
76
  | `--bake-svg` | Pre-render Mermaid / WaveDrom to inert SVG at generation time (HTML output only; needs Chromium). The output then contains no diagram JavaScript. |
77
+ | `--lang <tag>` | Set `<html lang>` (for example `en`, `zh-Hant`). Default: detected — `zh-Hant` when Chinese characters are at least 10% of the prose (code excluded), `ja` / `ko` when kana / Hangul make up at least 20% of the CJK characters, otherwise `en`. |
77
78
  | `--version`, `-v` | Print version. |
78
79
  | `--help`, `-h` | Print help. |
79
80
 
81
+ ### Reading view
82
+
83
+ - **Dark mode** — a ☀/☾ toggle (bottom-right on desktop, top bar on phone). Light by default; the choice is remembered in the browser. PDF and print stay light.
84
+
80
85
  ### Images
81
86
 
82
87
  Local images referenced from the markdown are resolved against the **markdown file's own
@@ -42,3 +42,24 @@ turndown, `@hpcc-js/wasm-graphviz`) are ordinary npm packages: they are
42
42
  resolved into your `node_modules` by your own installer, carry their own
43
43
  licence files there, and are not redistributed inside md2doc's tarball.
44
44
  They are out of scope for this file.
45
+
46
+ ## Lucide (icon path data)
47
+
48
+ The sidebar icons in `lib/md2doc.js` (`READER_ICONS`) use path data from
49
+ Lucide, https://lucide.dev — ISC License.
50
+
51
+ Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part
52
+ of Feather (MIT). All other copyright (c) for Lucide are held by Lucide
53
+ Contributors 2022.
54
+
55
+ Permission to use, copy, modify, and/or distribute this software for any
56
+ purpose with or without fee is hereby granted, provided that the above
57
+ copyright notice and this permission notice appear in all copies.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
60
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
61
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
62
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
63
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
64
+ OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
65
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/bin/md2doc.js CHANGED
@@ -32,6 +32,7 @@ function printHelp() {
32
32
  ' --open Launch the platform viewer after render (default when --out is absent).',
33
33
  ' --no-open Skip the viewer launch.',
34
34
  ' --quiet Suppress per-file progress messages.',
35
+ ' --lang <tag> Set <html lang> (default: detected — zh-Hant for Chinese-heavy text, ja / ko for Japanese / Korean, else en).',
35
36
  ' --bake-svg Pre-render mermaid/wavedrom to inert SVG (HTML output only; needs Chromium).',
36
37
  ' --edit Serve listed .md files in the browser editor (localhost).',
37
38
  ' --port <n> Pin the editor server port (only with --edit).',
@@ -51,6 +52,7 @@ function parseArgs(argv) {
51
52
  let bakeSvg = false;
52
53
  let edit = false;
53
54
  let port = null;
55
+ let lang = null;
54
56
 
55
57
  for (let i = 0; i < argv.length; i++) {
56
58
  const a = argv[i];
@@ -96,6 +98,19 @@ function parseArgs(argv) {
96
98
  out = argv[i];
97
99
  continue;
98
100
  }
101
+ if (a === '--lang') {
102
+ i++;
103
+ if (i >= argv.length) {
104
+ process.stderr.write('error: --lang requires a value\n');
105
+ process.exit(2);
106
+ }
107
+ if (!/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(argv[i])) {
108
+ process.stderr.write('error: --lang must be a language tag such as en or zh-Hant\n');
109
+ process.exit(2);
110
+ }
111
+ lang = argv[i];
112
+ continue;
113
+ }
99
114
  if (a.startsWith('-')) {
100
115
  process.stderr.write('error: unknown flag ' + a + '\n');
101
116
  process.exit(2);
@@ -124,7 +139,7 @@ function parseArgs(argv) {
124
139
  open = (out === null);
125
140
  }
126
141
 
127
- return { inputs, formats, formatsExplicit, out, open, quiet, bakeSvg, edit, port };
142
+ return { inputs, formats, formatsExplicit, out, open, quiet, bakeSvg, edit, port, lang };
128
143
  }
129
144
 
130
145
  function shortHash(absPath) {
@@ -232,8 +247,8 @@ function main() {
232
247
  }
233
248
 
234
249
  if (args.edit) {
235
- if (args.formatsExplicit || args.out !== null || args.bakeSvg) {
236
- process.stderr.write('error: --edit cannot be combined with --html/--pdf/--out/--bake-svg\n');
250
+ if (args.formatsExplicit || args.out !== null || args.bakeSvg || args.lang !== null) {
251
+ process.stderr.write('error: --edit cannot be combined with --html/--pdf/--out/--bake-svg/--lang\n');
237
252
  process.exit(2);
238
253
  }
239
254
  for (const input of args.inputs) {
@@ -262,6 +277,7 @@ function main() {
262
277
  const stdio = args.quiet ? ['inherit', 'ignore', 'inherit'] : 'inherit';
263
278
  const childArgs = [LIB, input, output];
264
279
  if (args.bakeSvg) childArgs.push('--bake-svg');
280
+ if (args.lang) childArgs.push('--lang=' + args.lang);
265
281
  const r = spawnSync(process.execPath, childArgs, { stdio });
266
282
  if (r.status !== 0) {
267
283
  process.stderr.write('error: render failed for ' + input + ' (exit ' + r.status + ')\n');
@@ -12823,7 +12823,8 @@
12823
12823
  // S4 Task 2b (user request, 2026-09-01): the ONLY feedback the source
12824
12824
  // block gets. `.ed-handle` is `opacity: 0` off-hover, so from the moment
12825
12825
  // the pointer leaves the block there is nothing under the cursor but the
12826
- // indicator line. The ruling is a `cursor: grabbing` class on
12826
+ // indicator line. The ruling is a drag-cursor class (`cursor: move`; v3.8.1
12827
+ // dropped `grabbing`, a browser bitmap on Windows) on
12827
12828
  // `document.documentElement` — OUTSIDE `contentEl`, so the "mutate
12828
12829
  // nothing in the content DOM during a drag" invariant this whole gesture
12829
12830
  // rests on still holds, and every cancellation path stays unconditional.
@@ -13578,7 +13579,7 @@
13578
13579
  if (tePointer.hit.kind === 'row') {
13579
13580
  // The column grip hides like the insert bubbles above (it isn't
13580
13581
  // meaningful mid row-drag); the ROW grip stays visible and switches
13581
- // to its "dragging" visual (grabbing cursor) — it IS the drag
13582
+ // to its "dragging" visual (move cursor) — it IS the drag
13582
13583
  // handle the user is holding, per the brief ("the active grip may
13583
13584
  // stay as the drag handle visual").
13584
13585
  colGrip.hidden = true;