summaryrefslogtreecommitdiff
path: root/README.md
blob: 35897b3f8a94486aae97480dfe56549d379ed9e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# `astro-gemtext`

Forked from [github.com/aspizu/astro-gemtext](https://github.com/aspizu/astro-gemtext).

`astro-gemtext` is an Astro integration for [gemtext](https://geminiprotocol.net/)
documents. gemtext is a hypertext markup language used in the Gemini protocol. This
integration allows you to use `.gmi` files as pages in your Astro site. Just install
the integration and `.gmi` files in `/src/pages` will be rendered as HTML.

## Installation

```shell
npm install git+https://git.joeac.net/joeac/astro-gemtext
```

Add to `astro.config.mjs`

```ts
import gemtext from "astro-gemtext"

export default defineConfig({
    integrations: [gemtext({layout: "/src/layouts/Layout.astro"})],
})
```

> [!IMPORTANT]
> If you do not provide a layout option, Astro's HMR (Hot Module Reloading) and toolbar
> will not work.

## Usage

Create a .gmi file in your project, for example:

```gmi
# Hello World

This is a gemtext file.

=> gemtext.gemini README.md
```

## Configuration

### `layout`

The layout to use for the page. Set to an absolute import path such as
`/src/layouts/Layout.astro`.
Will be provided the `title` prop.
If you do not provide a layout option, Astro's HMR (Hot Module Reloading) and toolbar
will not work.

### `titleFormat`

The format to use for the page title. Can be one of:

- `first-heading`: The first heading in the document will be used as the title. (default)
- `filename`: The filename of the document will be used as the title.

The title is passed to the layout as the `title` prop.