On Sun, May 31, 2020 at 5:23 PM Félix <[email protected]> wrote:
I'm wondering if anyone with knowledge of the Leo code base could give me a > simple pointer with relation to Leo's body pane's color syntax highlighting > running through leobridge. > Syntax coloring is never going to be easy. An overview: - Leo's colorizing code is in leoColorizer.py. - In *addition* to language-specific syntax coloring, Leo's syntax coloring supports Leo-specific constructs such as directives and section references. - Leo's uses jEdit descriptions files in leo/modes as the basis for it's jEdit-based code. - Leo also supports Pygments colorizing, customized using a modified form of code in the Jupyter project. Specifically, I'm wondering if there's an easy and straightforward way to > get to a body pane's color syntax highlighting (in whatever format that > would present itself) that would be applied on the text of a (given) body > pane? (while running only Leo without gui, i.e. leobridge) > The leoBridge module typically uses a null gui, iirc, which has a null colorizer, which (by default) won't help you at all. Starting Leo with --trace=coloring will show you the most important calls to the colorizer. To find the traces, do a cff on 'coloring' (single quotes). You will find, in particular, bjc.setTag and jedit.colorRangeWithTag.* Important*: Even when @bool use_pygments is True, Leo still calls the two methods listed above. So, to answer your question, you have several ways forward: 1. Arrange things so that setTag and colorRangeWithTag get called, then modify them to do what you want, presumably using js coloring code. 2. Follow the example of the pygments code, and alter the js coloring code to handle Leo directives and section references. HTH. Feel free to ask more questions. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3X14Pk_m-8raEb7pyyEJH6Be9wkRBY5G6ob_LoXOEnpQ%40mail.gmail.com.
