Rainbow.js TD v.2

by neohiro79

HTML

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.0/styles/googlecode.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.0/highlight.min.js"></script>
<!DOCTYPE html>
<html>
<head>

	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/themes/dreamweaver.min.css" />
  
</head>
<body onload="iniDone()"> 

  
<h1>Rainbow.js Testcases:</h1>

<b>HTML, CSS &amp; JS:</b>

<!--
<pre><code data-language="html"><script>function xyz(){}; var testing = true;</script></code></pre>
<pre><code class="lang-javascript">function xyz(){}; var testing = true;</code></pre>
-->



<!-- everything except script-tag will be masked automatically -->
<!-- 

// rainbow/src/util.js
// Lines 66 to 74 in d606601

export function htmlEntities(code) { 
     return code.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/&(?![\w\#]+;)/g, '&amp;'); 
 } 

-->
<!-- 

Also, as an aside, you should set the language to html when you are highlighting JavaScript code 
wrapped in a <script> tag. If you are highlighting a JavaScript code block not wrapped in 
a <script> tag then leaving things unescaped should usually be fine. For example:

<pre><code class="lang-js">if (foo > 25) {
    console.log('good!');
}</code></pre>

-->
<pre><code class="language-html">

<!-- this is a html comment -->
<!-- this is a html comment 
      across multiple lines 
 -->   
<p>
    This is a paragraph
</p>
 
<style>
    /* this is a css and a js comment */
    /* this is a css and js comment 
    across multiple lines
    */
    html { display : block; }
</style>

<!-- script-tags should be masked since their execution can't be stopped in here -->
<!-- &lt;script&gt;var whatever = true;&lt;/script&gt; -->
<script>
    // this is a javascript comment
    /* this is a css and a js comment */
    /* this is a css and js comment 
    across multiple lines
    */

    function iniDone(){
       console.log("and this is some javascript itself");
   ...

CSS

/* https://cdnjs.com/libraries/rainbow */