Scan your whole stack
Are you using rubyfield?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.3
rubyfield was last scanned on 26 Nov 2026 at version 0.1.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.3 LATEST | 26 Nov 2026 | No rules fired |
| 0.1.2 | 26 Nov 2026 | No rules fired |
| 0.1.1 | 26 Nov 2026 | No rules fired |
| 0.1.0 | 26 Nov 2026 | Not shown |
| 0.0.0-stage | 26 Nov 2026 | Not shown |
Findings for v0.1.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Rubyfield turns readings, glosses, and other text annotations into an input field you can see and try immediately. Type and edit the base text while the annotations update live above it.
Use it as a Pinyin, Jyutping, or Furigana input field with the recipes below—or plug in your own annotation function. NLP library authors can use the same component as a playground: change the function, type a sentence, and see its output live.
pinyin-pro.to-jyutping.kuromoji and wanakana.annotate function.Try the live demo.
| For | Use Package |
|---|---|
| Framework-agnostic JavaScript | rubyfield [current] |
| React 18+ (npm); React 19 (JSR) | @rubyfield/react |
| Vue 3+ | @rubyfield/vue |
Install rubyfield.
<div id="field" class="your-wrapper-class"></div>
import { createRubyfield } from "rubyfield";
const content = { current: "你好" };
const field = createRubyfield(document.querySelector("#field")!, {
content: content.current,
onUpdate: value => { content.current = value; },
placeholder: "Start typing…",
annotate: text => text === "你好" ? [[0, 1, "nei5"], [1, 2, "hou2"]] : [],
attributes: { class: "your-input-field-class" },
});
Each example mounts into an existing <div id="field"></div>. Call field.destroy() when removing the field.
Install pinyin-pro.
import { pinyin } from "pinyin-pro";
import { createRubyfield, segmentsToRanges } from "rubyfield";
const annotate = text => segmentsToRanges(pinyin(text, { type: "all" }).map(({ origin, pinyin, isZh }) => [origin, isZh ? pinyin : null]));
const field = createRubyfield(document.getElementById("field"), {
annotate,
attributes: { lang: "zh" },
ruby: { rt: { attributes: { lang: "zh-Latn-pinyin" } } },
});
Install to-jyutping.
import { getJyutpingList } from "to-jyutping";
import { createRubyfield, segmentsToRanges } from "rubyfield";
const annotate = text => segmentsToRanges(getJyutpingList(text));
const field = createRubyfield(document.getElementById("field"), {
annotate,
attributes: { lang: "yue" },
ruby: { rt: { attributes: { lang: "yue-Latn-jyutping" } } },
});
Install kuromoji and wanakana.
Serve Kuromoji's dict directory at /dict/ as binary files without a Content-Encoding header. Load the tokenizer once before mounting the field; this example uses its browser bundle.
import kuromoji from "kuromoji/build/kuromoji.js";
import { toHiragana } from "wanakana";
import { createRubyfield, segmentsToRanges } from "rubyfield";
const tokenizer = await new Promise((resolve, reject) => kuromoji.builder({ dicPath: "/dict/" }).build((error, tokenizer) => error ? reject(error) : resolve(tokenizer)));
const annotate = text => segmentsToRanges(tokenizer.tokenize(text).map(({ surface_form, reading }) => [surface_form, /\p{Script=Han}/u.test(surface_form) && reading ? toHiragana(reading) : null]));
const field = createRubyfield(document.getElementById("field"), {
annotate,
attributes: { lang: "ja" },
ruby: { rt: { attributes: { lang: "ja-Hira" } } },
});
This example demonstrates custom annotation with context-sensitive handling. 有趣 reads yǒu qù (“interesting”), but adding 真 (“really”) before it changes the reading to wú liáo (“boring”). 生命 gets the Japanese reading いのち: a narrator who finds life less interesting the more you insist otherwise.
import { createRubyfield } from "rubyfield";
const annotate = text => [...text.matchAll(/(?<とき>時間|瞬間)|(?<いのち>生命)|(?<yǒu>有)(?<qù>趣)|真(?<wú>有)(?<liáo>趣)/gd)].flatMap(match => Object.entries(match.indices.groups).flatMap(([groupName, indices]) => indices ? [[...indices, groupName]] : []));
const field = createRubyfield(document.getElementById("field"), {
defaultContent: "生命真有趣",
annotate,
});
<rp> supplies separators for plain-text representations, such as search-engine rendering and programmatically copying content with annotations. Without it, textContent sticks base text and annotation together. Browsers with ruby support normally hide these separators.
import { createRubyfield } from "rubyfield";
const annotate = () => [[0, 1, "nei5"]];
const field = createRubyfield(document.getElementById("field"), {
annotate,
ruby: { rp: { before: { text: "(" }, after: { text: ")" } } },
});
For base text 你 and reading nei5, the editable element (available through the handle's element property) has a textContent of 你(nei5). The same annotated text is available through new DOMParser().parseFromString(html, "text/html").body.textContent, where html is the string returned by the handle's getHTML() method. Normal copying from the field copies base text only.
Rubyfield installs no CSS apart from the minimal styles needed for placeholders and single-line fields. Supply your own styles.
Input is plain text: pasted formatting and images are not retained, and line endings become \n. Base text is editable; annotations are read-only.
Each Rubyfield package exports the optional utility segmentsToRanges(pairs), which converts [baseText, rubyText] pairs into UTF-16 annotation ranges. The baseText strings, joined in order, must reproduce the original text, including spaces and punctuation. A pair such as ["你好", "nei5 hou2"] adds an annotation; ["!", null] leaves that segment unannotated while counting its length for subsequent ranges.
Raw Attributes objects use HTML names (class, not className):
style; functions are not event listeners.For example, use hidden: "" to enable hidden and omit it to disable it; hidden: false becomes hidden="false", which still hides the element.
The field's handle provides access to its properties and methods through React's ref.current, Vue's template-ref .value, or the object returned by createRubyfield(...). Its TypeScript type is RubyfieldHandle. The handle exposes:
element: the editable HTMLElement, or null.value: the current base text, read-only.focus() / blur(): focus or blur the field.select(): select all base text.setSelectionRange(start, end): select a range using zero-based UTF-16 offsets.getHTML(): return an annotated HTML string. Normal copying copies base text only.Create the field after its DOM container exists. Use element.addEventListener() for native DOM events. The returned Rubyfield also exposes setOptions(options) and destroy(); destroy it when removing the field.
Try the hosted demo, or run it locally from the repository root:
bun install
bun run dev
Open the URL printed by Vite. The demo includes Pinyin, Jyutping, and Furigana; the Japanese dictionary loads when Furigana is selected.
From the repository root:
bun run build.bun run typecheck.bun run format.bun run format:check.bunx --no-install playwright-core install chromium.bun test.bun run test:browser.bun test tests/text.test.ts.Tests start and stop their own servers.
JSR uses the deno.json workspace configuration and publishes TypeScript source as @rubyfield/core, @rubyfield/react, and @rubyfield/vue. The JSR CLI downloads Deno internally; development uses Bun.
To release, set the same version in all three packages' package.json and deno.json files, update the core import versions in the root deno.json to match, then push a matching vX.Y.Z tag. The publish.yml workflow checks, builds, tests, and publishes to npm and JSR before creating a GitHub release. Prereleases use npm's next tag. Both registries require repository linking; npm also requires trusted publisher configuration for publish.yml. Failed runs can be retried; already published versions are skipped.
MIT.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.