@dogsbay/format-mkdocs 0.2.0-beta.152 → 0.2.0-beta.154

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/dist/cli.js CHANGED
@@ -80,8 +80,9 @@ export const plugin = {
80
80
  const root = mount.root ?? "_assets";
81
81
  const dest = mount.into ? join(output, "docs", root, mount.into) : join(output, "docs", root);
82
82
  mkdirSync(dest, { recursive: true });
83
+ const skipped = new Set((mount.skip ?? []).map((f) => join(mount.dir, f)));
83
84
  if (mount.mediaOnly) {
84
- copyMediaTree(mount.dir, dest);
85
+ copyMediaTree(mount.dir, dest, skipped);
85
86
  continue;
86
87
  }
87
88
  // Skip symlinks rather than copy them: relative links are rewritten to
@@ -90,7 +91,7 @@ export const plugin = {
90
91
  cpSync(mount.dir, dest, {
91
92
  recursive: true,
92
93
  dereference: false,
93
- filter: (src) => !lstatSync(src).isSymbolicLink(),
94
+ filter: (src) => !skipped.has(src) && !lstatSync(src).isSymbolicLink(),
94
95
  });
95
96
  }
96
97
  // Co-located media next to the markdown (the mkdocs shape itself).
@@ -108,15 +109,17 @@ const MEDIA_EXT = new Set([".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".a
108
109
  * symlink: AsciiBinder corpora symlink every section back to one images
109
110
  * tree, and following them copied a 64 MB tree once per link.
110
111
  */
111
- function copyMediaTree(from, to) {
112
+ function copyMediaTree(from, to, skip) {
112
113
  for (const entry of readdirSync(from, { withFileTypes: true })) {
113
114
  if (entry.isSymbolicLink())
114
115
  continue;
115
116
  const src = join(from, entry.name);
117
+ if (skip?.has(src))
118
+ continue;
116
119
  if (entry.isDirectory()) {
117
120
  if (entry.name === "node_modules" || entry.name.startsWith("."))
118
121
  continue;
119
- copyMediaTree(src, join(to, entry.name));
122
+ copyMediaTree(src, join(to, entry.name), skip);
120
123
  continue;
121
124
  }
122
125
  if (!MEDIA_EXT.has(extname(entry.name).toLowerCase()))
package/dist/walker.js CHANGED
@@ -16,9 +16,12 @@ export function tokensToTree(tokens) {
16
16
  }
17
17
  // Open tokens: collect children until matching close
18
18
  if (token.nesting === 1) {
19
+ const at = pos;
19
20
  pos++;
20
21
  const node = openTokenToNode(token);
21
22
  node.children = walk();
23
+ if (token.type === "ordered_list_open")
24
+ orderedListNumbers(tokens, at, node);
22
25
  nodes.push(node);
23
26
  continue;
24
27
  }
@@ -32,6 +35,29 @@ export function tokensToTree(tokens) {
32
35
  }
33
36
  return walk();
34
37
  }
38
+ /**
39
+ * An ordered list's start, and whether the source wrote the same number on every item
40
+ * (`1.` `1.` `1.`), which the Dogsbay MD serializer keeps (`meta.sameNumbers`, 2026-11-01).
41
+ */
42
+ function orderedListNumbers(tokens, at, node) {
43
+ const open = tokens[at];
44
+ const start = Number(open.attrGet("start") ?? 1);
45
+ if (Number.isFinite(start) && start !== 1)
46
+ node.props = { ...node.props, start };
47
+ const numbers = new Set();
48
+ let items = 0;
49
+ for (let i = at + 1; i < tokens.length; i++) {
50
+ const t = tokens[i];
51
+ if (t.level === open.level && t.type === "ordered_list_close")
52
+ break;
53
+ if (t.level === open.level + 1 && t.type === "list_item_open") {
54
+ items++;
55
+ numbers.add(t.info);
56
+ }
57
+ }
58
+ if (items > 1 && numbers.size === 1)
59
+ node.meta = { ...node.meta, sameNumbers: true };
60
+ }
35
61
  function openTokenToNode(token) {
36
62
  switch (token.type) {
37
63
  case "admonition_open":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/format-mkdocs",
3
- "version": "0.2.0-beta.152",
3
+ "version": "0.2.0-beta.154",
4
4
  "description": "MkDocs format plugin for Dogsbay — import/export MkDocs projects via TreeNode[]",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,10 +46,10 @@
46
46
  "markdown-it-deflist": "^3.0.1",
47
47
  "nunjucks": "^3.2.4",
48
48
  "yaml": "^2.9.0",
49
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.152",
50
- "@dogsbay/serialize-core": "0.2.0-beta.152",
51
- "@dogsbay/autodoc-python": "0.2.0-beta.152",
52
- "@dogsbay/types": "0.2.0-beta.152"
49
+ "@dogsbay/autodoc-python": "0.2.0-beta.154",
50
+ "@dogsbay/serialize-core": "0.2.0-beta.154",
51
+ "@dogsbay/types": "0.2.0-beta.154",
52
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.154"
53
53
  },
54
54
  "repository": {
55
55
  "type": "git",