@beforesemicolon/builder 1.8.11 → 1.8.13

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.
@@ -0,0 +1,770 @@
1
+ # fading-citrus Template
2
+
3
+ `fading-citrus` is a complete documentation-site template for `buildDocs({ template: 'fading-citrus' })`.
4
+
5
+ This README only documents the template-specific surface area: layouts, Markdown layout parts, assets, scripts, theme variables, and the expected override points. General builder behavior is documented in the repository root README.
6
+
7
+ ## What This Template Provides
8
+
9
+ The template ships:
10
+
11
+ - A landing page shell.
12
+ - A documentation page shell.
13
+ - Landing page section handlers for Markdown layout syntax.
14
+ - A code snippet renderer with copy behavior.
15
+ - Header, footer, metadata, and shared layout helpers.
16
+ - CSS for landing and documentation pages.
17
+ - A dark-first theme with light and dark variable maps.
18
+ - Default assets, including social icons, favicons, a default `logo.svg`, and Before Semicolon brand assets.
19
+
20
+ Use it when you want a polished documentation site where most page content stays in Markdown and the template owns the HTML structure.
21
+
22
+ ## Directory Surface
23
+
24
+ ```txt
25
+ fading-citrus/
26
+ README.md
27
+ template.config.js
28
+ assets/
29
+ logo.svg
30
+ before-semicolon-logo.png
31
+ favicon/
32
+ ...
33
+ layouts/
34
+ landing.js
35
+ document.js
36
+ _header.js
37
+ _footer.js
38
+ _head-meta.js
39
+ _code-snippet.js
40
+ _layout-utils.js
41
+ landing-hero.js
42
+ landing-ecosystem.js
43
+ landing-features.js
44
+ landing-showcase.js
45
+ landing-install.js
46
+ landing-cta.js
47
+ stylesheets/
48
+ common.css
49
+ documentation.css
50
+ fonts.css
51
+ landing.css
52
+ normalize.css
53
+ *.hightlighter.css
54
+ ```
55
+
56
+ Files prefixed with `_` are private template helpers. A docs project can override them by providing a same-named file in `docs/_template/layouts`, but they are not intended to be Markdown layout names.
57
+
58
+ ## Page Layouts
59
+
60
+ ### `landing`
61
+
62
+ Used by pages with:
63
+
64
+ ```md
65
+ ---
66
+ layout: landing
67
+ ---
68
+ ```
69
+
70
+ This layout renders:
71
+
72
+ - metadata from `_head-meta.js`
73
+ - `/stylesheets/landing.css`
74
+ - optional generated `theme.css`
75
+ - shared header
76
+ - rendered Markdown content
77
+ - shared footer
78
+ - page scripts collected by the template config
79
+
80
+ The landing layout intentionally does not hardcode landing content. It expects the page body to be composed with Markdown layout blocks such as `landing-hero`, `landing-features`, and `landing-install`.
81
+
82
+ ### `document`
83
+
84
+ Used by documentation pages with:
85
+
86
+ ```md
87
+ ---
88
+ layout: document
89
+ ---
90
+ ```
91
+
92
+ This layout renders:
93
+
94
+ - metadata from `_head-meta.js`
95
+ - `/stylesheets/documentation.css`
96
+ - optional generated `theme.css`
97
+ - shared header
98
+ - documentation navigation from the generated site map
99
+ - page article content
100
+ - previous/next documentation links
101
+ - edit-on-GitHub link
102
+ - table of contents from Markdown headings
103
+ - shared footer
104
+ - page scripts collected by the template config
105
+
106
+ The `document` layout currently expects documentation pages to live under `/documentation`. The generated left navigation is read from `props.siteMap.get('documentation')`.
107
+
108
+ ## Header And Footer
109
+
110
+ The header and footer are provided by:
111
+
112
+ - `layouts/_header.js`
113
+ - `layouts/_footer.js`
114
+
115
+ They use `/assets/logo.svg` for the site logo. This is intentionally asset-based so a docs project can override the logo without replacing layout code.
116
+
117
+ Override the logo by adding:
118
+
119
+ ```txt
120
+ docs/_template/assets/logo.svg
121
+ ```
122
+
123
+ The footer also uses social icons from `/assets/*.svg` and a Before Semicolon credit asset at `/assets/before-semicolon-logo.png`.
124
+
125
+ The current header and footer still include Before Semicolon and Markup-oriented links and copy. If a site needs fully different navigation, footer link groups, or legal copy, override `_header.js`, `_footer.js`, or the full page layouts from `docs/_template/layouts`.
126
+
127
+ ## Metadata
128
+
129
+ Metadata is generated by:
130
+
131
+ ```txt
132
+ layouts/_head-meta.js
133
+ ```
134
+
135
+ It emits:
136
+
137
+ - title and meta description
138
+ - canonical URL
139
+ - Open Graph tags
140
+ - Twitter card tags
141
+ - keywords
142
+ - robots metadata
143
+ - favicon links
144
+ - structured JSON-LD for web site, software application, breadcrumbs, and docs pages
145
+
146
+ Important current behavior:
147
+
148
+ - The metadata helper is still Markup-specific.
149
+ - It hardcodes the production site URL and some default titles/assets.
150
+ - Override `_head-meta.js` in `docs/_template/layouts` for any non-Markup documentation site.
151
+
152
+ ## Markdown Layout Handlers
153
+
154
+ `template.config.js` registers these Markdown layout handlers:
155
+
156
+ ```js
157
+ markdownLayouts: {
158
+ 'landing-hero': landingHero,
159
+ 'landing-ecosystem': landingEcosystem,
160
+ 'landing-features': landingFeatures,
161
+ 'landing-showcase': landingShowcase,
162
+ 'landing-install': landingInstall,
163
+ 'landing-cta': landingCta,
164
+ }
165
+ ```
166
+
167
+ Each handler receives parsed Markdown parts. Each part has already been rendered to HTML, so handlers inject `part.html`.
168
+
169
+ ## `landing-hero`
170
+
171
+ Purpose: first-screen landing section with headline, copy, stats, CTA buttons, and optional code panel.
172
+
173
+ Syntax:
174
+
175
+ ````md
176
+ ::: layout landing-hero version=v1.0.0 title="Reactive DOM." title2="Zero build." primaryLabel="Get Started" secondaryLabel="npm i package-name"
177
+
178
+ === copy
179
+
180
+ A short landing intro.
181
+
182
+ === stat
183
+
184
+ ## 7.6KB
185
+
186
+ CDN gzip
187
+
188
+ === stat
189
+
190
+ ## 0
191
+
192
+ third-party deps
193
+
194
+ === code filename=counter.js lang=javascript
195
+
196
+ ```text
197
+ console.log('hello')
198
+ ```
199
+ ````
200
+
201
+ :::
202
+
203
+ ````
204
+
205
+ Supported layout options:
206
+
207
+ - `version`: optional version badge text.
208
+ - `title`: first headline line.
209
+ - `title2`: second headline line.
210
+ - `primaryHref`: primary CTA URL. Defaults to `/documentation/get-started`.
211
+ - `primaryLabel`: primary CTA label. Defaults to `Get Started`.
212
+ - `secondaryLabel`: secondary CTA label. Defaults to `npm i @beforesemicolon/markup`.
213
+
214
+ Supported parts:
215
+
216
+ - `copy`: rendered as hero subtitle.
217
+ - `stat`: can be repeated. Expects an `h2` value and paragraph label.
218
+ - `code`: optional code block. Supports `filename` and `lang` options.
219
+
220
+ Notes:
221
+
222
+ - The secondary CTA currently points to `#install`.
223
+ - The version badge currently links to the Markup GitHub repository. Override `landing-hero.js` if that needs to be generic.
224
+
225
+ ## `landing-ecosystem`
226
+
227
+ Purpose: product/ecosystem cards.
228
+
229
+ Syntax:
230
+
231
+ ```md
232
+ ::: layout landing-ecosystem
233
+
234
+ === header
235
+
236
+ `// ecosystem`
237
+
238
+ ## Built on top of the core.
239
+
240
+ Short section description.
241
+
242
+ === product title="Web Components" package=@scope/web-component color=orange icon=webComponents href=/documentation/web-component
243
+
244
+ Product description.
245
+
246
+ === product title=Router package=@scope/router color=cyan icon=router href=/documentation/router
247
+
248
+ Product description.
249
+
250
+ :::
251
+ ````
252
+
253
+ Supported parts:
254
+
255
+ - `header`: section eyebrow, heading, and intro copy.
256
+ - `product`: repeated cards.
257
+
258
+ Product options:
259
+
260
+ - `title`: card title.
261
+ - `package`: package label.
262
+ - `color`: card color modifier. Existing CSS supports the orange/cyan style used by the template.
263
+ - `icon`: icon name from `_layout-utils.js`.
264
+ - `href`: link target.
265
+
266
+ ## `landing-features`
267
+
268
+ Purpose: grid of feature cards.
269
+
270
+ Syntax:
271
+
272
+ ```md
273
+ ::: layout landing-features
274
+
275
+ === header
276
+
277
+ `// why this`
278
+
279
+ ## The platform is the framework.
280
+
281
+ Short intro.
282
+
283
+ === feature icon=reactive
284
+
285
+ ### Reactive
286
+
287
+ Feature copy.
288
+
289
+ === feature icon=tiny
290
+
291
+ ### Tiny
292
+
293
+ Feature copy.
294
+
295
+ :::
296
+ ```
297
+
298
+ Supported parts:
299
+
300
+ - `header`: section eyebrow, heading, and intro copy.
301
+ - `feature`: repeated feature cards.
302
+
303
+ Feature options:
304
+
305
+ - `icon`: icon name from `_layout-utils.js`.
306
+
307
+ Available icon names include:
308
+
309
+ - `reactive`
310
+ - `tiny`
311
+ - `standards`
312
+ - `plug`
313
+ - `webComponents`
314
+ - `surgical`
315
+ - `router`
316
+ - `terminal`
317
+ - `book`
318
+ - `arrowRight`
319
+ - `arrowUpRight`
320
+ - `sparkles`
321
+
322
+ Unknown icon names fall back to `reactive`.
323
+
324
+ ## `landing-showcase`
325
+
326
+ Purpose: interactive code example carousel.
327
+
328
+ Syntax:
329
+
330
+ ````md
331
+ ::: layout landing-showcase
332
+
333
+ === header
334
+
335
+ `// see it in action`
336
+
337
+ ## Looks like HTML.
338
+
339
+ Short intro.
340
+
341
+ === example label="Todos + localStorage" color=orange filename=todos.js lang=javascript
342
+
343
+ ```javascript
344
+ console.log('todo example')
345
+ ```
346
+ ````
347
+
348
+ === example label="Router" color=cyan filename=app.html lang=html
349
+
350
+ ```html
351
+ <main></main>
352
+ ```
353
+
354
+ :::
355
+
356
+ ````
357
+
358
+ Supported parts:
359
+
360
+ - `header`: carousel heading and intro.
361
+ - `example`: repeated slides.
362
+
363
+ Example options:
364
+
365
+ - `label`: slide label.
366
+ - `color`: label color modifier. The template uses orange/cyan.
367
+ - `filename`: code snippet filename label.
368
+ - `lang`: syntax label passed to the code snippet renderer.
369
+
370
+ Scripts:
371
+
372
+ - This layout emits markup with `data-fading-citrus-showcase`.
373
+ - `template.config.js` includes the `showcase` script only on pages containing that marker.
374
+ - The script handles previous/next buttons, dots, clones for looping, transition reset, and resize alignment.
375
+
376
+ ## `landing-install`
377
+
378
+ Purpose: install command tab set with copy buttons.
379
+
380
+ Syntax:
381
+
382
+ ```md
383
+ ::: layout landing-install
384
+
385
+ === header
386
+
387
+ `// install`
388
+
389
+ ## Start in seconds.
390
+
391
+ Choose your package manager.
392
+
393
+ === tab key=npm label=npm command="npm install package-name"
394
+
395
+ npm install package-name
396
+
397
+ === tab key=yarn label=yarn command="yarn add package-name"
398
+
399
+ yarn add package-name
400
+
401
+ :::
402
+ ````
403
+
404
+ Supported parts:
405
+
406
+ - `header`: section heading and intro.
407
+ - `tab`: repeated package manager tabs.
408
+
409
+ Tab options:
410
+
411
+ - `key`: tab id.
412
+ - `label`: tab button label.
413
+ - `command`: command copied to clipboard.
414
+
415
+ Scripts:
416
+
417
+ - This layout emits markup with `data-fading-citrus-install`.
418
+ - `template.config.js` includes the `install` script only on pages containing that marker.
419
+ - The script handles tab switching and command copy feedback.
420
+
421
+ Current behavior:
422
+
423
+ - The second tab is active by default.
424
+ - Override `landing-install.js` if that default should be configurable.
425
+
426
+ ## `landing-cta`
427
+
428
+ Purpose: final landing call-to-action section.
429
+
430
+ Syntax:
431
+
432
+ ```md
433
+ ::: layout landing-cta title="Build with the platform." title2="Ship less JavaScript."
434
+
435
+ === copy
436
+
437
+ Final CTA copy.
438
+
439
+ :::
440
+ ```
441
+
442
+ Supported layout options:
443
+
444
+ - `title`: first heading segment.
445
+ - `title2`: second heading segment.
446
+
447
+ Supported parts:
448
+
449
+ - `copy`: CTA body copy.
450
+
451
+ Current behavior:
452
+
453
+ - The CTA buttons link to `/documentation/get-started` and `/documentation/index.html?v=20260621exact`.
454
+ - Override `landing-cta.js` if those links need to be configurable.
455
+
456
+ ## Code Snippets
457
+
458
+ Code snippets are handled by:
459
+
460
+ ```txt
461
+ layouts/_code-snippet.js
462
+ ```
463
+
464
+ The template config overrides the default Markdown code renderer:
465
+
466
+ ```js
467
+ markedOptions: {
468
+ renderer: {
469
+ code({ lang, raw }) {
470
+ return renderCodeBlock('', rawCode, lang)
471
+ },
472
+ },
473
+ }
474
+ ```
475
+
476
+ This means fenced code blocks render with:
477
+
478
+ - a framed code panel
479
+ - mac-style dots
480
+ - filename area
481
+ - language label
482
+ - line numbers
483
+ - syntax token styling
484
+ - copy button
485
+
486
+ Scripts:
487
+
488
+ - Code snippets emit `code-copy-btn`.
489
+ - `template.config.js` includes the `code-copy` script only on pages containing that marker.
490
+ - The script uses the nearest `.code-snippet` container and copies the `data-code` value.
491
+
492
+ ## Theme Variables
493
+
494
+ The template defines light and dark CSS variable maps in `template.config.js`.
495
+
496
+ Primary variables:
497
+
498
+ - `--background`
499
+ - `--foreground`
500
+ - `--card`
501
+ - `--primary`
502
+ - `--primary-glow`
503
+ - `--primary-foreground`
504
+ - `--secondary`
505
+ - `--muted`
506
+ - `--muted-foreground`
507
+ - `--accent`
508
+ - `--border`
509
+ - `--ring`
510
+ - `--code-bg`
511
+
512
+ Syntax variables:
513
+
514
+ - `--syntax-comment`
515
+ - `--syntax-keyword`
516
+ - `--syntax-string`
517
+ - `--syntax-tag`
518
+ - `--syntax-attr`
519
+
520
+ Effect variables:
521
+
522
+ - `--gradient-hero`
523
+ - `--gradient-primary`
524
+ - `--gradient-text`
525
+ - `--gradient-border`
526
+ - `--shadow-glow`
527
+ - `--shadow-card`
528
+
529
+ Override only values from a docs project:
530
+
531
+ ```js
532
+ export default {
533
+ theme: {
534
+ light: {
535
+ '--primary': 'oklch(0.62 0.18 250)',
536
+ },
537
+ dark: {
538
+ '--primary': 'oklch(0.78 0.16 250)',
539
+ },
540
+ },
541
+ }
542
+ ```
543
+
544
+ Disable a mode by setting it to `false`:
545
+
546
+ ```js
547
+ export default {
548
+ theme: {
549
+ light: false,
550
+ },
551
+ }
552
+ ```
553
+
554
+ With `light: false`, the dark variables become the default `:root` theme for this template and light-mode selectors are not emitted. This is useful for docs sites that should stay dark-only.
555
+
556
+ Place that in:
557
+
558
+ ```txt
559
+ docs/_template/template.config.js
560
+ ```
561
+
562
+ ## Assets
563
+
564
+ The template includes a default asset set. Not all assets are generic; several exist because the template originally shipped with the Markup site.
565
+
566
+ Generic or shared assets:
567
+
568
+ - `logo.svg`: main site logo used by header and footer.
569
+ - `before-semicolon-logo.png`: small footer credit mark.
570
+ - `favicon/*`: default favicons.
571
+ - social icons: `medium2.svg`, `facebook.svg`, `instagram.svg`, `reddit.svg`, `twitter.svg`, `youtube.svg`.
572
+
573
+ Markup-specific assets still present:
574
+
575
+ - `markup-banner.jpg`
576
+ - `markup-essentials-training.jpg`
577
+ - `markup-favicon.*`
578
+ - `markup-logo*`
579
+ - `client-server.svg`
580
+ - `fast.svg`
581
+ - `independent.svg`
582
+ - `reactive.svg`
583
+ - `simple.svg`
584
+ - `small.svg`
585
+
586
+ Override assets from a docs project by adding files at the same target path:
587
+
588
+ ```txt
589
+ docs/_template/assets/logo.svg
590
+ docs/_template/assets/favicon/favicon.ico
591
+ docs/_template/assets/markup-banner.jpg
592
+ ```
593
+
594
+ Because `docs/_template/assets` is copied into `publicDir/assets` after template assets, source assets can replace template assets.
595
+
596
+ ## Stylesheets
597
+
598
+ Stylesheets shipped by the template:
599
+
600
+ - `normalize.css`: baseline reset.
601
+ - `fonts.css`: bundled font-face declarations.
602
+ - `common.css`: shared header, footer, buttons, variables, and document primitives.
603
+ - `landing.css`: landing page sections and responsive behavior.
604
+ - `documentation.css`: documentation layout, article content, side nav, and table of contents.
605
+ - `github-dark.hightlighter.css`
606
+ - `github-light.hightlighter.css`
607
+ - `hybrid.hightlighter.css`
608
+
609
+ The page layouts currently include:
610
+
611
+ - `landing.css` for `layout: landing`
612
+ - `documentation.css` for `layout: document`
613
+ - `theme.css` when theme variables are configured
614
+
615
+ The landing and documentation stylesheets import or rely on the shared styles as authored in this template. If you override styles, preserve required class names or override the corresponding layout handlers.
616
+
617
+ ## Scripts
618
+
619
+ Template scripts are registered by marker:
620
+
621
+ ```js
622
+ scripts: {
623
+ 'code-copy': {
624
+ match: 'code-copy-btn',
625
+ render: renderCodeCopyScript,
626
+ },
627
+ showcase: {
628
+ match: 'data-fading-citrus-showcase',
629
+ render: renderShowcaseScript,
630
+ },
631
+ install: {
632
+ match: 'data-fading-citrus-install',
633
+ render: renderInstallScript,
634
+ },
635
+ }
636
+ ```
637
+
638
+ This keeps pages from receiving scripts for layout parts they do not use.
639
+
640
+ Disable a script from a docs project:
641
+
642
+ ```js
643
+ export default {
644
+ scripts: {
645
+ showcase: false,
646
+ },
647
+ }
648
+ ```
649
+
650
+ Override a script:
651
+
652
+ ```js
653
+ export default {
654
+ scripts: {
655
+ showcase: {
656
+ match: 'data-fading-citrus-showcase',
657
+ render: () =>
658
+ `<script type="application/javascript">/* custom */</script>`,
659
+ },
660
+ },
661
+ }
662
+ ```
663
+
664
+ ## Extension Strategy
665
+
666
+ Use the smallest override that solves the problem:
667
+
668
+ 1. Override assets for logos, favicons, images, and icons.
669
+ 2. Override theme variables for color and surface tuning.
670
+ 3. Add Markdown layout handlers for new page sections.
671
+ 4. Override existing Markdown layout handlers only when the section HTML needs to change.
672
+ 5. Override `_header.js`, `_footer.js`, or `_head-meta.js` when navigation, footer copy, metadata, or brand assumptions need to change.
673
+ 6. Override `landing.js` or `document.js` only when the full page shell changes.
674
+
675
+ Example docs extension:
676
+
677
+ ```txt
678
+ docs/
679
+ index.md
680
+ _template/
681
+ template.config.js
682
+ assets/
683
+ logo.svg
684
+ layouts/
685
+ pricing-cards.js
686
+ ```
687
+
688
+ ```js
689
+ // docs/_template/template.config.js
690
+ import pricingCards from './layouts/pricing-cards.js'
691
+
692
+ export default {
693
+ markdownLayouts: {
694
+ 'pricing-cards': pricingCards,
695
+ },
696
+ theme: {
697
+ light: {
698
+ '--primary': 'oklch(0.62 0.18 250)',
699
+ },
700
+ dark: {
701
+ '--primary': 'oklch(0.78 0.16 250)',
702
+ },
703
+ },
704
+ }
705
+ ```
706
+
707
+ ## Known Template-Specific Assumptions
708
+
709
+ Some template internals are still Markup or Before Semicolon oriented:
710
+
711
+ - `_head-meta.js` has Markup-specific defaults and URLs.
712
+ - `_header.js` has Markup-oriented GitHub and documentation links.
713
+ - `_footer.js` has Before Semicolon social links, footer copy, and learning links.
714
+ - `document.js` builds edit links against the Markup GitHub docs path.
715
+ - Some landing layout handlers contain default labels or links aimed at Markup docs.
716
+ - Several assets are Markup-specific.
717
+
718
+ These are template defaults, not builder requirements. Override them from `docs/_template` for another documentation site.
719
+
720
+ ## Minimal Landing Page
721
+
722
+ ````md
723
+ ---
724
+ title: Example
725
+ description: Example documentation.
726
+ layout: landing
727
+ ---
728
+
729
+ ::: layout landing-hero title="Example Docs." title2="Built fast." primaryLabel="Read Docs" secondaryLabel="npm i example"
730
+
731
+ === copy
732
+
733
+ Useful docs for a focused package.
734
+
735
+ === stat
736
+
737
+ ## Small
738
+
739
+ runtime
740
+
741
+ === code filename=example.js lang=javascript
742
+
743
+ ```javascript
744
+ import { example } from 'example'
745
+
746
+ example()
747
+ ```
748
+ ````
749
+
750
+ :::
751
+
752
+ ````
753
+
754
+ ## Minimal Documentation Page
755
+
756
+ ```md
757
+ ---
758
+ name: Get Started
759
+ title: Get Started
760
+ description: Install and use the package.
761
+ layout: document
762
+ order: 1
763
+ ---
764
+
765
+ # Get Started
766
+
767
+ Install the package and render your first example.
768
+ ````
769
+
770
+ For the default `document` layout, place documentation pages under `docs/documentation` so the side navigation can be generated from the `documentation` site map group.