UNPKG

emphase

Version:
417 lines (352 loc) 7.7 kB
<!DOCTYPE html> <html lang="en"> <head> <title>Marked Demo</title> <link href="./demo/css.css" rel="stylesheet" type="text/css"> <link href="./lib/em.css" rel="stylesheet" type="text/css"> </head> <body> <div id="main"> <div class="container"> <div class="pane" id="preview"> <div class="two"> <span> <h5>bash</h5> <pre><code class="lang-bash">#!/bin/bash if [ $a -eq true ] then echo "A 'a'" else echo "B 'b'" fi function foo(a) { local a = 0 count = a + 1 echo count return } # comment : &lt;&lt;COMMENT comment line a true comment line b COMMENT : &lt;&lt;x comment line a true comment line b x : ' comment line a true comment line b '</code></pre> </span> <span> <h5>bash (scroll example)</h5> <pre><code class="lang-bash">#!/bin/bash if [ $a -eq true ] then echo "A 'a'" else echo "B 'b'" fi #example to showcase the horizontal scroll with the numbers fading over the code. </code></pre> </span> </div> <h5>c</h5> <pre><code class="lang-c">#include &lt;stdio.h&gt; #include "library.h" #ifndef EXTENDED /* defined */ #else /* undefined */ #endif int foo(int a) { int count; int quo; a = 0; count = a + 1; if (a == 1) { printf("A 'a'"); } else { printf('B "b"'); } return count; } // comment /* comment line a true comment line b */</code></pre> <h5>cpp</h5> <pre><code class="lang-cpp">#include &lt;iostream&gt; #include "library.h" using namespace std; #ifndef EXTENDED /* defined */ #else /* undefined */ #endif int foo(int a) { int a = 0; int count = a + 1; if (a == true) { cout &lt;&lt; "A 'a'" &lt;&lt; endl; } else { cout &lt;&lt; 'B "b"'&lt;&lt; endl; } string quo = R"( quote line a quote line b )"; return count; } // comment that extends to the edge of the box without wordwrap /* comment line a true comment line b */</code></pre> <h5>cs</h5> <pre><code class="lang-cs">#include "library.h" #include &lt;header name&gt; #ifndef EXTENDED /* defined */ #else /* undefined */ #endif void foo(int a) { a = 0; count = a + 1 if ( a == true ) { Console.WriteLine( "A 'a'" ); } else { Console.WriteLine( "B 'b'" ); } return count; } // comment /* comment line a true comment line b */</code></pre> <h5>fs</h5> <pre><code class="lang-fs">let addTuple aTuple = let (x,y) = aTuple x + y let foo a = let a = 0; let count = a + 1 if a == true then printfn "A 'a'"; else printfn "B 'b'"; // comment /* comment line a true comment line b */</code></pre> <h5>go</h5> <pre><code class="lang-go">package main import "fmt" func main() { var a = 0 var b = true count := a + 1 if b == true { fmt.Println("A 'a'") } else { fmt.Println(`B "b"`) } var quo = ` quote line a quote line b ` concatenated := fmt.Sprintf("%d%s", count, quo) fmt.Println(concatenated) } // comment /* comment line a true comment line b */</code></pre> <h5>html</h5> <pre><code class="lang-html">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;!-- &lt;!DOCTYPE html&gt; --&gt; &lt;!--h1&gt;foo&lt;/h1--&gt; &lt;h1&gt;My First Heading&lt;/h1&gt; &lt;p class='test'&gt;My first paragraph.&lt;/p&gt; &lt;a href="https://www.w3schools.com"&gt; This is a link &lt;/a&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> <h5>java</h5> <pre><code class="lang-java">import library.*; public class Main { public static void main(String[] args) { int foo(int a) { int a = 0; int count = a + 1; if (a == true) { System.out.println("A 'a'"); } else { System.out.println("B 'b'"); } String quo = "quote line a\n" + "quote line b"; // Java 13 Text Blocks String quo = """quote line quote line b"""; return count; } } } // comment /* comment line a true comment line b */</code></pre> <h5>javascript</h5> <pre><code class="lang-javascript">import * from "library.js"; import { library } from "library.js"; function foo(a){ var a = 0; var count = a + 1; if ( a == true ) { console.log( "A 'a'" ); } else { console.log( `B "b"` ); } var quo = ` quote line a quote line b `; return count; }; // comment /* comment line a true comment line b */ export { foo };</code></pre> <h5>kotlin</h5> <pre><code class="lang-kotlin">package main import library as library; fun foo(a: Int): Int { var a = 0 var count = a + 1 if (a == true) { println("A 'a'") } else { println("B 'b'") } val quo = """ quote line a quote line b """.trimIndent() return count } // comment /* comment line a true comment line b */</code></pre> <h5>matlab</h5> <pre><code class="lang-matlab">library = importdata('library.js'); function count = foo(a) a = 0; count = a + 1; if (a == true) disp('A "a"'); else disp('B "b"'); end quo = sprintf('quote line a'); return count; end %comment %{ comment comment line a true comment line b %}</code></pre> <h5>perl</h5> <pre><code class="lang-perl">sub foo { my ($a) = @_; my $a = 0; my $count = $a + 1; if ($a == True) { print "A 'a'"; } else { print 'B "b"'; } my $quo = &lt;&lt;END; quote line a quote line b END return $count; } #comment =pod comment line a True comment line b =cut</code></pre> <h5>python</h5> <pre><code class="lang-python">from library.js import * from library.js import library def foo(a): a = 0 count = a + 1 if a == True: print("A 'a'") else: print('B "b"') quo = """ quote line a quote line b """ return count # comment """ comment line a True comment line b """ ''' comment line a True comment line b '''</code></pre> <h5>r</h5> <pre><code class="lang-r">source("library.js") foo &lt;- function(a) { a &lt;- 0 count &lt;- a + 1 if (a == TRUE) { cat("A 'a'") } else { cat('B "b"') } quo &lt;- c( "quote line a", "quote line b" ) return(count) } # comment</code></pre> <h5>vb</h5> <pre><code class="lang-vb"> 'comment' System.Console.WriteLine("Log text") Dim UserName As String = "MyUserName"</code></pre> </div> </div> </div> <script src="./lib/em.js" type="text/javascript"></script> <script src="./src/languages/em_bash.js" type="text/javascript"></script> <script src="./src/languages/em_c.js" type="text/javascript"></script> <script src="./src/languages/em_cpp.js" type="text/javascript"></script> <script src="./src/languages/em_cs.js" type="text/javascript"></script> <script src="./src/languages/em_fs.js" type="text/javascript"></script> <script src="./src/languages/em_go.js" type="text/javascript"></script> <script src="./src/languages/em_html.js" type="text/javascript"></script> <script src="./src/languages/em_java.js" type="text/javascript"></script> <script src="./src/languages/em_javascript.js" type="text/javascript"></script> <script src="./src/languages/em_kotlin.js" type="text/javascript"></script> <script src="./src/languages/em_matlab.js" type="text/javascript"></script> <script src="./src/languages/em_perl.js" type="text/javascript"></script> <script src="./src/languages/em_python.js" type="text/javascript"></script> <script src="./src/languages/em_r.js" type="text/javascript"></script> <script src="./src/languages/em_vb.js" type="text/javascript"></script> <script src="./demo/demo.cjs.js" type="text/javascript"></script> </body> </html>