lildocs 0.1.7 → 0.1.9
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.mjs +26 -30
- package/dist/render/styles.css +8 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -321,8 +321,10 @@ function inferTitle(metadata, markdown, sourcePath) {
|
|
|
321
321
|
if (h1?.[1]) return stripMarkdownInline(h1[1]).trim();
|
|
322
322
|
return formatFilename(path.basename(sourcePath, path.extname(sourcePath)));
|
|
323
323
|
}
|
|
324
|
-
function slugify(value) {
|
|
325
|
-
|
|
324
|
+
function slugify(value, options = {}) {
|
|
325
|
+
const punctuation = options.preserveUnderscores ? /[`*~[\]()]/g : /[`*_~[\]()]/g;
|
|
326
|
+
const nonSlugCharacters = options.preserveUnderscores ? /[^a-z0-9_]+/g : /[^a-z0-9]+/g;
|
|
327
|
+
return value.toLowerCase().trim().replace(punctuation, "").replace(/&/g, " and ").replace(nonSlugCharacters, "-").replace(/^-+|-+$/g, "") || "section";
|
|
326
328
|
}
|
|
327
329
|
function extractHeadings(markdown) {
|
|
328
330
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -330,7 +332,7 @@ function extractHeadings(markdown) {
|
|
|
330
332
|
for (const line of markdown.split(/\r?\n/)) {
|
|
331
333
|
const match = line.match(/^(#{1,6})\s+(.+)$/);
|
|
332
334
|
if (!match?.[1] || !match[2]) continue;
|
|
333
|
-
const baseId = slugify(stripMarkdownInline(match[2]));
|
|
335
|
+
const baseId = slugify(stripMarkdownInline(match[2]), { preserveUnderscores: true });
|
|
334
336
|
const count = seen.get(baseId) ?? 0;
|
|
335
337
|
seen.set(baseId, count + 1);
|
|
336
338
|
headings.push({
|
|
@@ -342,7 +344,7 @@ function extractHeadings(markdown) {
|
|
|
342
344
|
return headings;
|
|
343
345
|
}
|
|
344
346
|
function stripMarkdownInline(value) {
|
|
345
|
-
return value.replace(
|
|
347
|
+
return value.replace(/\[(.*?)\]\(.*?\)/g, "$1").replace(/`([^`]*)`/g, "$1").replace(/~~([\s\S]*?)~~/g, "$1").replace(/\*\*([\s\S]*?)\*\*/g, "$1").replace(/__([\s\S]*?)__/g, "$1").replace(/\*([^*]*?)\*/g, "$1").replace(/(^|[\s([{])_([^\s_](?:[\s\S]*?[^\s_])?)_(?=$|[\s)\]}.,;:!?])/g, "$1$2");
|
|
346
348
|
}
|
|
347
349
|
function formatFilename(value) {
|
|
348
350
|
return value.replace(/[-_]+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase()).trim();
|
|
@@ -964,8 +966,7 @@ const themes = {
|
|
|
964
966
|
body: "system-ui, sans-serif",
|
|
965
967
|
code: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
|
|
966
968
|
},
|
|
967
|
-
shiki: { theme: "github-light" }
|
|
968
|
-
background: { gradient: "linear-gradient(180deg, rgb(37 99 235 / 0.045), transparent 220px)" }
|
|
969
|
+
shiki: { theme: "github-light" }
|
|
969
970
|
},
|
|
970
971
|
minimal: {
|
|
971
972
|
color: {
|
|
@@ -983,8 +984,7 @@ const themes = {
|
|
|
983
984
|
body: "Arial, sans-serif",
|
|
984
985
|
code: "Menlo, Consolas, monospace"
|
|
985
986
|
},
|
|
986
|
-
shiki: { theme: "github-light" }
|
|
987
|
-
background: { gradient: "linear-gradient(180deg, rgb(15 118 110 / 0.04), transparent 220px)" }
|
|
987
|
+
shiki: { theme: "github-light" }
|
|
988
988
|
}
|
|
989
989
|
};
|
|
990
990
|
async function resolveTheme(options) {
|
|
@@ -1178,30 +1178,27 @@ function mapShikiThemeToTheme(shikiTheme, themeName) {
|
|
|
1178
1178
|
"foreground",
|
|
1179
1179
|
"sideBar.foreground"
|
|
1180
1180
|
], shikiTheme.fg ?? (shikiTheme.type === "dark" ? "#f5f5f5" : "#111111"));
|
|
1181
|
-
const mutedText = pickColor(colors, [
|
|
1182
|
-
"descriptionForeground",
|
|
1183
|
-
"breadcrumb.foreground",
|
|
1184
|
-
"editorLineNumber.foreground",
|
|
1185
|
-
"sideBar.foreground"
|
|
1186
|
-
], tokenForeground(tokenColors, "comment") ?? text);
|
|
1187
|
-
const border = pickColor(colors, [
|
|
1188
|
-
"panel.border",
|
|
1189
|
-
"sideBar.border",
|
|
1190
|
-
"editorGroup.border",
|
|
1191
|
-
"tab.border"
|
|
1192
|
-
], shikiTheme.type === "dark" ? "#333333" : "#e5e5e5");
|
|
1193
|
-
const link = pickColor(colors, [
|
|
1194
|
-
"textLink.foreground",
|
|
1195
|
-
"terminal.ansiBlue",
|
|
1196
|
-
"activityBarBadge.background"
|
|
1197
|
-
], tokenForeground(tokenColors, "markup.inline.raw") ?? (shikiTheme.type === "dark" ? "#79b8ff" : "#2563eb"));
|
|
1198
1181
|
return {
|
|
1199
1182
|
color: {
|
|
1200
1183
|
background,
|
|
1201
1184
|
text,
|
|
1202
|
-
mutedText,
|
|
1203
|
-
|
|
1204
|
-
|
|
1185
|
+
mutedText: pickColor(colors, [
|
|
1186
|
+
"descriptionForeground",
|
|
1187
|
+
"breadcrumb.foreground",
|
|
1188
|
+
"editorLineNumber.foreground",
|
|
1189
|
+
"sideBar.foreground"
|
|
1190
|
+
], tokenForeground(tokenColors, "comment") ?? text),
|
|
1191
|
+
border: pickColor(colors, [
|
|
1192
|
+
"panel.border",
|
|
1193
|
+
"sideBar.border",
|
|
1194
|
+
"editorGroup.border",
|
|
1195
|
+
"tab.border"
|
|
1196
|
+
], shikiTheme.type === "dark" ? "#333333" : "#e5e5e5"),
|
|
1197
|
+
link: pickColor(colors, [
|
|
1198
|
+
"textLink.foreground",
|
|
1199
|
+
"terminal.ansiBlue",
|
|
1200
|
+
"activityBarBadge.background"
|
|
1201
|
+
], tokenForeground(tokenColors, "markup.inline.raw") ?? (shikiTheme.type === "dark" ? "#79b8ff" : "#2563eb")),
|
|
1205
1202
|
codeBackground: ensureBackgroundContrast({
|
|
1206
1203
|
background,
|
|
1207
1204
|
candidate: pickColor(colors, [
|
|
@@ -1224,8 +1221,7 @@ function mapShikiThemeToTheme(shikiTheme, themeName) {
|
|
|
1224
1221
|
body: "system-ui, sans-serif",
|
|
1225
1222
|
code: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
|
|
1226
1223
|
},
|
|
1227
|
-
shiki: { theme: themeName }
|
|
1228
|
-
background: { gradient: shikiTheme.type === "dark" ? `linear-gradient(180deg, color-mix(in srgb, ${link} 16%, transparent), transparent 240px)` : `linear-gradient(180deg, color-mix(in srgb, ${link} 9%, transparent), transparent 220px)` }
|
|
1224
|
+
shiki: { theme: themeName }
|
|
1229
1225
|
};
|
|
1230
1226
|
}
|
|
1231
1227
|
function pickColor(colors, keys, fallback) {
|
package/dist/render/styles.css
CHANGED
|
@@ -149,6 +149,10 @@ html.is-animating .transition-scale {
|
|
|
149
149
|
margin-block: 2em 0.667em;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
.content article h1 {
|
|
153
|
+
font-size: 2.2rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
.content article p {
|
|
153
157
|
margin-block: 1.25em;
|
|
154
158
|
}
|
|
@@ -164,7 +168,7 @@ html.is-animating .transition-scale {
|
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
.groupBreadcrumbs {
|
|
167
|
-
margin:
|
|
171
|
+
margin-block-end: -4px !important;
|
|
168
172
|
color: var(--ld-color-accent);
|
|
169
173
|
font-size: 80%;
|
|
170
174
|
font-weight: 700;
|
|
@@ -407,6 +411,9 @@ html.is-animating .transition-scale {
|
|
|
407
411
|
}
|
|
408
412
|
|
|
409
413
|
.content table {
|
|
414
|
+
display: block;
|
|
415
|
+
max-width: 100%;
|
|
416
|
+
overflow-x: auto;
|
|
410
417
|
width: 100%;
|
|
411
418
|
border-collapse: collapse;
|
|
412
419
|
}
|
package/package.json
CHANGED