@writedocs/generator 0.13.4 → 0.13.5

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.
Files changed (86) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +356 -356
  4. package/package.json +99 -99
  5. package/src/cli/base-path-layout.js +44 -44
  6. package/src/cli/build-auth.js +135 -135
  7. package/src/cli/build.js +203 -203
  8. package/src/cli/check-built-styles.js +41 -41
  9. package/src/cli/convert.js +124 -124
  10. package/src/cli/dev.js +268 -268
  11. package/src/cli/exit-when-flushed.js +42 -42
  12. package/src/cli/generate-api-pages.js +507 -507
  13. package/src/cli/og-image-worker.js +20 -20
  14. package/src/cli/og-images.js +70 -70
  15. package/src/cli/page-list-watch.js +69 -69
  16. package/src/cli/run-astro.js +97 -97
  17. package/src/cli/run-pagefind.js +154 -154
  18. package/src/cli/write-mcp-files.js +103 -103
  19. package/src/cli/write-redirects-file.js +158 -158
  20. package/src/components/ApiReferencePanel.astro +1792 -1792
  21. package/src/components/AppIcon.astro +51 -51
  22. package/src/components/Card.astro +193 -193
  23. package/src/components/CodeGroup.astro +63 -39
  24. package/src/components/CopyPageMenu.astro +374 -374
  25. package/src/components/Hint.astro +188 -188
  26. package/src/components/Icon.astro +72 -72
  27. package/src/components/Image.astro +165 -165
  28. package/src/components/Tile.astro +67 -67
  29. package/src/components/Video.astro +137 -137
  30. package/src/content.config.ts +203 -203
  31. package/src/layout/BaseLayout.astro +908 -908
  32. package/src/layout/components/AnalyticsScripts.astro +49 -49
  33. package/src/layout/components/Breadcrumbs.astro +98 -98
  34. package/src/layout/components/ConsentBanner.astro +119 -119
  35. package/src/layout/components/MobileMenu.astro +225 -225
  36. package/src/layout/components/NavTree.astro +408 -408
  37. package/src/layout/components/Sidebar.astro +232 -232
  38. package/src/layout/components/SiteFooter.astro +87 -87
  39. package/src/layout/components/TopBar.astro +386 -386
  40. package/src/layout/styles/base.css +332 -326
  41. package/src/layout/styles/mobile-menu.css +285 -285
  42. package/src/lib/agent-markdown.js +164 -164
  43. package/src/lib/asset-dimensions.js +89 -89
  44. package/src/lib/base-path.js +90 -90
  45. package/src/lib/cli-report.js +22 -22
  46. package/src/lib/code-line-numbers.js +13 -0
  47. package/src/lib/config-schema.ts +2509 -2509
  48. package/src/lib/config.ts +1316 -1316
  49. package/src/lib/consent.js +108 -108
  50. package/src/lib/content-store-reload-integration.js +101 -101
  51. package/src/lib/icon-data-dev.js +53 -53
  52. package/src/lib/image-size.js +152 -152
  53. package/src/lib/json-schema-descriptions.js +228 -228
  54. package/src/lib/link-check.js +544 -544
  55. package/src/lib/llms-index.ts +90 -90
  56. package/src/lib/mcp-dev-integration.js +65 -65
  57. package/src/lib/mcp-index.ts +102 -102
  58. package/src/lib/mintlify-convert.js +605 -605
  59. package/src/lib/moved-api-pages.js +49 -49
  60. package/src/lib/og-cards.js +33 -33
  61. package/src/lib/og-image.js +235 -235
  62. package/src/lib/openapi-dev-status.js +80 -80
  63. package/src/lib/openapi-reload-integration.js +193 -193
  64. package/src/lib/pages.js +312 -312
  65. package/src/lib/project-files-integration.js +116 -116
  66. package/src/lib/project-files.js +137 -137
  67. package/src/lib/rehype-base-path.js +62 -62
  68. package/src/lib/rehype-image-loading.js +71 -71
  69. package/src/lib/robots-txt.js +21 -21
  70. package/src/lib/search-scope.js +44 -44
  71. package/src/lib/selector-placement.js +50 -50
  72. package/src/lib/seo-tags.js +155 -155
  73. package/src/lib/shiki-code-block.js +7 -1
  74. package/src/lib/site-base.ts +27 -27
  75. package/src/lib/styles-asset-integration.js +291 -291
  76. package/src/lib/wdignore-cases.json +195 -195
  77. package/src/lib/wdignore.js +177 -177
  78. package/src/pages/404.astro +63 -63
  79. package/src/pages/[...slug].astro +1762 -1608
  80. package/src/pages/[...slug].md.ts +93 -93
  81. package/src/pages/llms-full.txt.ts +88 -88
  82. package/src/pages/og/[...slug].png.ts +63 -63
  83. package/src/scripts/mobile-menu.ts +80 -80
  84. package/src/scripts/search.ts +245 -245
  85. package/src/scripts/sidebar-scroll.ts +61 -61
  86. package/src/styles/global.css +40 -40
@@ -1,137 +1,137 @@
1
- ---
2
- import { extraClasses } from './class-names';
3
- import { siteHref } from '../lib/site-base';
4
- // Renders either a native <video> or an <iframe> embed from the same
5
- // `src` prop, auto-detected rather than requiring the author to pick -
6
- // `src="media/clip.mp4"` (a direct video file, local or remote) gets a
7
- // real <video controls>; `src="https://www.youtube.com/embed/..."` (or
8
- // Vimeo, Loom, any other embed URL with no recognizable video file
9
- // extension) gets an <iframe>. Same block-level, own-line, centered
10
- // shape as Image/Frame, and shares their exact card language (border-
11
- // radius, padding, box-shadow) - "same border radius as image and
12
- // frame" was the explicit ask this was built against.
13
- interface Props {
14
- src: string;
15
- // A raw CSS width ("500px", "80%", "40rem", ...) - named `width`
16
- // here (not `size`, Image's own name for the same idea) to match
17
- // this component's own requested API exactly. Same "applied to the
18
- // wrapping figure, not the media element" approach Image.astro's own
19
- // `size` prop uses (see its comment for the real bug that came from
20
- // getting this wrong once already) - the whole component, card
21
- // background included, sizes to `width`, not just the video/iframe
22
- // inside it.
23
- width?: string;
24
- // Only meaningful for the <video> branch - ignored (not rendered as
25
- // an attribute at all) for an <iframe> embed, since a YouTube/Vimeo
26
- // player controls its own playback UI, autoplay policy, and looping
27
- // through its own embed URL query params instead.
28
- controls?: boolean;
29
- autoplay?: boolean;
30
- loop?: boolean;
31
- muted?: boolean;
32
- // Alt text has no real equivalent for video - `title` is the
33
- // accessible-name attribute both <video> (via a wrapping description)
34
- // and <iframe> (a required attribute for a11y tooling to identify
35
- // embedded content) actually use.
36
- title?: string;
37
- caption?: string;
38
- }
39
- const {
40
- src,
41
- width,
42
- controls = true,
43
- autoplay = false,
44
- loop = false,
45
- muted = false,
46
- title,
47
- caption,
48
- } = Astro.props as Props;
49
- const isFile = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?(#.*)?$/i.test(src);
50
- const sizeStyle = width ? `--wd-video-size:${width}` : undefined;
51
- // Autoplaying video muted is a hard browser requirement, not a style
52
- // choice - every major browser silently blocks (or, worse, plays with
53
- // sound the visitor didn't ask for and then gets auto-paused
54
- // inconsistently) an unmuted autoplay <video>, so an author setting
55
- // autoplay without also remembering muted would get a broken-looking
56
- // embed rather than the "plays immediately" behavior they actually
57
- // asked for. Forcing it here means autoplay just works the one way
58
- // it's actually able to.
59
- const effectiveMuted = muted || autoplay;
60
- ---
61
-
62
- <figure class:list={["wd-video-figure", caption && "wd-video-figure-framed", extraClasses(Astro.props)]} style={sizeStyle}>
63
- {
64
- isFile ? (
65
- <video
66
- class="wd-video"
67
- src={siteHref(src)}
68
- controls={controls}
69
- autoplay={autoplay}
70
- loop={loop}
71
- muted={effectiveMuted}
72
- playsinline
73
- title={title}
74
- />
75
- ) : (
76
- <iframe
77
- class="wd-video wd-video-embed"
78
- src={siteHref(src)}
79
- title={title ?? "Embedded video"}
80
- loading="lazy"
81
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
82
- allowfullscreen
83
- />
84
- )
85
- }
86
- {caption && <figcaption class="wd-video-caption">{caption}</figcaption>}
87
- </figure>
88
- <style>
89
- /* Same three rules as Image.astro's own .wd-image-figure/
90
- .wd-image-figure-framed/.wd-image-caption - see that file's own
91
- comments for why width lives on the figure (not the media element),
92
- why padding is what creates the inset-in-a-card look, and why
93
- box-shadow exists alongside the border. Kept in sync on purpose -
94
- both components are explicitly meant to look identical modulo
95
- what's actually inside them. */
96
- .wd-video-figure {
97
- width: var(--wd-video-size, 100%);
98
- max-width: 100%;
99
- margin: 1.25rem auto;
100
- }
101
- .wd-video-figure-framed {
102
- border: 1px solid var(--wd-border);
103
- border-radius: 0.75rem;
104
- background: var(--wd-surface);
105
- padding: 0.5rem;
106
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
107
- }
108
- .wd-video {
109
- display: block;
110
- width: 100%;
111
- height: auto;
112
- border: 0;
113
- border-radius: 0.75rem;
114
- }
115
- /* Unlike <img>/<video> (both read their own intrinsic dimensions once
116
- loaded, so width: 100%; height: auto keeps them proportional on
117
- their own), a bare <iframe> has no intrinsic size at all - without
118
- something constraining its height it either collapses to the UA
119
- default (~150px) or needs an explicit pixel height the embedding
120
- author would have to compute themselves. aspect-ratio: 16 / 9 is
121
- the standard embed shape (YouTube, Vimeo, Loom, ...) and needs no
122
- JS/ResizeObserver trick to stay proportional as width changes -
123
- it's a real, if imperfect, default for embeds that aren't actually
124
- 16:9 (a vertical/Shorts-style video letterboxes instead of filling
125
- the frame), which there's no way to detect automatically from a
126
- bare embed URL.
127
- */
128
- .wd-video-embed {
129
- aspect-ratio: 16 / 9;
130
- }
131
- .wd-video-caption {
132
- margin-top: 0.6rem;
133
- text-align: center;
134
- color: var(--wd-text);
135
- font-size: 0.75rem;
136
- }
137
- </style>
1
+ ---
2
+ import { extraClasses } from './class-names';
3
+ import { siteHref } from '../lib/site-base';
4
+ // Renders either a native <video> or an <iframe> embed from the same
5
+ // `src` prop, auto-detected rather than requiring the author to pick -
6
+ // `src="media/clip.mp4"` (a direct video file, local or remote) gets a
7
+ // real <video controls>; `src="https://www.youtube.com/embed/..."` (or
8
+ // Vimeo, Loom, any other embed URL with no recognizable video file
9
+ // extension) gets an <iframe>. Same block-level, own-line, centered
10
+ // shape as Image/Frame, and shares their exact card language (border-
11
+ // radius, padding, box-shadow) - "same border radius as image and
12
+ // frame" was the explicit ask this was built against.
13
+ interface Props {
14
+ src: string;
15
+ // A raw CSS width ("500px", "80%", "40rem", ...) - named `width`
16
+ // here (not `size`, Image's own name for the same idea) to match
17
+ // this component's own requested API exactly. Same "applied to the
18
+ // wrapping figure, not the media element" approach Image.astro's own
19
+ // `size` prop uses (see its comment for the real bug that came from
20
+ // getting this wrong once already) - the whole component, card
21
+ // background included, sizes to `width`, not just the video/iframe
22
+ // inside it.
23
+ width?: string;
24
+ // Only meaningful for the <video> branch - ignored (not rendered as
25
+ // an attribute at all) for an <iframe> embed, since a YouTube/Vimeo
26
+ // player controls its own playback UI, autoplay policy, and looping
27
+ // through its own embed URL query params instead.
28
+ controls?: boolean;
29
+ autoplay?: boolean;
30
+ loop?: boolean;
31
+ muted?: boolean;
32
+ // Alt text has no real equivalent for video - `title` is the
33
+ // accessible-name attribute both <video> (via a wrapping description)
34
+ // and <iframe> (a required attribute for a11y tooling to identify
35
+ // embedded content) actually use.
36
+ title?: string;
37
+ caption?: string;
38
+ }
39
+ const {
40
+ src,
41
+ width,
42
+ controls = true,
43
+ autoplay = false,
44
+ loop = false,
45
+ muted = false,
46
+ title,
47
+ caption,
48
+ } = Astro.props as Props;
49
+ const isFile = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?(#.*)?$/i.test(src);
50
+ const sizeStyle = width ? `--wd-video-size:${width}` : undefined;
51
+ // Autoplaying video muted is a hard browser requirement, not a style
52
+ // choice - every major browser silently blocks (or, worse, plays with
53
+ // sound the visitor didn't ask for and then gets auto-paused
54
+ // inconsistently) an unmuted autoplay <video>, so an author setting
55
+ // autoplay without also remembering muted would get a broken-looking
56
+ // embed rather than the "plays immediately" behavior they actually
57
+ // asked for. Forcing it here means autoplay just works the one way
58
+ // it's actually able to.
59
+ const effectiveMuted = muted || autoplay;
60
+ ---
61
+
62
+ <figure class:list={["wd-video-figure", caption && "wd-video-figure-framed", extraClasses(Astro.props)]} style={sizeStyle}>
63
+ {
64
+ isFile ? (
65
+ <video
66
+ class="wd-video"
67
+ src={siteHref(src)}
68
+ controls={controls}
69
+ autoplay={autoplay}
70
+ loop={loop}
71
+ muted={effectiveMuted}
72
+ playsinline
73
+ title={title}
74
+ />
75
+ ) : (
76
+ <iframe
77
+ class="wd-video wd-video-embed"
78
+ src={siteHref(src)}
79
+ title={title ?? "Embedded video"}
80
+ loading="lazy"
81
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
82
+ allowfullscreen
83
+ />
84
+ )
85
+ }
86
+ {caption && <figcaption class="wd-video-caption">{caption}</figcaption>}
87
+ </figure>
88
+ <style>
89
+ /* Same three rules as Image.astro's own .wd-image-figure/
90
+ .wd-image-figure-framed/.wd-image-caption - see that file's own
91
+ comments for why width lives on the figure (not the media element),
92
+ why padding is what creates the inset-in-a-card look, and why
93
+ box-shadow exists alongside the border. Kept in sync on purpose -
94
+ both components are explicitly meant to look identical modulo
95
+ what's actually inside them. */
96
+ .wd-video-figure {
97
+ width: var(--wd-video-size, 100%);
98
+ max-width: 100%;
99
+ margin: 1.25rem auto;
100
+ }
101
+ .wd-video-figure-framed {
102
+ border: 1px solid var(--wd-border);
103
+ border-radius: 0.75rem;
104
+ background: var(--wd-surface);
105
+ padding: 0.5rem;
106
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
107
+ }
108
+ .wd-video {
109
+ display: block;
110
+ width: 100%;
111
+ height: auto;
112
+ border: 0;
113
+ border-radius: 0.75rem;
114
+ }
115
+ /* Unlike <img>/<video> (both read their own intrinsic dimensions once
116
+ loaded, so width: 100%; height: auto keeps them proportional on
117
+ their own), a bare <iframe> has no intrinsic size at all - without
118
+ something constraining its height it either collapses to the UA
119
+ default (~150px) or needs an explicit pixel height the embedding
120
+ author would have to compute themselves. aspect-ratio: 16 / 9 is
121
+ the standard embed shape (YouTube, Vimeo, Loom, ...) and needs no
122
+ JS/ResizeObserver trick to stay proportional as width changes -
123
+ it's a real, if imperfect, default for embeds that aren't actually
124
+ 16:9 (a vertical/Shorts-style video letterboxes instead of filling
125
+ the frame), which there's no way to detect automatically from a
126
+ bare embed URL.
127
+ */
128
+ .wd-video-embed {
129
+ aspect-ratio: 16 / 9;
130
+ }
131
+ .wd-video-caption {
132
+ margin-top: 0.6rem;
133
+ text-align: center;
134
+ color: var(--wd-text);
135
+ font-size: 0.75rem;
136
+ }
137
+ </style>