Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myxotod/eleventy-plugin-furigana
Eleventy plugin to convert kanji to kanji with furigana above
https://github.com/myxotod/eleventy-plugin-furigana
eleventy eleventy-plugin furigana japanese kanji plugin
Last synced: 15 days ago
JSON representation
Eleventy plugin to convert kanji to kanji with furigana above
- Host: GitHub
- URL: https://github.com/myxotod/eleventy-plugin-furigana
- Owner: MyXoToD
- License: mit
- Created: 2024-05-17T18:44:21.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T06:50:58.000Z (9 months ago)
- Last Synced: 2025-01-03T19:13:08.317Z (about 1 month ago)
- Topics: eleventy, eleventy-plugin, furigana, japanese, kanji, plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@myxotod/eleventy-plugin-furigana
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# eleventy-plugin-furigana
[Eleventy](https://11ty.dev) plugin that adds a filter to parse content for kanji followed by `[]`-brackets containing hiragana and converts it to furigana.
`{{ '私[わたし]の名前[なまえ]はマックスです。' | furigana | safe }}`
will produce this:
![image](https://github.com/MyXoToD/eleventy-plugin-furigana/assets/4465331/e075e09c-9f33-4db9-b187-03c1dac3e26a)
![NPM Version](https://img.shields.io/npm/v/@myxotod/eleventy-plugin-furigana.svg) ![NPM Downloads](https://img.shields.io/npm/d18m/%40myxotod%2Feleventy-plugin-furigana) ![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/min/%40myxotod/eleventy-plugin-furigana/1.0.0)
## Usage
Install this package
```sh
npm install --save-dev @myxotod/eleventy-plugin-furigana
```Add and register the plugin inside your `.eleventy.js` config file
```js
// .eleventy.js
const furigana = require("@myxotod/eleventy-plugin-furigana");module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(furigana);
};
```Finally use it in your code with the `furigana`-filter
```html
{{ content | furigana | safe }}
```## Example
```html
{{ '私[わたし]
' | furigana | safe }}
私 (わたし)
```## Options
You can pass several options when adding the plugin in your eleventy config file like so:
```js
eleventyConfig.addPlugin(furigana, {
verbose: false
});
```|Option|Default|Type|Description|
|---|---|---|---|
|`class`|`furigana`|String|Provide a custom class for the surrounding `` tag|
|`regex`|`/([\u4E00-\u9FAF\u3040-\u3096\u30A1-\u30FA\uFF66-\uFF9D\u31F0-\u31FF]{1})\[(.*?)\]/g`|Regex Pattern|Pattern to parse kanji|
|`verbose`|`false`|Boolean|Output additional data to your terminal when an eleventy build happens|## License
[MIT](https://github.com/MyXoToD/eleventy-plugin-readingtime/blob/main/LICENSE) @ [Maximilian Boll](https://www.makkusu.dev)