docs: Update Documentation (#2194)
This commit is contained in:
@@ -10,7 +10,7 @@ Community-driven plugin repository for [LNReader](https://github.com/LNReader/ln
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
**Prerequisites:** Node.js >= 20
|
**Prerequisites:** Node.js >= 22
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
|
|||||||
+24
-18
@@ -34,8 +34,8 @@ class ExamplePlugin implements Plugin.PluginBase {}
|
|||||||
| [filters](#pluginbasefilters) | no | [Filter definition](#filter-definition-object) object |
|
| [filters](#pluginbasefilters) | no | [Filter definition](#filter-definition-object) object |
|
||||||
| [pluginSettings](#pluginbasepluginsettings) | no | [Plugin settings](#pluginsettings) object |
|
| [pluginSettings](#pluginbasepluginsettings) | no | [Plugin settings](#pluginsettings) object |
|
||||||
| [popularNovels(page, options)](#pluginbasepopularnovels) | yes | Novel list getter |
|
| [popularNovels(page, options)](#pluginbasepopularnovels) | yes | Novel list getter |
|
||||||
| [parseNovelAndChapters(url)](#pluginbaseparsenovelandchapters) | yes | Novel info and chapter list getter |
|
| [parseNovel(path)](#pluginbaseparsenovel) | yes | Novel info and chapter list getter |
|
||||||
| [parseChapter(url)](#pluginbaseparsechapter) | yes | Chapter text getter |
|
| [parseChapter(path)](#pluginbaseparsechapter) | yes | Chapter text getter |
|
||||||
| [searchNovels(searchTerm, page)](#pluginbasesearchnovels) | yes | Novel searching getter |
|
| [searchNovels(searchTerm, page)](#pluginbasesearchnovels) | yes | Novel searching getter |
|
||||||
|
|
||||||
#### PluginBase::id
|
#### PluginBase::id
|
||||||
@@ -64,12 +64,12 @@ class ExamplePlugin implements Plugin.PluginBase {
|
|||||||
|
|
||||||
#### PluginBase::icon
|
#### PluginBase::icon
|
||||||
|
|
||||||
The path to your plugin's icon inside of `icon` folder
|
The path to your plugin's icon inside of `public/static` folder
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
class ExamplePlugin implements Plugin.PluginBase {
|
class ExamplePlugin implements Plugin.PluginBase {
|
||||||
...
|
...
|
||||||
icon = "src/eng/templateplugin/icon.png";
|
icon = "src/en/templateplugin/icon.png";
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -201,7 +201,7 @@ class ExamplePlugin implements Plugin.PluginBase {
|
|||||||
if(options.filters.example.value === "test"){
|
if(options.filters.example.value === "test"){
|
||||||
novels.push({
|
novels.push({
|
||||||
name: "Novel1",
|
name: "Novel1",
|
||||||
url: "https://example.com/novel1",
|
path: "/novel1",
|
||||||
cover:defaultCover
|
cover:defaultCover
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -218,34 +218,34 @@ This type is used for getting the options of the [popularNovels](#pluginbasepopu
|
|||||||
|
|
||||||
- <span id='popularnovelsoptions-showlatestnovels'></span>`filters: FilterValues<typeof filters>` object containing all selected filter values. [More about Filters](#filters)
|
- <span id='popularnovelsoptions-showlatestnovels'></span>`filters: FilterValues<typeof filters>` object containing all selected filter values. [More about Filters](#filters)
|
||||||
|
|
||||||
#### PluginBase::parseNovelAndChapters
|
#### PluginBase::parseNovel
|
||||||
|
|
||||||
Function that is used to get the information about particular novel and the list of it's chapters
|
Function that is used to get the information about particular novel and the list of it's chapters
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel>
|
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel>
|
||||||
```
|
```
|
||||||
|
|
||||||
See [Using cheerio](#using-cheerio) for more information on how to parse HTML documents
|
See [Using cheerio](#using-cheerio) for more information on how to parse HTML documents
|
||||||
|
|
||||||
###### Parameters
|
###### Parameters
|
||||||
|
|
||||||
- `novelUrl` value from [NovelItem::url](#novelitemurl)
|
- `novelPath` value from [NovelItem::path](#novelitempath)
|
||||||
|
|
||||||
###### Returns
|
###### Returns
|
||||||
|
|
||||||
`SourceNovel` Novel information and chapter list as [SourceNovel](#sourcenovel) object
|
`SourceNovel` Novel information and chapter list as [SourceNovel](#sourcenovel) object
|
||||||
|
|
||||||
> [!CAUTION] > [SourceNovel::url]() should be the same value as [NovelItem::url]() provided as parameter!
|
> [!CAUTION] > [SourceNovel::path]() should be the same value as [NovelItem::path]() provided as parameter!
|
||||||
|
|
||||||
###### Example:
|
###### Example:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
class ExamplePlugin implements Plugin.PluginBase {
|
class ExamplePlugin implements Plugin.PluginBase {
|
||||||
...
|
...
|
||||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel> {
|
||||||
const novel: Plugin.SourceNovel = {
|
const novel: Plugin.SourceNovel = {
|
||||||
url: novelUrl,
|
path: novelPath,
|
||||||
name: "test",
|
name: "test",
|
||||||
artist: "none",
|
artist: "none",
|
||||||
author: "none",
|
author: "none",
|
||||||
@@ -257,7 +257,7 @@ class ExamplePlugin implements Plugin.PluginBase {
|
|||||||
let chapters: Plugin.ChapterItem[] = [];
|
let chapters: Plugin.ChapterItem[] = [];
|
||||||
const chapter: Plugin.ChapterItem = {
|
const chapter: Plugin.ChapterItem = {
|
||||||
name: "",
|
name: "",
|
||||||
url: "",
|
path: "",
|
||||||
releaseTime: "",
|
releaseTime: "",
|
||||||
chapterNumber: 0,
|
chapterNumber: 0,
|
||||||
};
|
};
|
||||||
@@ -274,14 +274,14 @@ class ExamplePlugin implements Plugin.PluginBase {
|
|||||||
Function that is used to get the information about particular novel and the list of it's chapters
|
Function that is used to get the information about particular novel and the list of it's chapters
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
async parseChapter(chapterUrl: string): Promise<string>
|
async parseChapter(chapterPath: string): Promise<string>
|
||||||
```
|
```
|
||||||
|
|
||||||
See [Using cheerio](#using-cheerio) for more information on how to parse HTML documents
|
See [Using cheerio](#using-cheerio) for more information on how to parse HTML documents
|
||||||
|
|
||||||
###### Parameters
|
###### Parameters
|
||||||
|
|
||||||
- `chapterUrl` value from [ChapterItem::url](#chapteritemurl)
|
- `chapterPath` value from [ChapterItem::path](#chapteritempath)
|
||||||
|
|
||||||
###### Returns
|
###### Returns
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ See [Using cheerio](#using-cheerio) for more information on how to parse HTML do
|
|||||||
```ts
|
```ts
|
||||||
class ExamplePlugin implements Plugin.PluginBase {
|
class ExamplePlugin implements Plugin.PluginBase {
|
||||||
...
|
...
|
||||||
async parseChapter(chapterUrl: string): Promise<string>{
|
async parseChapter(chapterPath: string): Promise<string>{
|
||||||
return "<h1>No chapter here</h1>";
|
return "<h1>No chapter here</h1>";
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
@@ -342,7 +342,7 @@ It is an object representing information how to store/access the novel
|
|||||||
|
|
||||||
| Field | type | Required | Description |
|
| Field | type | Required | Description |
|
||||||
| -------------------------------- | -------- | -------- | ------------------------------------------ |
|
| -------------------------------- | -------- | -------- | ------------------------------------------ |
|
||||||
| <p id="novelitemurl">url</p> | `string` | yes | The url to the site |
|
| <p id="novelitempath">path</p> | `string` | yes | The relative path to the novel |
|
||||||
| <p id="novelitemname">name</p> | `string` | yes | The name of the novel shown in the library |
|
| <p id="novelitemname">name</p> | `string` | yes | The name of the novel shown in the library |
|
||||||
| <p id="novelitemcover">cover</p> | `string` | no | URL to novel's cover |
|
| <p id="novelitemcover">cover</p> | `string` | no | URL to novel's cover |
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ import { defaultCover } from '@libs/defaultCover';
|
|||||||
|
|
||||||
| Field | Type | Required | Desciption |
|
| Field | Type | Required | Desciption |
|
||||||
| ------- | ------------------------- | -------- | ---------- |
|
| ------- | ------------------------- | -------- | ---------- |
|
||||||
| url | string | yes | |
|
| path | string | yes | |
|
||||||
| name | string | no | string |
|
| name | string | no | string |
|
||||||
| cover | `string` | no | |
|
| cover | `string` | no | |
|
||||||
| genres | `string` | no | |
|
| genres | `string` | no | |
|
||||||
@@ -375,7 +375,13 @@ import { defaultCover } from '@libs/defaultCover';
|
|||||||
|
|
||||||
### ChapterItem
|
### ChapterItem
|
||||||
|
|
||||||
---
|
| Field | Type | Required | Description |
|
||||||
|
| ------------- | -------- | -------- | ------------------------------- |
|
||||||
|
| name | string | yes | |
|
||||||
|
| path | string | yes | |
|
||||||
|
| releaseTime | string | no | release time in `YYYY-MM-DD` |
|
||||||
|
| chapterNumber | number | no | |
|
||||||
|
| page | string | no | for multi-page chapter lists |
|
||||||
|
|
||||||
### Filters
|
### Filters
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
- [git](https://git-scm.com/doc/ext) basics
|
- [git](https://git-scm.com/doc/ext) basics
|
||||||
- Typescript or Javascript basics
|
- Typescript or Javascript basics
|
||||||
- Node >=18
|
- Node >=22
|
||||||
- Installing the dependencies with `npm i`
|
- Installing the dependencies with `npm i`
|
||||||
|
|
||||||
### Guide
|
### Guide
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
1. Remember to create your plugin inside the language folder corresponding to the language of the novels
|
1. Remember to create your plugin inside the language folder corresponding to the language of the novels
|
||||||
2. File should have the `.ts` extension
|
2. File should have the `.ts` extension
|
||||||
Example `plugins/english/nobleMTL.ts`
|
Example `plugins/english/nobleMTL.ts`
|
||||||
3. Add an icon to `icons/src/<lang>/<plugin-name>/icon.png`
|
3. Add an icon to `public/static/src/<lang>/<plugin-name>/icon.png`
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> Icon size should be 96x96px!
|
> Icon size should be 96x96px!
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ The testing website provides five main sections to test different plugin functio
|
|||||||
- **Headers** - Configure custom HTTP headers
|
- **Headers** - Configure custom HTTP headers
|
||||||
- **Popular Novels** - Test `popularNovels()` with pagination and filters
|
- **Popular Novels** - Test `popularNovels()` with pagination and filters
|
||||||
- **Search Novels** - Test `searchNovels()` with search queries
|
- **Search Novels** - Test `searchNovels()` with search queries
|
||||||
- **Parse Novel** - Test `parseNovel()` with a novel URL
|
- **Parse Novel** - Test `parseNovel()` with a novel path
|
||||||
- **Parse Chapter** - Test `parseChapter()` with a chapter URL
|
- **Parse Chapter** - Test `parseChapter()` with a chapter path
|
||||||
|
|
||||||
## Pre-Submission Testing
|
## Pre-Submission Testing
|
||||||
|
|
||||||
Before submitting your plugin, verify that all five sections work without errors, multiple pages load, search returns accurate results, novel parsing extracts all metadata, chapter content is clean, filters work (if implemented), no console errors appear, URLs are properly formatted, and images load correctly.
|
Before submitting your plugin, verify that all five sections work without errors, multiple pages load, search returns accurate results, novel parsing extracts all metadata, chapter content is clean, filters work (if implemented), no console errors appear, paths are properly formatted, and images load correctly.
|
||||||
|
|
||||||
## Need Help?
|
## Need Help?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user