@theopenweb/ruby-extractor
v1.0.0
Published
Ruby extraction library. Extracts information from ruby tags including the Katakana/hiragana AND the linked Japanese character(s).
Downloads
3
Readme
Description
Ruby extraction library. Extracts information from ruby tags including the Katakana/hiragana AND the linked Japanese character(s).
Usage
npm install @theopenweb/ruby-extractor
import {
extractReadableRubyFromPage,
extractRubyFromPage,
extractRubyFromElement,
extractFromRubyElement,
makeRubyDataListReadable
} from './index.js'
/*
RubyData: {
str: string;
ruby: string;
}
*/
/**
* 🐹: ハムスター<br>🐼: パンダー
*/
extractReadableRubyFromPage({ lf: '<br>' }) // 1st arg optional
/**
* @return {RubyData[]}
*/
extractRubyFromPage()
/**
* @return {RubyData[]}
*/
extractRubyFromElement(element)
/**
* @return {RubyData[]}
*/
extractFromRubyElement(rb)
/**
* 🐹: ハムスター<br>🐼: パンダー
* @param {RubyData[]} rubyDataList
*/
makeRubyDataListReadable(rubyDataList, { lf: '<br>' }) // 2nd arg optional
Test
npx http-server ./
# http://localhost:8080