Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ulivz/rspress-plugin-remote-page

An Rspress plugin to seamlessly load remote markdown file (e.g. README.md) onto your website.
https://github.com/ulivz/rspress-plugin-remote-page

Last synced: 27 days ago
JSON representation

An Rspress plugin to seamlessly load remote markdown file (e.g. README.md) onto your website.

Awesome Lists containing this project

README

        

rspress-plugin-remote-page


An Rspress plugin to seamlessly load remote markdown file (e.g. README.md) onto your website.


NPM version
NPM downloads
Build Status

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Install](#install)
- [Usage](#usage)
- [Quickly load a `README.md` file from GitHub using a shortcut](#quickly-load-a-readmemd-file-from-github-using-a-shortcut)
- [Capable of loading any Markdown file from GitHub](#capable-of-loading-any-markdown-file-from-github)
- [Supports loading any remote Markdown files](#supports-loading-any-remote-markdown-files)
- [Options](#options)
- [pages](#pages)
- [remotePath](#remotepath)
- [routePath](#routepath)
- [TODOs](#todos)
- [License](#license)

## Install

```bash
npm install rspress-plugin-remote-page -D
```

## Usage

### Quickly load a `README.md` file from GitHub using a shortcut

```ts
// rspress.config.ts
import { remotePage } from 'rspress-plugin-remote-page';
import { defineConfig } from 'rspress/config';

export default defineConfig({
plugins: [remotePage({
pages: [
{
// This input will load README.md of https://github.com/ulivz/rspress-plugin-remote-page
remotePath: 'ulivz/rspress-plugin-remote-page',
routePath: '/readme',
}
]
})],
});
```

### Capable of loading any Markdown file from GitHub

```ts
// rspress.config.ts
import { remotePage } from 'rspress-plugin-remote-page';
import { defineConfig } from 'rspress/config';

export default defineConfig({
plugins: [remotePage({
pages: [
{
remotePath: 'https://github.com/ulivz/rspress-plugin-remote-page/blob/main/README.md',
routePath: '/readme',
}
]
})],
});
```

### Supports loading any remote Markdown files

```ts
// rspress.config.ts
import { remotePage } from 'rspress-plugin-remote-page';
import { defineConfig } from 'rspress/config';

export default defineConfig({
plugins: [remotePage({
pages: [
{
remotePath: 'https://path/to/your-markdown.md',
routePath: '/readme',
}
]
})],
});
```

## Options

### pages

#### remotePath

- **Type**: `string`
- **Required**: `true`

Specify the remote path, it could be:

1. Github repository shortcut, e.g. `web-infra-dev/deep-dive-into-tla`;
2. Github repository repo path, e.g. `https://github.com/web-infra-dev/deep-dive-into-tla`;
3. Github path, e.g. `https://github.com/web-infra-dev/deep-dive-into-tla/blob/master/README-zh-CN.md`;
4. Any remote path, e.g. `https://path/to/your-markdown.md`;

#### routePath

- **Type**: `string`
- **Default**: `master`

Specify the generated route.

## TODOs

- Support remote `*.mdx`.
- Enhance logging output.
- Enhance error handling when fetching pages.

## License

MIT © [ULIVZ](https://github.com/ulivz)