Skip to content

Configuration

The TaraskConfig class tunes how conversions behave. Construct it with a partial object; any option you omit keeps its default value. A plain TaraskOptions object works anywhere a config is accepted, no class instance needed.

import { TaraskConfig } from "taraskevizer";
const cfg = new TaraskConfig({
abc: "cyrillic",
j: "always",
variations: "first",
wrappers: "none",
g: true,
});

To tweak the predefined htmlConfigOptions(), mutate the returned instance:

import { htmlConfigOptions } from "taraskevizer";
const cfg = htmlConfigOptions();
cfg.j = "random";

TaraskAlphabet (default "cyrillic"). The alphabet used for transliteration: "cyrillic", "latin", "latinJi", or "arabic". Only the builtin alphabets are available.

TaraskJ (default "never"). Controls when і(i) is replaced by й(j) after a vowel.

Value Example
(default) яна і ён
never яна і ён
random яна і ён or яна й ён
always яна й ён

Has no effect when abc is "latinJi" (that alphabet already encodes the і/ј distinction).

boolean (default true; false in htmlConfigOptions()). When true, replaces ґ(g) by г(h) in the Cyrillic alphabet. This option only matters for the Cyrillic alphabet.

Value Example
true Ґвалт ґвалт
false Гвалт гвалт

TaraskVariations (default "all"). When a word part has multiple valid spellings, this chooses which to show.

Value Example
no Гродна
first Горадня
all (Гродна|Горадня)

How variations render depends on the wrappers option below (plain text vs. HTML tarL tags vs. ANSI color).

TaraskWrappers (default "none"). Wraps the changed parts of the output so you can highlight or annotate them: "html" emits tarF/tarL/tarH tags and "ansi" emits ANSI escape codes. Set to "none" to skip wrapping entirely. Only these predefined sets are available — arbitrary wrapper functions cannot cross into the compiled core. See HTML tags for the tag reference and the interactive helpers.

boolean (default true). When true, capitalized runs (acronyms, all-caps fragments) are left untouched so they are not mistakenly taraskevized. Set to false only when you are certain the text has no protected capitals. It has no effect on the alphabetic pipeline, which transliterates everything letter-for-letter.

string (default "\n"). The string that "\n" in the input is replaced with. For HTML you typically set it to "<br>".

string (default "<"). The string that "<" in the input is replaced with. For HTML set it to "&lt" (note: the predefined htmlConfigOptions() already does this) so user-supplied angle brackets are escaped.

noFixPlaceholder — protected-part placeholder

Section titled “noFixPlaceholder — protected-part placeholder”

string (default " \ue0fe "). The internal placeholder used while extracting parts that should not be converted (text enclosed in < >, or marked with special syntax). You should only change this if the default value happens to appear in your input text and causes conflicts.