rspress-plugin-annotation-words
v0.0.1
Published
Rspress plugin for annotation of words.
Downloads
287
Readme
rspress-plugin-annotation-words
A plugin for Rsoress to support annotation words.
Install
# npm
npm install rspress-plugin-annotation-words
# yarn
yarn add rspress-plugin-annotation-words
# pnpm
pnpm install rspress-plugin-annotation-words
Usage
import { defineConfig } from 'rspress/config';
import { pluginAnnotationWords } from 'rspress-plugin-annotation-words'
import path from 'path';
export default defineConfig({
// ...
plugins:[pluginAnnotationWords({
wordsMapPath:'words-map.json'
})],
});
add words-map.json
to public
folder, the content is like this:
{
"word":{
"id":"word",
"lang":{
"zh":{
"aliases":[
{"key":"word aliases"}
],
"description":"描述",
"related_meta":{
"docs":[{
"id":"word-docs",
"title":"文档标题(通常用于 rspress 内部链接)",
"url":"/zh/configure/name.html#name"
}],
"links":[{
"id":"word-link",
"title":"外部链接",
"url":"https://github.com/2heal1/rspress-plugin-annotation-words"
}]
}
},
"en":{
"aliases":[
{"key":"word aliases"}
],
"description":"word name",
"related_meta":{
"docs":[{
"id":"word-docs",
"title":"word title(usually used for rspress internal links)",
"url":"/en/configure/name.html#name"
}],
"links":[{
"id":"word-link",
"title":"external link",
"url":"https://github.com/2heal1/rspress-plugin-annotation-words"
}]
}
}
}
},
}
Options
interface Options {
/**
* words map path
*/
wordsMapPath:string;
ignoreWords?: string[];
ignorePaths?: RegExp[];
}