@docsector/docsector-reader 0.8.1 → 0.8.2

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/bin/docsector.js CHANGED
@@ -23,7 +23,7 @@ const packageRoot = resolve(__dirname, '..')
23
23
  const args = process.argv.slice(2)
24
24
  const command = args[0]
25
25
 
26
- const VERSION = '0.8.1'
26
+ const VERSION = '0.8.2'
27
27
 
28
28
  const HELP = `
29
29
  Docsector Reader v${VERSION}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsector/docsector-reader",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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",
@@ -360,7 +360,7 @@ function createMarkdownEndpointPlugin (projectRoot) {
360
360
  if (!file) return next()
361
361
 
362
362
  const content = readFileSync(file, 'utf-8')
363
- res.setHeader('Content-Type', 'text/plain; charset=utf-8')
363
+ res.setHeader('Content-Type', 'text/markdown; charset=utf-8')
364
364
  res.end(content)
365
365
  return
366
366
  }
@@ -374,7 +374,7 @@ function createMarkdownEndpointPlugin (projectRoot) {
374
374
  const file = resolveMarkdownFile(mdPath, lang)
375
375
  if (file) {
376
376
  const content = readFileSync(file, 'utf-8')
377
- res.setHeader('Content-Type', 'text/plain; charset=utf-8')
377
+ res.setHeader('Content-Type', 'text/markdown; charset=utf-8')
378
378
  res.end(content)
379
379
  return
380
380
  }
@@ -438,6 +438,19 @@ function createMarkdownBuildPlugin (projectRoot) {
438
438
  }
439
439
 
440
440
  console.log(`\x1b[36m[docsector]\x1b[0m Generated ${count} static .md files`)
441
+
442
+ // Generate _headers file for Cloudflare Pages (append if exists)
443
+ const headersPath = resolve(distDir, '_headers')
444
+ const headersRule = '/*.md\n Content-Type: text/markdown; charset=utf-8\n'
445
+ if (existsSync(headersPath)) {
446
+ const existing = readFileSync(headersPath, 'utf-8')
447
+ if (!existing.includes('*.md')) {
448
+ writeFileSync(headersPath, existing.trimEnd() + '\n\n' + headersRule)
449
+ }
450
+ } else {
451
+ writeFileSync(headersPath, headersRule)
452
+ }
453
+ console.log(`\x1b[36m[docsector]\x1b[0m Added _headers rule for .md files`)
441
454
  }
442
455
  }
443
456
  }