rspress-plugin-annotation-words
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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[];
}

Package Sidebar

Install

npm i rspress-plugin-annotation-words

Weekly Downloads

84

Version

0.0.1

License

MIT

Unpacked Size

51.9 kB

Total Files

17

Last publish

Collaborators

  • heal