create-thally-docs 0.10.54 → 0.10.55

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.
@@ -144,56 +144,54 @@ function addOrphanToNav(projectDir, pageId) {
144
144
  }
145
145
  }
146
146
  var EXPLICIT_ID_ATTRIBUTE = /\bid=(?:"([^"]*)"|'([^']*)'|\{["']([^"'}]*)["']\})/g;
147
+ function forEachNonFencedLine(content, visit) {
148
+ let fence;
149
+ for (const [index, line] of content.split("\n").entries()) {
150
+ const marker = line.match(/^ {0,3}(`{3,}|~{3,})/);
151
+ if (marker) {
152
+ if (!fence) fence = marker[1];
153
+ else if (marker[1][0] === fence[0] && marker[1].length >= fence.length && /^\s*$/.test(line.slice(marker[0].length))) fence = void 0;
154
+ continue;
155
+ }
156
+ if (!fence) visit(line, index + 1);
157
+ }
158
+ }
147
159
  function extractHeadingAnchors(content) {
148
160
  const anchors = /* @__PURE__ */ new Set();
149
- for (const line of content.split("\n")) {
161
+ forEachNonFencedLine(content, (line) => {
150
162
  const heading = /^ {0,3}#{1,6}\s+(.+?)\s*#*\s*$/.exec(line);
151
163
  if (heading) anchors.add(slugify(heading[1]));
152
164
  for (const idMatch of line.matchAll(EXPLICIT_ID_ATTRIBUTE)) {
153
165
  const id = idMatch[1] ?? idMatch[2] ?? idMatch[3];
154
166
  if (id) anchors.add(id);
155
167
  }
156
- }
168
+ });
157
169
  return anchors;
158
170
  }
159
171
  function extractLinks(content) {
160
172
  const links = [];
161
- const lines = content.split("\n");
162
- let inFence = false;
163
- for (let i = 0; i < lines.length; i++) {
164
- if (/^\s*(```|~~~)/.test(lines[i])) {
165
- inFence = !inFence;
166
- continue;
167
- }
168
- if (inFence) continue;
169
- const line = lines[i].replace(/`[^`]*`/g, "");
173
+ forEachNonFencedLine(content, (rawLine, lineNumber) => {
174
+ const line = rawLine.replace(/`[^`]*`/g, "");
170
175
  for (const m of line.matchAll(/\[[^\]]*\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g)) {
171
- links.push({ target: m[1], line: i + 1 });
176
+ links.push({ target: m[1], line: lineNumber });
172
177
  }
173
178
  for (const m of line.matchAll(/href=["']([^"']+)["']/g)) {
174
- links.push({ target: m[1], line: i + 1 });
179
+ links.push({ target: m[1], line: lineNumber });
175
180
  }
176
- }
181
+ });
177
182
  return links;
178
183
  }
179
184
  function extractImageRefs(content) {
180
185
  const refs = [];
181
- const lines = content.split("\n");
182
- let inFence = false;
183
- for (let i = 0; i < lines.length; i++) {
184
- if (/^\s*(```|~~~)/.test(lines[i])) {
185
- inFence = !inFence;
186
- continue;
187
- }
188
- if (inFence) continue;
189
- const line = lines[i].replace(/`[^`]*`/g, "");
186
+ forEachNonFencedLine(content, (rawLine, lineNumber) => {
187
+ const line = rawLine.replace(/`[^`]*`/g, "");
190
188
  for (const m of line.matchAll(/!\[[^\]]*\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g)) {
191
- refs.push({ target: m[1], line: i + 1 });
189
+ refs.push({ target: m[1], line: lineNumber });
192
190
  }
193
191
  for (const m of line.matchAll(/\bsrc=["']([^"']+)["']/g)) {
194
- refs.push({ target: m[1], line: i + 1 });
192
+ refs.push({ target: m[1], line: lineNumber });
195
193
  }
196
- }
194
+ });
197
195
  return refs;
198
196
  }
199
197
  function localizedPage(pageId, secondaryLocales) {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  migrateDocs,
4
4
  parseFrontmatter,
5
5
  runCheck
6
- } from "./chunk-TMTI2OT6.js";
6
+ } from "./chunk-PJXWW3KP.js";
7
7
  import {
8
8
  logo,
9
9
  scaffold,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  migrateDocs
4
- } from "../chunk-TMTI2OT6.js";
4
+ } from "../chunk-PJXWW3KP.js";
5
5
  import "../chunk-D5MH737V.js";
6
6
  import "../chunk-XYRM4GAT.js";
7
7
  import "../chunk-WH4YY5EW.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-thally-docs",
3
- "version": "0.10.54",
3
+ "version": "0.10.55",
4
4
  "description": "Scaffold an open-source Thally docs site for people, search engines, and AI tools.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -45,7 +45,7 @@
45
45
  "@anthropic-ai/sdk": "^0.36.0",
46
46
  "@inquirer/prompts": "^7.0.0",
47
47
  "@thallylabs/core": "0.2.8",
48
- "@thallylabs/migrate": "0.2.7",
48
+ "@thallylabs/migrate": "0.2.8",
49
49
  "p-limit": "^6.1.0",
50
50
  "tar": "^7.5.22",
51
51
  "yaml": "^2.6.0"