On Thu, Jan 9, 2014 at 1:40 PM, Leandro Mattioli <leandro.matti...@gmail.com > wrote:
> Greetings, > > I have a small improvement suggestion for LyX. Currently, when a Program > Listing is inserted by the Child Document feature, the HTML output wraps > the file contents in a <pre> tag. > > However, some JavaScript libraries (notably highlight.js), expect source > code to be enclosed with <pre><code>. Since automatic language detection > is already available to these libraries. To allow for easier integration > with these libraries, I suggest the following changes: > > ======================================== > > File: insets/InsetInclude.cpp > Method: InsetInclude::xhtml > > // In the case of listings, we wrap it in <pre><code>. > > if (listing) { > xs << html::StartTag("pre"); > xs << html::StartTag("code"); > } > > (...) > > if (listing) { > xs << html::EndTag("code"); > xs << html::EndTag("pre"); > } > > ======================================== > > With this simple change, one can highlight code only by adding to the > HTML's head section: > > <link rel="stylesheet" href="styles/default.css"> > <script src="highlight.pack.js"></script> > <script>hljs.initHighlightingOnLoad();</script> > > Thanks in advance. > Richard, Have you considered this ? Vincent