PHPackages                             whojinn/sapphire - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. whojinn/sapphire

Abandoned → [jsw/commonmark-furigana-extension](/?search=jsw%2Fcommonmark-furigana-extension)ArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

whojinn/sapphire
================

League/commonmark extension for japanese furigana.

2.2.0(4y ago)01131Apache-2.0PHPPHP ^8.0 || ^8.1

Since May 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/JanStanleyWatt/old-sapphire)[ Packagist](https://packagist.org/packages/whojinn/sapphire)[ RSS](/packages/whojinn-sapphire/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (14)Used By (1)

[![PHP Composer](https://github.com/whojinn/sapphire/actions/workflows/php.yml/badge.svg)](https://github.com/whojinn/sapphire/actions/workflows/php.yml)[![Packagist Version](https://camo.githubusercontent.com/bc602774ed68ee63d4dc0384c1fc85a47d731e969da2730917c71083e7198612/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77686f6a696e6e2f7361707068697265)](https://camo.githubusercontent.com/bc602774ed68ee63d4dc0384c1fc85a47d731e969da2730917c71083e7198612/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77686f6a696e6e2f7361707068697265)[![Packagist Downloads](https://camo.githubusercontent.com/cf00cd109557f509479ec1369b05348bea45315c9a8423bf67da1ed7d5b1b0be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f77686f6a696e6e2f73617070686972653f6c6f676f436f6c6f723d426c7565267374796c653d706c6173746963)](https://camo.githubusercontent.com/cf00cd109557f509479ec1369b05348bea45315c9a8423bf67da1ed7d5b1b0be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f77686f6a696e6e2f73617070686972653f6c6f676f436f6c6f723d426c7565267374796c653d706c6173746963)[![Packagist PHP Version Support](https://camo.githubusercontent.com/222f7b2baa74175e2460caa97805e431699b257a1bdc091e9c59ea896ddf8f7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77686f6a696e6e2f7361707068697265)](https://camo.githubusercontent.com/222f7b2baa74175e2460caa97805e431699b257a1bdc091e9c59ea896ddf8f7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77686f6a696e6e2f7361707068697265)[![GitHub](https://camo.githubusercontent.com/c9bc3d9357c31caa66a8b728d4b592f61ff461e3e74a37216eef5290ea772f66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77686f6a696e6e2f7361707068697265)](https://camo.githubusercontent.com/c9bc3d9357c31caa66a8b728d4b592f61ff461e3e74a37216eef5290ea772f66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77686f6a696e6e2f7361707068697265)

Notice
======

[](#notice)

Due to the ID change, I decided to recreate this repository. This repository will no longer be updated. Please use to [this repository](https://github.com/JanStanleyWatt/commonmark-furigana-extension) instead.

ID変更に伴い、このリポジトリを新しく作り直すことにしました。以後、このリポジトリは更新されません。代わりに、[こちらのリポジトリ](https://github.com/JanStanleyWatt/commonmark-furigana-extension)をご利用ください

Sapphire
========

[](#sapphire)

[Parsedownのルビ振り拡張機能](https://github.com/noisan/parsedown-rubytext)をリスペクトして作った、ルビ振り機能を追加するleague/commonmark用Extension

使い方
---

[](#使い方)

既に[PHP](https://www.php.net/)並びに[composer](https://getcomposer.org/)を使用できる環境にあることを前提とします。

### インストール

[](#インストール)

1. このリポジトリをクローンする
2. なにがしかのシェルで`composer require whojinn/sapphire`と入力する
    1. または、composer.jsonに以下の行を追加して`composer install`を実行

    ```
    {
        "require": {
            "whojinn/sapphire":"*"
        }
    }

    ```

### ルビの振り方のルール

[](#ルビの振り方のルール)

1. ルビを振りたい単語の前に「｜」、単語の後ろに「《（ルビ文字）》」を入れる
    - 例:`シャッター破壊で｜Go Ahead《前進だ》！！`
        -&gt; `シャッター破壊でGo Ahead前進だ！！`
        -&gt; シャッター破壊でGo Ahead前進だ！！
2. ただし、文字種の違いでルビを振るべき単語を特定できる場合は「｜」を省略できる
    - 例: すなわち、第四極《だいよんきょく》とは力なり
        -&gt; `すなわち、第四極だいよんきょくとは力なり`
        -&gt; すなわち、第四極だいよんきょくとは力なり
3. ルビの分割数と単語の文字数が一致する場合はルビを半角スペースで分けることで単語ごとにルビを振ることができる
    - 例: 悪七兵衛景清《あく しち びょう え かげ きよ》
        -&gt; `悪あく七しち兵びょう衛え景かげ清きよ`
        -&gt; 悪あく七しち兵びょう衛え景かげ清きよ
4. 上記に当てはまらない場合は、単語ごとにルビを振る
    - 例:`萌黄《もえぎ》白糸《しらいと》折鶴蘭《おりづるらん》`
        -&gt; `萌黄もえぎ白糸しらいと折鶴蘭おりづるらん`
        -&gt; 萌黄もえぎ白糸しらいと折鶴蘭おりづるらん

### 設定

[](#設定)

```
// 以下、デフォルトでの設定
$config = [
    'sapphire' => [
        'use_sutegana' => false,    // trueにすると、ルビ文字のうち特定の小文字が大文字になる(ゅ→ゆ、ぁ→あ...etc)
        'use_rp_tag' => false,      // trueにすると、タグがルビにつく(（ルビ）)
    ]
];
```

### VS Code用スニペット

[](#vs-code用スニペット)

スニペット設定としてmarkdown.jsonを、スニペット用キーバインドとしてkeybindings.jsonを添付しました。機能は以下の通りです。

- Markdownファイルの編集中にスニペット「aozora\_ruby」を実行すると、カーソルを挟むようにルビ記号（《》）が挿入される
    - ルビ文字を入力後にtabキーを押下することで、ルビ記号の直後にカー駿河移動するようになる
- 文字を選択している状態でスニペット「aozora\_ruby\_separate」を実行すると、選択した文字を親文字と認識し、親文字の直前に区切り文字（｜）を、直後にルビ記号（《》）が挿入される
    - カーソルの振る舞いは「aozora\_ruby」に準ずる
- keybindings.jsonの設定を有効にすると、Ctrl+rでスニペット「aozora\_ruby」を実行するようになる
    - 条件は以下の3つ:
        - 編集画面を選択中
        - 編集しているファイルをMarkdownとVS Codeが認識している
        - ファイルは読み取り専用**ではない**
- 文字を選択した状態でCtrl+rを入力すると、「aozora\_ruby\_separate」が実行される
    - 条件は「aozora\_ruby」に準ずる

ライセンス
-----

[](#ライセンス)

Apache License, Version 2.0

- [英語原文](https://www.apache.org/licenses/LICENSE-2.0)
- [日本語参考訳](https://licenses.opensource.jp/Apache-2.0/Apache-2.0.html)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~34 days

Total

13

Last Release

1556d ago

Major Versions

1.0.2 → 2.0.02021-08-10

PHP version history (4 changes)v1.1.x-devPHP ^7.1 || ^8.0

2.0.1.x-devPHP 8.\*

2.0.2PHP ^7.4 || ^8.0

2.2.0PHP ^8.0 || ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ebbd8053b9e8fb20fc1f789289116bea820bfec6b771acb181f02115987b9fa?d=identicon)[JanStanleyWatt](/maintainers/JanStanleyWatt)

---

Top Contributors

[![JanStanleyWatt](https://avatars.githubusercontent.com/u/12198769?v=4)](https://github.com/JanStanleyWatt "JanStanleyWatt (105 commits)")

---

Tags

commonmarkmarkdownmarkdown-to-htmlphpphp-leaguemarkdownmdcommonmarkextension

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/whojinn-sapphire/health.svg)

```
[![Health](https://phpackages.com/badges/whojinn-sapphire/health.svg)](https://phpackages.com/packages/whojinn-sapphire)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[zoon/commonmark-ext-youtube-iframe

Extension for league/commonmark to replace youtube link with iframe

12275.9k1](/packages/zoon-commonmark-ext-youtube-iframe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
