untunt / kanbunHTML

A kanbun-kundoku (漢文訓読) HTML display solution
https://phesoca.com/kanbun-html/
GNU Affero General Public License v3.0
48 stars 5 forks source link

kanbunHTML

This is a kanbun kundoku (漢文訓読) HTML display solution (probably the best) supporting both fixed inter-character spacing setting (アキ組) and solid setting (ベタ組) setting. It converts annotated kanbun text to HTML and displays it.

An example converter: phesoca.com/kanbun-html/.

Usage

<link href="https://github.com/untunt/kanbunHTML/blob/main/kanbun.css" rel="stylesheet" />
<script src="https://github.com/untunt/kanbunHTML/raw/main/kanbun.js"></script>
<div class="kanbun okurigana-sinking" id="sample">
  <p>感ジテハ[レ]時ニ花ニモ濺(そそ)ギ[レ]淚ヲ,恨ミデハ[レ]別レヲ鳥ニモ驚カス[レ]心ヲ。</p>
  <p>孤之有ルハ[二]孔明[一],猶ホ‹ごと›«キ»[二]魚之有ルガ[一レ]水也。</p>
</div>
<script>convertKanbunDiv(document.getElementById("sample"));</script>

Put annotated kanbun paragraphs in a <div>, and call convertKanbunDiv() to convert them to HTML.

Kanbun Annotation

Different components after kanji are annotated by different brackets:

This is the recommended order of components after one kanji in kanbun annotation. However, in practice, they will be displayed correctly in any order.

Class Description

Several class values can be given to the kanbun <div>:

Special Thanks

References