From 485306fbe2855a3f8c2a73f8673fcd6cc0998c72 Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 15 Apr 2023 10:36:21 -0400 Subject: [PATCH] docs: clarify use of highlighter function --- api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api.go b/api.go index 3920e6f..a440693 100644 --- a/api.go +++ b/api.go @@ -639,6 +639,14 @@ func hlhinter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { // reality could set the input of the prompt to *display* anything. The // callback is passed the current line and is expected to return a line that // will be used as the input display. +// Note that to set a highlighter, one has to override this function. +// Example: +// ``` +// function hilbish.highlighter(line) +// return line:gsub('"%w+"', function(c) return lunacolors.green(c) end) +// end +// ``` +// This code will highlight all double quoted strings in green. // --- @param line string func hlhighlighter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { return c.Next(), nil