Skip to content

Commit

Permalink
Merge pull request #43 from HiDeoo/hd-docs-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
HiDeoo authored Jun 24, 2024
2 parents 90194c7 + 36da21b commit 24d2cad
Show file tree
Hide file tree
Showing 8 changed files with 1,882 additions and 97 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## Docs

Run the docs locally using your favorite package manager, e.g. with [pnpm](https://pnpm.io):
Run the docs locally using [pnpm](https://pnpm.io):

```shell
pnpm run dev
Expand Down
13 changes: 11 additions & 2 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ export default defineConfig({
baseUrl: 'https://github.com/HiDeoo/starlight-links-validator/edit/main/docs/',
},
sidebar: [
{ label: 'Getting Started', link: '/getting-started/' },
{ label: 'Configuration', link: '/configuration/' },
{
label: 'Start Here',
items: [
{ label: 'Getting Started', link: '/getting-started/' },
{ label: 'Configuration', link: '/configuration/' },
],
},
{
label: 'Resources',
items: [{ label: 'Plugins and Tools', link: '/resources/starlight/' }],
},
],
social: {
github: 'https://github.com/HiDeoo/starlight-links-validator',
Expand Down
5 changes: 3 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"lint": "prettier -c --cache . && eslint . --cache --max-warnings=0"
},
"dependencies": {
"@astrojs/starlight": "0.15.0",
"astro": "4.0.4",
"@astrojs/starlight": "0.24.4",
"@hideoo/starlight-plugins-docs-components": "^0.1.1",
"astro": "4.11.0",
"sharp": "0.32.6"
},
"engines": {
Expand Down
81 changes: 26 additions & 55 deletions docs/src/content/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
title: Getting Started
---

import { Tabs, TabItem } from '@astrojs/starlight/components'

## Features

A [Starlight](https://starlight.astro.build) plugin to validate **_internal_** links in Markdown and MDX files.

- Validate internal links to other pages
Expand All @@ -14,67 +10,42 @@ A [Starlight](https://starlight.astro.build) plugin to validate **_internal_** l
- Ignore external links
- Run only during a production build

## Install the plugin

Starlight Links Validator is a Starlight [plugin](https://starlight.astro.build/reference/plugins/). Install it using your favorite package manager:

<Tabs>
<TabItem label="npm">

```sh
npm install starlight-links-validator
```

</TabItem>
<TabItem label="pnpm">

```sh
pnpm add starlight-links-validator
```
## Prerequisites

</TabItem>
<TabItem label="Yarn">
You will need to have a Starlight website set up.
If you don't have one yet, you can follow the ["Getting Started"](https://starlight.astro.build/getting-started) guide in the Starlight docs to create one.

```sh
yarn add starlight-links-validator
```
## Installation

</TabItem>
<TabItem label="Bun">
import { Steps } from '@astrojs/starlight/components'
import { PackageManagers } from '@hideoo/starlight-plugins-docs-components'

```sh
bun add starlight-links-validator
```
<Steps>

</TabItem>
<TabItem label="ni">
1. Starlight Links Validator is a Starlight [plugin](https://starlight.astro.build/reference/plugins/). Install it using your favorite package manager:

```sh
ni starlight-links-validator
```
<PackageManagers pkg="starlight-image-zoom" />

</TabItem>
</Tabs>
2. Configure the plugin in your Starlight [configuration](https://starlight.astro.build/reference/configuration/#plugins) in the `astro.config.mjs` file.

## Add the plugin
```diff lang="js"
// astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
+import starlightLinksValidator from 'starlight-links-validator'

The Starlight Links Validator plugin can be added to your Starlight [configuration](https://starlight.astro.build/reference/configuration/#plugins) in the `astro.config.mjs` file:
export default defineConfig({
integrations: [
starlight({
+ plugins: [starlightLinksValidator()],
title: 'My Docs',
}),
],
})
```

```diff lang="js"
// astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
+import starlightLinksValidator from 'starlight-links-validator'
3. Run a [production build](https://docs.astro.build/en/reference/cli-reference/#astro-build) to validate all internal links in your Markdown and MDX files.

export default defineConfig({
integrations: [
starlight({
+ plugins: [starlightLinksValidator()],
title: 'My Docs',
}),
],
})
```
</Steps>

Running a production build will now validate all internal links in your Markdown and MDX files.
The Starlight Links Validator plugin behavior can be tweaked using various [configuration options](/configuration).
6 changes: 6 additions & 0 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ import { Card, CardGrid } from '@astrojs/starlight/components'
## Next steps

<CardGrid stagger>
<Card title="Install the plugin" icon="puzzle">
Check the [getting started guide](/getting-started/) for installation instructions.
</Card>
<Card title="Configure the plugin" icon="setting">
Edit your config in `astro.config.mjs`.
</Card>
<Card title="Build your site" icon="error">
Get errors on broken links before deploying your site.
</Card>
<Card title="Read the docs" icon="open-book">
Learn more in [the Starlight Links Validator Docs](/getting-started/).
</Card>
Expand Down
20 changes: 20 additions & 0 deletions docs/src/content/docs/resources/starlight.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Starlight Plugins and Tools
description: Discover other Starlight plugins, components and tools developed by HiDeoo.
---

import { ResourcesIntro, Resources } from '@hideoo/starlight-plugins-docs-components'

<ResourcesIntro />

## Plugins

<Resources type="plugins" />

## Components

<Resources type="components" />

## Tools

<Resources type="tools" />
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## Example

Run the example locally using your favorite package manager, e.g. with [pnpm](https://pnpm.io):
Run the example locally using [pnpm](https://pnpm.io):

```shell
pnpm run build
Expand Down
Loading

0 comments on commit 24d2cad

Please sign in to comment.