@clarusjs/theme-docs 0.3.0 → 0.4.1

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/src/vite.js CHANGED
@@ -209,6 +209,13 @@ export function readPages(dir) {
209
209
  const group = data.group ?? (parts.length > 2 ? words(parts[1]) : undefined)
210
210
  if (group) page.group = group
211
211
  if (data.order !== undefined && Number.isFinite(Number(data.order))) page.order = Number(data.order)
212
+ if (typeof data.badge === 'string' && data.badge) page.badge = data.badge
213
+ if (data.minutes !== undefined && Number(data.minutes) > 0) page.minutes = Number(data.minutes)
214
+ // A lesson: the XP it can earn, as progress.ts counts it (a step 10, the lesson 50, a quiz right 20).
215
+ if (String(data.steps) === 'true') {
216
+ const body = text.replace(/^```[\s\S]*?^```/gm, '') // not the headings inside code samples
217
+ page.xp = 50 + 10 * (body.match(/^## /gm)?.length ?? 0) + 20 * (body.match(/^:::+ *quiz\b/gm)?.length ?? 0)
218
+ }
212
219
  const updated = dates.get(resolve(dir, file))
213
220
  if (updated !== undefined) page.updated = updated
214
221
  if (data.sidebar === 'false' || parts.some((part) => part.startsWith('['))) page.hidden = true