mdzilla 0.0.5 → 0.1.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 +1 -1
- package/dist/_chunks/exporter.mjs +3 -15
- package/dist/_chunks/server.mjs +1142 -1518
- package/dist/cli/main.mjs +42 -16
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Markdown browser for humans and agents.
|
|
|
14
14
|
|
|
15
15
|
> Browse docs from local directories, GitHub repos, and remote websites — all from your terminal.
|
|
16
16
|
|
|
17
|
-
Built with [md4x](https://github.com/unjs/md4x), [
|
|
17
|
+
Built with [md4x](https://github.com/unjs/md4x), [giget](https://github.com/unjs/giget) and [speed-highlight](https://github.com/speed-highlight/core), [nitro](https://v3.nitro.build/), [h3](https://h3.dev/), [srvx](https://srvx.h3.dev/) and [vite](https://vite.dev/).
|
|
18
18
|
|
|
19
19
|
Supports any website with [`/llms.txt`](https://llmstxt.org/) or markdown content negotiation.
|
|
20
20
|
|
|
@@ -249,7 +249,7 @@ async function _scanNav(dirPath, parentPath, options) {
|
|
|
249
249
|
const dirEntries = await readdir(dirPath);
|
|
250
250
|
const entries = [];
|
|
251
251
|
for (const entry of dirEntries) {
|
|
252
|
-
if (entry.startsWith(".") || entry.startsWith("_") || entry === "package.json" || entry === "pnpm-lock.yaml" || entry === "pnpm-workspace.yaml") continue;
|
|
252
|
+
if (entry.startsWith(".") || entry.startsWith("_") || entry === "node_modules" || entry === "dist" || entry === "package.json" || entry === "pnpm-lock.yaml" || entry === "pnpm-workspace.yaml") continue;
|
|
253
253
|
const fullPath = join(dirPath, entry);
|
|
254
254
|
let stats;
|
|
255
255
|
try {
|
|
@@ -329,7 +329,7 @@ async function buildFileMap(parentPath, dirPath) {
|
|
|
329
329
|
const map = /* @__PURE__ */ new Map();
|
|
330
330
|
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
331
331
|
for (const entry of entries) {
|
|
332
|
-
if (entry.name.startsWith(".") || entry.name.startsWith("_")) continue;
|
|
332
|
+
if (entry.name.startsWith(".") || entry.name.startsWith("_") || entry.name === "node_modules" || entry.name === "dist") continue;
|
|
333
333
|
const fullPath = join(dirPath, entry.name);
|
|
334
334
|
if (entry.isDirectory()) {
|
|
335
335
|
const slug = parseSlug(entry.name);
|
|
@@ -591,21 +591,9 @@ var DocsSourceHTTP = class extends DocsSource {
|
|
|
591
591
|
return `# Fetch Error\n\nFailed to fetch \`${url}\`\n\n> ${err instanceof Error ? err.message : String(err)}`;
|
|
592
592
|
}
|
|
593
593
|
if (!res.ok) return `# ${res.status} ${res.statusText}\n\nFailed to fetch \`${url}\``;
|
|
594
|
-
|
|
595
|
-
const text = await res.text();
|
|
596
|
-
if (_isHTML(contentType, text)) {
|
|
597
|
-
const { htmlToMarkdown } = await import("mdream");
|
|
598
|
-
return htmlToMarkdown(text, { origin: url });
|
|
599
|
-
}
|
|
600
|
-
return text;
|
|
594
|
+
return await res.text();
|
|
601
595
|
}
|
|
602
596
|
};
|
|
603
|
-
/** Check if a response is HTML by content-type or content sniffing */
|
|
604
|
-
function _isHTML(contentType, body) {
|
|
605
|
-
if (contentType.includes("text/html") || contentType.includes("application/xhtml")) return true;
|
|
606
|
-
const trimmed = body.trimStart();
|
|
607
|
-
return trimmed.startsWith("<!") || trimmed.startsWith("<html");
|
|
608
|
-
}
|
|
609
597
|
/** Extract a readable title from a URL */
|
|
610
598
|
function _titleFromURL(url) {
|
|
611
599
|
try {
|