@docsector/docsector-reader 0.1.2 → 0.2.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 +175 -47
- package/bin/docsector.js +408 -17
- package/package.json +18 -10
- package/quasar.config.js +4 -111
- package/src/components/DH1.vue +1 -1
- package/src/components/DH2.vue +1 -1
- package/src/components/DH3.vue +1 -1
- package/src/components/DH4.vue +1 -1
- package/src/components/DH5.vue +1 -1
- package/src/components/DH6.vue +1 -1
- package/src/components/DMenu.vue +4 -4
- package/src/components/DPage.vue +3 -3
- package/src/components/DPageAnchor.vue +1 -1
- package/src/components/QZoom.js +1 -1
- package/src/components/QZoom.sass +43 -0
- package/src/i18n/helpers.js +160 -0
- package/src/i18n/index.js +4 -117
- package/src/layouts/DefaultLayout.vue +1 -1
- package/src/quasar.factory.js +249 -0
- package/src/components/QZoom.styl +0 -43
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Transform Markdown content into beautiful, navigable documentation sites — wit
|
|
|
35
35
|
|
|
36
36
|
## 🚀 Quick Start
|
|
37
37
|
|
|
38
|
-
### 📦 Install
|
|
38
|
+
### 📦 Install
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
npm install @docsector/docsector-reader
|
|
@@ -44,11 +44,13 @@ npm install @docsector/docsector-reader
|
|
|
44
44
|
### 🏗️ Scaffold a new project
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
npx
|
|
47
|
+
npx docsector init my-docs
|
|
48
48
|
cd my-docs
|
|
49
49
|
npm install
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
This creates a minimal project with `quasar.config.js`, `docsector.config.js`, `src/pages/`, `src/i18n/`, and `public/` — all powered by the docsector-reader engine.
|
|
53
|
+
|
|
52
54
|
### 💻 Development
|
|
53
55
|
|
|
54
56
|
```bash
|
|
@@ -57,37 +59,109 @@ npx docsector dev
|
|
|
57
59
|
npx quasar dev
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
The documentation site will be available at **http://localhost:8181**.
|
|
61
|
-
|
|
62
62
|
### 🏭 Production Build
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
npx docsector build
|
|
66
|
-
#
|
|
67
|
-
npx quasar build
|
|
66
|
+
npx docsector serve # Preview production build
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
Output is placed in `dist/spa/` — ready to deploy to any static hosting.
|
|
71
|
-
|
|
72
69
|
---
|
|
73
70
|
|
|
74
|
-
##
|
|
71
|
+
## 📐 Architecture — Library Mode
|
|
72
|
+
|
|
73
|
+
Docsector Reader works as a **rendering engine**: it provides the layout, components, router, store, and boot files. Consumer projects supply only their **content** (pages, i18n, config, assets).
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
┌───────────────────────────────────────────────────────┐
|
|
77
|
+
│ Consumer project (your-docs/) │
|
|
78
|
+
│ ├── docsector.config.js ← branding, links, langs │
|
|
79
|
+
│ ├── quasar.config.js ← thin wrapper │
|
|
80
|
+
│ ├── src/pages/ ← Markdown + route defs │
|
|
81
|
+
│ ├── src/i18n/ ← language files + tags │
|
|
82
|
+
│ └── public/ ← logo, images, icons │
|
|
83
|
+
│ │
|
|
84
|
+
│ ┌───────────────────────────────────────────────┐ │
|
|
85
|
+
│ │ @docsector/docsector-reader (engine) │ │
|
|
86
|
+
│ │ ├── App.vue, router, store, boot files │ │
|
|
87
|
+
│ │ ├── DPage, DMenu, DH1–DH6, DefaultLayout │ │
|
|
88
|
+
│ │ ├── composables (useNavigator) │ │
|
|
89
|
+
│ │ └── CSS, Prism.js, QZoom │ │
|
|
90
|
+
│ └───────────────────────────────────────────────┘ │
|
|
91
|
+
└───────────────────────────────────────────────────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Consumer `quasar.config.js`
|
|
95
|
+
|
|
96
|
+
The consumer's Quasar config is a thin wrapper around the factory:
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
import { configure, createQuasarConfig } from '@docsector/docsector-reader/quasar-factory'
|
|
100
|
+
|
|
101
|
+
export default configure(() => {
|
|
102
|
+
return createQuasarConfig({
|
|
103
|
+
projectRoot: import.meta.dirname,
|
|
75
104
|
|
|
76
|
-
|
|
105
|
+
// Optional: consumer-specific boot files (resolved from src/boot/)
|
|
106
|
+
boot: ['qmediaplayer'],
|
|
107
|
+
|
|
108
|
+
// Optional: PWA manifest overrides
|
|
109
|
+
pwa: {
|
|
110
|
+
name: 'My Docs',
|
|
111
|
+
short_name: 'Docs',
|
|
112
|
+
theme_color: '#027be3'
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
// Optional: extra Vite plugins
|
|
116
|
+
vitePlugins: [],
|
|
117
|
+
|
|
118
|
+
// Optional: extend Vite config further
|
|
119
|
+
extendViteConf (viteConf) {
|
|
120
|
+
// custom aliases, plugins, etc.
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### How aliases work
|
|
127
|
+
|
|
128
|
+
| Alias | Standalone | Consumer mode |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `components` | project `src/components/` | package `src/components/` |
|
|
131
|
+
| `layouts` | project `src/layouts/` | package `src/layouts/` |
|
|
132
|
+
| `boot` | project `src/boot/` | package `src/boot/` |
|
|
133
|
+
| `composables` | project `src/composables/` | package `src/composables/` |
|
|
134
|
+
| `css` | project `src/css/` | package `src/css/` |
|
|
135
|
+
| `stores` | project `src/store/` | package `src/store/` |
|
|
136
|
+
| `pages` | project `src/pages/` | consumer `src/pages/` |
|
|
137
|
+
| `src/i18n` | project `src/i18n/` | consumer `src/i18n/` |
|
|
138
|
+
| `docsector.config.js` | project root | consumer root |
|
|
139
|
+
| `@docsector/tags` | project `src/i18n/tags.hjson` | consumer `src/i18n/tags.hjson` |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## ⚙️ Configuration (`docsector.config.js`)
|
|
77
144
|
|
|
78
145
|
```javascript
|
|
79
146
|
export default {
|
|
80
147
|
branding: {
|
|
81
|
-
logo: '/images/logo.png',
|
|
148
|
+
logo: '/images/logo/my-logo.png',
|
|
82
149
|
name: 'My Project',
|
|
83
|
-
version: 'v1.0.0'
|
|
150
|
+
version: 'v1.0.0',
|
|
151
|
+
versions: ['v1.0.0', 'v0.9.0']
|
|
84
152
|
},
|
|
85
153
|
|
|
86
154
|
links: {
|
|
87
155
|
github: 'https://github.com/org/repo',
|
|
88
156
|
discussions: 'https://github.com/org/repo/discussions',
|
|
89
157
|
chat: 'https://discord.gg/invite',
|
|
90
|
-
|
|
158
|
+
email: 'contact@example.com',
|
|
159
|
+
changelog: 'https://github.com/org/repo/releases',
|
|
160
|
+
roadmap: 'https://github.com/org/repo/blob/main/ROADMAP.md',
|
|
161
|
+
sponsor: 'https://github.com/sponsors/user',
|
|
162
|
+
explore: [
|
|
163
|
+
{ label: '🌟 Related Project', url: 'https://github.com/org/related' }
|
|
164
|
+
]
|
|
91
165
|
},
|
|
92
166
|
|
|
93
167
|
github: {
|
|
@@ -105,22 +179,75 @@ export default {
|
|
|
105
179
|
|
|
106
180
|
---
|
|
107
181
|
|
|
108
|
-
##
|
|
182
|
+
## 🌍 Internationalization
|
|
183
|
+
|
|
184
|
+
### i18n setup (`src/i18n/index.js`)
|
|
185
|
+
|
|
186
|
+
Consumer projects use the `buildMessages` helper from the engine:
|
|
109
187
|
|
|
188
|
+
```javascript
|
|
189
|
+
import { buildMessages } from '@docsector/docsector-reader/i18n'
|
|
190
|
+
|
|
191
|
+
const langModules = import.meta.glob('./languages/*.hjson', { eager: true })
|
|
192
|
+
const mdModules = import.meta.glob('../pages/**/*.md', { eager: true, query: '?raw', import: 'default' })
|
|
193
|
+
|
|
194
|
+
import boot from 'pages/boot'
|
|
195
|
+
import pages from 'pages'
|
|
196
|
+
|
|
197
|
+
export default buildMessages({ langModules, mdModules, pages, boot })
|
|
110
198
|
```
|
|
111
|
-
|
|
199
|
+
|
|
200
|
+
### Language files
|
|
201
|
+
|
|
202
|
+
Place HJSON locale files in `src/i18n/languages/`:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
src/i18n/languages/en-US.hjson
|
|
206
|
+
src/i18n/languages/pt-BR.hjson
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Search tags (`src/i18n/tags.hjson`)
|
|
210
|
+
|
|
211
|
+
Provide search keywords per route and locale for menu search:
|
|
212
|
+
|
|
213
|
+
```hjson
|
|
214
|
+
{
|
|
215
|
+
"en-US": {
|
|
216
|
+
"/manual/my-section/my-page": "keyword1 keyword2 keyword3"
|
|
217
|
+
}
|
|
218
|
+
"pt-BR": {
|
|
219
|
+
"/manual/my-section/my-page": "palavra1 palavra2 palavra3"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 📁 Consumer Project Structure
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
my-docs/
|
|
230
|
+
├── docsector.config.js # Branding, links, languages
|
|
231
|
+
├── quasar.config.js # Thin wrapper using createQuasarConfig()
|
|
232
|
+
├── package.json
|
|
112
233
|
├── src/
|
|
113
234
|
│ ├── pages/
|
|
114
|
-
│ │ ├── index.js
|
|
115
|
-
│ │ ├──
|
|
116
|
-
│ │
|
|
117
|
-
│
|
|
118
|
-
│ ├──
|
|
119
|
-
│ ├──
|
|
120
|
-
│ ├──
|
|
121
|
-
│
|
|
122
|
-
│
|
|
123
|
-
└──
|
|
235
|
+
│ │ ├── index.js # Page registry (routes + metadata)
|
|
236
|
+
│ │ ├── boot.js # Boot page data
|
|
237
|
+
│ │ ├── guide/ # Guide pages (.md files)
|
|
238
|
+
│ │ └── manual/ # Manual pages (.md files)
|
|
239
|
+
│ ├── i18n/
|
|
240
|
+
│ │ ├── index.js # Uses buildMessages() from engine
|
|
241
|
+
│ │ ├── tags.hjson # Search keywords per route/locale
|
|
242
|
+
│ │ └── languages/ # HJSON locale files
|
|
243
|
+
│ ├── css/
|
|
244
|
+
│ │ └── app.sass # Optional overrides (imports engine CSS)
|
|
245
|
+
│ └── boot/ # Consumer-specific boot files
|
|
246
|
+
│ └── qmediaplayer.js # Example: custom Quasar extension
|
|
247
|
+
└── public/
|
|
248
|
+
├── images/logo/ # Project logo
|
|
249
|
+
├── images/flags/ # Locale flag images
|
|
250
|
+
└── icons/ # PWA icons
|
|
124
251
|
```
|
|
125
252
|
|
|
126
253
|
---
|
|
@@ -131,13 +258,15 @@ export default {
|
|
|
131
258
|
|
|
132
259
|
```javascript
|
|
133
260
|
export default {
|
|
134
|
-
'/my-page': {
|
|
261
|
+
'/manual/my-section/my-page': {
|
|
135
262
|
config: {
|
|
136
263
|
icon: 'description',
|
|
137
264
|
status: 'done', // 'done' | 'draft' | 'empty'
|
|
138
|
-
type: '
|
|
139
|
-
menu: {
|
|
140
|
-
|
|
265
|
+
type: 'manual', // 'guide' | 'manual'
|
|
266
|
+
menu: {
|
|
267
|
+
header: { label: '.my-section', icon: 'category' }
|
|
268
|
+
},
|
|
269
|
+
subpages: { showcase: false, vs: false }
|
|
141
270
|
},
|
|
142
271
|
data: {
|
|
143
272
|
'en-US': { title: 'My Page' },
|
|
@@ -150,8 +279,8 @@ export default {
|
|
|
150
279
|
2️⃣ Create Markdown files:
|
|
151
280
|
|
|
152
281
|
```
|
|
153
|
-
src/pages/
|
|
154
|
-
src/pages/
|
|
282
|
+
src/pages/manual/my-section/my-page.overview.en-US.md
|
|
283
|
+
src/pages/manual/my-section/my-page.overview.pt-BR.md
|
|
155
284
|
```
|
|
156
285
|
|
|
157
286
|
---
|
|
@@ -159,25 +288,24 @@ src/pages/guide/my-page.overview.pt-BR.md
|
|
|
159
288
|
## 🖥️ CLI Commands
|
|
160
289
|
|
|
161
290
|
```bash
|
|
162
|
-
docsector
|
|
163
|
-
docsector dev
|
|
164
|
-
docsector
|
|
165
|
-
docsector
|
|
166
|
-
docsector
|
|
291
|
+
docsector init <name> # Scaffold a new consumer project
|
|
292
|
+
docsector dev # Start dev server (port 8181)
|
|
293
|
+
docsector dev --port 3000 # Custom port
|
|
294
|
+
docsector build # Build for production (dist/spa/)
|
|
295
|
+
docsector serve # Serve production build
|
|
296
|
+
docsector help # Show help
|
|
167
297
|
```
|
|
168
298
|
|
|
169
299
|
---
|
|
170
300
|
|
|
171
|
-
## 🔌
|
|
172
|
-
|
|
173
|
-
```javascript
|
|
174
|
-
import { createDocsector, definePage } from '@docsector/docsector-reader'
|
|
301
|
+
## 🔌 Exports
|
|
175
302
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
303
|
+
| Import path | Export | Description |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| `@docsector/docsector-reader/quasar-factory` | `createQuasarConfig()` | Config factory for consumer projects |
|
|
306
|
+
| `@docsector/docsector-reader/quasar-factory` | `configure()` | No-op wrapper (avoids needing `quasar` dep) |
|
|
307
|
+
| `@docsector/docsector-reader/i18n` | `buildMessages()` | Build i18n messages from globs + pages |
|
|
308
|
+
| `@docsector/docsector-reader/i18n` | `filter()` | Filter i18n messages by locale |
|
|
181
309
|
|
|
182
310
|
---
|
|
183
311
|
|
|
@@ -187,7 +315,7 @@ const config = createDocsector({
|
|
|
187
315
|
|---|---|
|
|
188
316
|
| **Vue 3** | Composition API + `<script setup>` |
|
|
189
317
|
| **Quasar v2** | UI framework |
|
|
190
|
-
| **
|
|
318
|
+
| **@quasar/app-vite** | Vite-based Quasar build |
|
|
191
319
|
| **Vuex 4** | State management |
|
|
192
320
|
| **vue-i18n 9** | Internationalization |
|
|
193
321
|
| **markdown-it** | Markdown parsing |
|
|
@@ -204,6 +332,6 @@ Contributions are welcome! Please open an issue or submit a pull request.
|
|
|
204
332
|
|
|
205
333
|
## 📃 License
|
|
206
334
|
|
|
207
|
-
Copyright (c)
|
|
335
|
+
Copyright (c) Rodrigo de Araujo Vieira
|
|
208
336
|
|
|
209
337
|
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
|