JSDoc in `astro` repo
Some of the content for the Astro Docs website lives in the main withastro/astro
repository and is written using JSDoc.
Configuration reference
The source documentation for the configuration reference page is located at:
Astro v4:
https://github.com/withastro/astro/blob/main/packages/astro/src/%40types/astro.ts
Astro v5 beta:
https://github.com/withastro/astro/blob/next/packages/astro/src/types/public/config.ts
Common JSDoc tags
Astro uses the following JSDoc tags to produce entries on the configuration reference page:
-
@docs
: indicates that the following entry should be used to generate a documentation entry -
@name
: the heading text to display (name of the property/entry) -
@description
: indicates that the following text should be the body text of the entry -
@kind
: used to specify the heading level of the entry; defaults toh3
-
@type
: the type of the entry (e.g.{string}
,{('static' | 'server')}
) -
@default
: the default value or option -
@version
: the version of Astro in which the feature was released (as stable) -
@see
: a suggested “See Also” entry
Categories (<h2>
)
Entries are separated by categories that are defined as headings. These become <h2>
level headings on the page.
Use @kind heading
to indicate that your entry is a new category of entries. You can optionally add a @description
tag to display text before the first entry:
Main Entries (<h3>
)
Unless specified, each new entry will be written as an <h3>
level heading and will be visible in the configuration reference page’s table of contents.
Sub-headings
Further sub-headings that are not shown in the page table of contents, for example to document a main entry’s options, must use @kind
to specify their heading level.
For example, to document security.checkOrigin
as a subheading of the main security
option, add @kind h4
:
Things to check
- Entries should be added in the proper category. They will appear in the order listed in the source file.
- Only top-level main entries of the category do not require a
@kind
tag to indicate a heading level. - Some characters might need escaping.
- Version numbers should refer to stable release both of Astro and of the feature.