Directionality

Wrap a line for display

Render-ready bidirectional output for one display line. Every left-to-right unit (a Latin term, a price, a number with its unit, a range such as "10–20%", a date, a percentage, a comparison such as "<5") is kept whole and in order, so no digit, range or sign is reversed or mirrored inside a Hebrew line.

Pick format for the surface: html for the web, React and webviews; isolate (Unicode isolates) for iOS, Android 7+ and current browsers; marks (LRM/RLM) for older Android, embedded displays and any renderer you cannot test. Pass base: "rtl" for a Hebrew line even when it starts with a Latin term.

Quota. Deterministic, no model. Does not consume the character quota. Fast enough to call per line at render time.

Limits. text up to 20,000 characters. Idempotent.

post/v1/wrap

Request

  • Base URL: https://hc.itsbaba.com
  • URL: https://hc.itsbaba.com/v1/wrap
  • Auth: HTTP bearer

Request body

textstring required

The display line, up to 20,000 characters.

format'html' | 'isolate' | 'marks'

html for the web; isolate (Unicode isolates) for modern text engines; marks (LRM/RLM) for every renderer, including older Android.

base'auto' | 'ltr' | 'rtl'

Paragraph direction of the display surface. Pass rtl for a Hebrew line even when it starts with a Latin term.

Example request

{
  "text": "הנחה: 10–20% על Galaxy S25 עד 31/12",
  "format": "html",
  "base": "rtl"
}

Response

Wrapped output

dir'ltr' | 'rtl' required

Paragraph direction used.

formatstring required

Format used.

outputstring required

Render-ready text: HTML with dir spans, or the text with Unicode isolates or direction marks inserted.

Example response

{
  "dir": "rtl",
  "format": "html",
  "output": "<span dir=\"rtl\">הנחה: <span dir=\"ltr\" lang=\"und\">10–20%</span> על <span dir=\"ltr\" lang=\"en\">Galaxy S25</span> עד <span dir=\"ltr\" lang=\"und\">31/12</span></span>",
  "runs": [
    {
      "text": "שלום ",
      "dir": "rtl",
      "script": "Hebr",
      "lang": "he",
      "end": 5
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.