Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon5.gif   Highlight code?, posted by Daniel Sajdyk on Tue Sep 6 13:35:05 2016 
    icon2.gif   Re: Highlight code?, posted by Stefan Ritt on Tue Sep 6 13:41:32 2016 
       icon2.gif   Re: Highlight code?, posted by Daniel Sajdyk on Tue Sep 6 13:45:55 2016 
          icon2.gif   Re: Highlight code?, posted by Stefan Ritt on Tue Sep 6 14:02:56 2016 
             icon2.gif   Re: Highlight code?, posted by Daniel Sajdyk on Tue Sep 6 14:51:19 2016 screen.png
                icon2.gif   Re: Highlight code?, posted by Stefan Ritt on Tue Sep 6 15:29:22 2016 
                   icon2.gif   Re: Highlight code?, posted by Daniel Sajdyk on Tue Sep 6 22:18:29 2016 
                      icon2.gif   Re: Highlight code?, posted by Aaron James Long on Mon Dec 12 13:35:16 2016 
                         icon2.gif   Re: Highlight code?, posted by Stefan Ritt on Mon Dec 12 13:48:41 2016 
                            icon2.gif   Re: Highlight code?, posted by Aaron James Long on Mon Dec 12 14:04:32 2016 
Message ID: 68498     Entry time: Mon Dec 12 13:48:41 2016     In reply to: 68497     Reply to this: 68499
Icon: Reply  Author: Stefan Ritt  Author Email: stefan.ritt@psi.ch 
Category: Question  OS: Windows  ELOG Version: 3.1.1-3f311c5 
Subject: Re: Highlight code? 

All I did was this:

Bottom Text = <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css"><script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script>

 

 

Aaron James Long wrote:

Can I ask for some clarification; I would like to include code highlighting for some computational students who will be making use of ELOG. 

In the example you showed, my understanding is that you included a "Bottom text =... " entry in the forums elog config. This included the bare minimum remote call outlined by the highlightjs site. Can you clarify (as I'm having issues setting it up) should the "Bottom text=..." entry take this as a string, or should it be contained in a seperate html file in the same local directory as the cfg?

 

Daniel Sajdyk wrote:

Ok. Thanks a lot :)

Stefan Ritt wrote:

In the HTML editor, you can select the code text, then select from the "Styles" drop-down the style "Computer Code", and on the "Normal" drop-down the formatting "Formatted". This puts the code in <pre>  and <code> tags, so you don't have to manipulate HTML directly.

Daniel Sajdyk wrote:

Looks like it works :)

Code need to be put in tags:

<pre><code class="sql">...</code></pre>

but it works.

Thank you :D

 

Best Regards

Daniel Sajdyk

Stefan Ritt wrote:

I did not know about highlight.js . You can put it into any elog page with "Bottom text = ...". I tried it for this forum and put in some C code:

#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("C Programming");
   return 0;
}

Seems like this works nicely. Thanks for that hint.

 

Daniel Sajdyk wrote:

I thought so.

One  more question :) I want manually add that parser (https://highlightjs.org), but I'm newby in that and don't know where ....

I know that downloaded hightlight pack I must put into folder scripts, but where to add this line:

<script>hljs.initHighlightingOnLoad();</script>

 

Stefan Ritt wrote:

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

 

 

 

 

 

 

 

ELOG V3.1.5-fe60aaf