r_highlighter: Lightweight R syntax highlighter

View source: R/widget-textarea.R

r_highlighterR Documentation

Lightweight R syntax highlighter

Description

Returns a viewport-first tokenizer for text_area(). It highlights common R keywords, strings, comments, numeric constants, operators, and function names. It uses tolerant regular expressions and accepts incomplete syntax. Each line produces grapheme-indexed spans with start, end, and token.

Usage

r_highlighter()

Value

A function ⁠(lines, state = NULL)⁠ suitable for text_area().


termr documentation built on Oct. 21, 2026, 5:13 p.m.