Skip to content

Commit

Permalink
Make sure option details get wrapped in <p>
Browse files Browse the repository at this point in the history
Turns out Markdown (remark? remark in Astro??) was deciding some lines were _not_ a paragraph if they contained an HTML tag — whether that were a `<br>` tag or the new `<Since />` component. This explicitly wraps the block containing the component in a `<p>` tag and also uses the more explicit `<br>` over two trailing spaces for clarity.

(An empty line is needed after the opening `<p>` to have the following text still parse as Markdown.)
  • Loading branch information
delucis committed Mar 13, 2022
1 parent 4399fd6 commit 35d1f4b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 14 deletions.
5 changes: 4 additions & 1 deletion scripts/docgen.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ export async function run() {
result += [
`### ${comment.name}`,
``,
`<p>`,
``,
[
`**Type:** \`${typesFormatted}\``,
cliFlag ? `**CLI:** \`${cliFlag.text}\`` : undefined,
comment.defaultvalue ? `**Default:** ${comment.defaultvalue}` : undefined,
comment.version ? `<Since v="${comment.version}" />` : undefined
].filter(l => l !== undefined).join(' \n'),
].filter(l => l !== undefined).join('<br>\n'),
`</p>`,
``,
comment.description && comment.description.trim(),
comment.see ? `**See Also:**\n${comment.see.map(s => `- ${s}`.trim()).join('\n')}` : undefined,
Expand Down
71 changes: 58 additions & 13 deletions src/pages/en/reference/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ export default /** @type {import('astro').AstroUserConfig} */ ({

### projectRoot

**Type:** `string`
**CLI:** `--project-root`
<p>

**Type:** `string`<br>
**CLI:** `--project-root`<br>
**Default:** `"."` (current working directory)
</p>

You should only provide this option if you run the `astro` CLI commands in a directory other than the project root directory. Usually, this option is provided via the CLI instead of the `astro.config.js` file, since Astro needs to know your project root before it can locate your config file.

Expand All @@ -53,8 +56,11 @@ $ astro build --project-root ./my-project-directory

### dist

**Type:** `string`
<p>

**Type:** `string`<br>
**Default:** `"./dist"`
</p>

Set the directory that `astro build` writes your final build to.

Expand All @@ -69,8 +75,11 @@ The value can be either an absolute file system path or a path relative to the p

### public

**Type:** `string`
<p>

**Type:** `string`<br>
**Default:** `"./public"`
</p>

Set the directory for your static assets. Files in this directory are served at `/` during dev and copied to your build directory during build. These files are always served or copied as-is, without transform or bundling.

Expand All @@ -85,8 +94,11 @@ The value can be either an absolute file system path or a path relative to the p

### renderers

**Type:** `Array.<string>`
<p>

**Type:** `Array.<string>`<br>
**Default:** `['@astrojs/renderer-svelte','@astrojs/renderer-vue','@astrojs/renderer-react','@astrojs/renderer-preact']`
</p>

Set the UI framework renderers for your project. Framework renderers are what power Astro's ability to use other frameworks inside of your project, like React, Svelte, and Vue.

Expand All @@ -102,7 +114,10 @@ Setting this configuration will disable Astro's default framework support, so yo

### markdownOptions

<p>

**Type:** `Object`
</p>

Configure how markdown files (`.md`) are rendered.

Expand Down Expand Up @@ -131,7 +146,10 @@ Configure how markdown files (`.md`) are rendered.

### site

<p>

**Type:** `string`
</p>

Your final, deployed URL. Astro uses this full URL to generate your sitemap and canonical URLs in your final build. It is strongly recommended that you set this configuration to get the most out of Astro.

Expand All @@ -149,8 +167,11 @@ Astro will match the site pathname during development so that your development e

### sitemap

**Type:** `boolean`
<p>

**Type:** `boolean`<br>
**Default:** `true`
</p>

Generate a sitemap for your build. Set to false to disable.

Expand All @@ -168,7 +189,10 @@ Astro will automatically generate a sitemap including all generated pages on you

### sitemapFilter

<p>

**Type:** `(page: string) => boolean`
</p>

By default, all pages are included in your generated sitemap.
You can filter included pages by URL using `buildOptions.sitemapFilter`.
Expand All @@ -190,8 +214,11 @@ Return `true` to include a page in your sitemap, and `false` to remove it.

### pageUrlFormat

**Type:** `'file' | 'directory'`
<p>

**Type:** `'file' | 'directory'`<br>
**Default:** `'directory'`
</p>

Control the output file format of each page.
- If 'file', Astro will generate an HTML file (ex: "/foo.html") for each page.
Expand All @@ -209,8 +236,11 @@ Control the output file format of each page.

### drafts

**Type:** `boolean`
<p>

**Type:** `boolean`<br>
**Default:** `false`
</p>

Control if markdown draft pages should be included in the build.

Expand All @@ -230,9 +260,12 @@ A markdown page is considered a draft if it includes `draft: true` in its front

### host

**Type:** `string | boolean`
**Default:** `false`
<p>

**Type:** `string | boolean`<br>
**Default:** `false`<br>
<Since v="0.24.0" />
</p>

Set which network IP addresses the dev server should listen on (i.e. non-localhost IPs).
- `false` - do not expose on a network IP address
Expand All @@ -242,8 +275,11 @@ Set which network IP addresses the dev server should listen on (i.e. non-localh

### hostname

**Type:** `string`
<p>

**Type:** `string`<br>
**Default:** `'localhost'`
</p>

> **This option is deprecated.** Consider using `host` instead.
Expand All @@ -252,8 +288,11 @@ Set which IP addresses the dev server should listen on. Set this to 0.0.0.0 to l

### port

**Type:** `number`
<p>

**Type:** `number`<br>
**Default:** `3000`
</p>

Set which port the dev server should listen on.

Expand All @@ -262,8 +301,11 @@ If the given port is already in use, Astro will automatically try the next avail

### trailingSlash

**Type:** `'always' | 'never' | 'ignore'`
<p>

**Type:** `'always' | 'never' | 'ignore'`<br>
**Default:** `'always'`
</p>

Set the route matching behavior of the dev server. Choose from the following options:
- 'always' - Only match URLs that include a trailing slash (ex: "/foo/")
Expand All @@ -288,7 +330,10 @@ You can also set this if you prefer to be more strict yourself, so that URLs wit

### vite

<p>

**Type:** `vite.UserConfig`
</p>

Pass additional configuration options to Vite. Useful when Astro doesn't support some advanced configuration that you may need.

Expand Down

0 comments on commit 35d1f4b

Please sign in to comment.