@docsector/docsector-reader 0.9.2 β 0.10.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 +26 -1
- package/bin/docsector.js +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -0
- package/src/quasar.factory.js +57 -0
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Transform Markdown content into beautiful, navigable documentation sites β wit
|
|
|
27
27
|
- πΊοΈ **Sitemap Generation** β Automatic `sitemap.xml` generation at build time with all page URLs (requires `siteUrl` in config)
|
|
28
28
|
- π€ **AI-Friendly robots.txt** β Scaffold includes a `robots.txt` explicitly allowing 23 AI crawlers (GPTBot, ClaudeBot, PerplexityBot, GrokBot, etc.)
|
|
29
29
|
- π **MCP Server** β Auto-generated [MCP](https://modelcontextprotocol.io) server at `/mcp` for AI assistant integration (Claude Desktop, VS Code, etc.)
|
|
30
|
+
- π **llms.txt / llms-full.txt** β Auto-generated [llms.txt](https://llmstxt.org) index and full-content file for LLM discovery (requires `siteUrl` in config)
|
|
30
31
|
|
|
31
32
|
---
|
|
32
33
|
|
|
@@ -128,7 +129,31 @@ curl -X POST http://localhost:8788/mcp \
|
|
|
128
129
|
|
|
129
130
|
---
|
|
130
131
|
|
|
131
|
-
##
|
|
132
|
+
## οΏ½ llms.txt (LLM Discovery)
|
|
133
|
+
|
|
134
|
+
Docsector Reader automatically generates [llms.txt](https://llmstxt.org) files at build time when `siteUrl` is configured (same requirement as sitemap.xml).
|
|
135
|
+
|
|
136
|
+
| File | Purpose |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `/llms.txt` | Markdown index of all pages with links to `.md` versions, grouped by type |
|
|
139
|
+
| `/llms-full.txt` | Full documentation content concatenated in a single file for LLM context |
|
|
140
|
+
|
|
141
|
+
Optionally add a `description` to your branding for a richer `llms.txt` blockquote:
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
export default {
|
|
145
|
+
branding: {
|
|
146
|
+
name: 'My Project',
|
|
147
|
+
version: 'v1.0.0',
|
|
148
|
+
description: 'A framework for building awesome things'
|
|
149
|
+
},
|
|
150
|
+
siteUrl: 'https://my-docs.example.com'
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## οΏ½π Quick Start
|
|
132
157
|
|
|
133
158
|
### π¦ Install
|
|
134
159
|
|
package/bin/docsector.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docsector/docsector-reader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
|
|
5
5
|
"productName": "Docsector Reader",
|
|
6
6
|
"author": "Rodrigo de Araujo Vieira",
|
package/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* @param {string} config.branding.logo - Logo image path (relative to public/)
|
|
27
27
|
* @param {string} config.branding.name - Project name displayed in sidebar
|
|
28
28
|
* @param {string} config.branding.version - Version label
|
|
29
|
+
* @param {string} [config.branding.description] - Project description (used in llms.txt)
|
|
29
30
|
* @param {string[]} [config.branding.versions] - Available versions for dropdown
|
|
30
31
|
* @param {Object} config.links - External links
|
|
31
32
|
* @param {string} [config.links.github] - GitHub repository URL
|
package/src/quasar.factory.js
CHANGED
|
@@ -467,6 +467,63 @@ function createMarkdownBuildPlugin (projectRoot) {
|
|
|
467
467
|
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls}</urlset>\n`
|
|
468
468
|
writeFileSync(resolve(distDir, 'sitemap.xml'), sitemap)
|
|
469
469
|
console.log(`\x1b[36m[docsector]\x1b[0m Generated sitemap.xml`)
|
|
470
|
+
|
|
471
|
+
// Generate llms.txt and llms-full.txt (LLM-friendly page index and full content)
|
|
472
|
+
const brandingName = config.branding?.name || 'Documentation'
|
|
473
|
+
const brandingVersion = config.branding?.version || ''
|
|
474
|
+
const brandingDesc = config.branding?.description || `${brandingName} documentation`
|
|
475
|
+
|
|
476
|
+
let llmsIndex = `# ${brandingName}${brandingVersion ? ' ' + brandingVersion : ''}\n\n> ${brandingDesc}\n\n`
|
|
477
|
+
let llmsFull = `# ${brandingName}${brandingVersion ? ' ' + brandingVersion : ''}\n\n> ${brandingDesc}\n\n---\n\n`
|
|
478
|
+
|
|
479
|
+
const llmsSections = {}
|
|
480
|
+
|
|
481
|
+
for (const [pagePath, page] of Object.entries(pages)) {
|
|
482
|
+
if (page.config === null) continue
|
|
483
|
+
if (page.config.status === 'empty') continue
|
|
484
|
+
|
|
485
|
+
const type = page.config.type ?? 'manual'
|
|
486
|
+
const title = page.data?.['*']?.title
|
|
487
|
+
|| page.data?.[defaultLang]?.title
|
|
488
|
+
|| page.data?.['en-US']?.title
|
|
489
|
+
|| pagePath.split('/').pop()
|
|
490
|
+
|| pagePath
|
|
491
|
+
|
|
492
|
+
const subpages = ['overview']
|
|
493
|
+
if (page.config.subpages?.showcase) subpages.push('showcase')
|
|
494
|
+
if (page.config.subpages?.vs) subpages.push('vs')
|
|
495
|
+
|
|
496
|
+
for (const subpage of subpages) {
|
|
497
|
+
const srcFile = resolve(pagesDir, `${type}${pagePath}.${subpage}.${defaultLang}.md`)
|
|
498
|
+
if (!existsSync(srcFile)) continue
|
|
499
|
+
|
|
500
|
+
const routePath = `${type}${pagePath}/${subpage}`
|
|
501
|
+
const mdUrl = `${siteUrl}/${routePath}.md`
|
|
502
|
+
const pageUrl = `${siteUrl}/${routePath}`
|
|
503
|
+
|
|
504
|
+
const desc = page.config.meta?.description
|
|
505
|
+
const descText = typeof desc === 'object' ? (desc[defaultLang] || desc['en-US'] || '') : (desc || '')
|
|
506
|
+
|
|
507
|
+
if (!llmsSections[type]) llmsSections[type] = []
|
|
508
|
+
llmsSections[type].push(
|
|
509
|
+
descText
|
|
510
|
+
? `- [${title}](${mdUrl}): ${descText}`
|
|
511
|
+
: `- [${title}](${mdUrl})`
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
const content = readFileSync(srcFile, 'utf-8')
|
|
515
|
+
llmsFull += `## ${title}\n\nSource: ${pageUrl}\n\n${content}\n\n---\n\n`
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
for (const [section, entries] of Object.entries(llmsSections)) {
|
|
520
|
+
const sectionName = section.charAt(0).toUpperCase() + section.slice(1)
|
|
521
|
+
llmsIndex += `## ${sectionName}\n\n${entries.join('\n')}\n\n`
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
writeFileSync(resolve(distDir, 'llms.txt'), llmsIndex.trimEnd() + '\n')
|
|
525
|
+
writeFileSync(resolve(distDir, 'llms-full.txt'), llmsFull.trimEnd() + '\n')
|
|
526
|
+
console.log(`\x1b[36m[docsector]\x1b[0m Generated llms.txt and llms-full.txt`)
|
|
470
527
|
}
|
|
471
528
|
|
|
472
529
|
// Generate _headers file for Cloudflare Pages (append if exists)
|