Subsection 4.15.2 Interactive Programs, CodeLens
CodeLens is an interactive version of a computer program, which can be visualized by stepping through the code one statement at a time, watching output, variables, and other data structures change. So it is similar to a debugger, except the reader does not set breakpoints or modify program data on-the-fly. This is possible automatically for several different languages when your HTML is hosted on a Runestone server (Chapter 32). This may also be accomplished “in browser” when hosted on any old generic web server. The catch is that for a generic server a publisher must generate trace data in advance, typically with the PreTeXt-CLI (Section 5.2). Place the
<interactive>
attribute on a <program>
element with the value codelens
to elect this behavior (no
is the default value). Also, be sure to specify a language from the supported languages: Python, Java, C, and C++. Consult Table 4.15.4.1 below for a summary of various combinations. When an output format does not support an interactive CodeLens instance, the fallback is a static program listing.