On Sun, Jun 15, 2025 at 04:16:23PM -0700, Raymond Toy wrote:
> In
> https://www.gnu.org/software/texinfo/manual/texinfo/html_node/_0040lisp.html,
> it says |@lisp| is the same as |@examle lisp|. In the generated HTML file,
> visually, they produce the same thing. However, the html code is quite
> different.
> 
> So for this test:
> 
> |@lisp (member :internal :external :inherited nil) @end lisp @example lisp
> @example lisp (defstruct ice-cream (flavor :vanilla :type (member :vanilla
> :chocolate :strawberry))) @end example |

(I've lost newlines in this example.)

> the generated html is different:
> 
> |</p><div class="example lisp"> <pre class="lisp-preformatted">(member
> :internal :external :inherited nil) </pre></div> </p><div class="example
> user-lisp"> <pre class="example-preformatted">(defstruct ice-cream (flavor
> :vanilla :type (member :vanilla :chocolate :strawberry))) </pre></div> |
> 
> The div class is different and so is the pre class. Should they be the same?

No they shouldn't - the "lisp" class is to indicate that the <div> was output
from a @lisp block rather than an @example block.  Hopefully this is not
too confusing.


> I’m asking because I’m looking at adding syntax highlighting (via highlight
> js) to a texi doc converted to HTML. I could change all the @example lisp to
> @lisp or vice versa, but since the manual says they’re the same, this is
> unexpected.

You could also treat the classes "lisp" and "user-lisp" as equivalent in
your syntax highlighting.

> I also noticed that |@example c| is accepted. Should it be? The generated
> html looks something like:
> 
> |</p><div class="example user-c"> <pre class="example-preformatted"> ... |
> 
> That seems consistent with |@example lisp|, so that’s nice.
> 
> &#8203;

Yes, as Eli referred to in the manual, this is to allow you to have
different syntax highlighting for different languages.

Reply via email to