@entropicwarrior/sdoc 0.2.4 → 0.2.5
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/package.json +1 -1
- package/src/sdoc.js +29 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@entropicwarrior/sdoc",
|
|
3
3
|
"displayName": "SDOC",
|
|
4
4
|
"description": "A plain-text documentation format with explicit brace scoping — deterministic parsing, AI-agent efficiency, and 10-50x token savings vs Markdown.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.5",
|
|
6
6
|
"publisher": "entropicwarrior",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
package/src/sdoc.js
CHANGED
|
@@ -1309,7 +1309,35 @@ function parseInline(text) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
|
|
1312
|
-
|
|
1312
|
+
// Bare email autolink: local@domain.tld
|
|
1313
|
+
if (ch === "@" && next && /[A-Za-z0-9]/.test(next)) {
|
|
1314
|
+
const prevCh = i > 0 ? text[i - 1] : "";
|
|
1315
|
+
if (/[A-Za-z0-9._+-]/.test(prevCh)) {
|
|
1316
|
+
// Scan forward for domain part (letters, digits, dots, hyphens)
|
|
1317
|
+
let j = i + 1;
|
|
1318
|
+
while (j < text.length && /[A-Za-z0-9.-]/.test(text[j])) j++;
|
|
1319
|
+
// Strip trailing dots/hyphens
|
|
1320
|
+
while (j > i + 1 && /[.-]/.test(text[j - 1])) j--;
|
|
1321
|
+
const domain = text.slice(i + 1, j);
|
|
1322
|
+
// Must have at least one dot with content on both sides
|
|
1323
|
+
if (/^[A-Za-z0-9]([A-Za-z0-9-]*\.)+[A-Za-z]{2,}$/.test(domain)) {
|
|
1324
|
+
// Extract local part from buffer
|
|
1325
|
+
let k = buffer.length;
|
|
1326
|
+
while (k > 0 && /[A-Za-z0-9._+\-]/.test(buffer[k - 1])) k--;
|
|
1327
|
+
const local = buffer.slice(k);
|
|
1328
|
+
if (local.length > 0) {
|
|
1329
|
+
buffer = buffer.slice(0, k);
|
|
1330
|
+
const email = local + "@" + domain;
|
|
1331
|
+
flush();
|
|
1332
|
+
nodes.push({ type: "link", href: "mailto:" + email, children: [{ type: "text", value: email }] });
|
|
1333
|
+
i = j;
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
if (ch === "@" && next && isIdentStart(next) && !(i > 0 && /[A-Za-z0-9._+-]/.test(text[i - 1]))) {
|
|
1313
1341
|
let j = i + 1;
|
|
1314
1342
|
while (j < text.length && isIdentChar(text[j])) {
|
|
1315
1343
|
j += 1;
|