1 /++ 2 $(ADRDOX_SAMPLE 3 ```javascript 4 /* This is highlighted Javascript! */ 5 window.onload = function() { 6 var a = "hello, world!"; 7 var b = 5; 8 }; 9 ``` 10 11 ```c 12 /* Highlighted C */ 13 #include<stdio.h> 14 typedef struct { 15 int a; 16 } test; 17 ``` 18 19 ```php 20 <?php 21 # highlighted PHP 22 function foo($a) { 23 $a = 'hello'; 24 return $a; 25 } 26 ?> 27 ``` 28 29 ```python 30 # highlighted python 31 class test: 32 """ docstring """ 33 def myfunc(foo, 34 bar): 35 if True or 1 > 0: 36 print "hello" 37 else 38 print test 39 40 41 from itertools import count 42 43 def generate_primes(stop_at=0): 44 primes = [] 45 for n in count(2): 46 if 0 < stop_at < n: 47 return # raises the StopIteration exception 48 composite = False 49 for p in primes: 50 if not n % p: 51 composite = True 52 break 53 elif p ** 2 > n: 54 break 55 if not composite: 56 primes.append(n) 57 yield n 58 ``` 59 60 ```html 61 <span class="foo"> 62 <!-- try hovering over the entity! --> 63 HTML & 64 </span> 65 <style> 66 @media(screen and max-width: 25em) { 67 span.red { 68 color: red; 69 max-width: 10px; 70 } 71 } 72 </style> 73 <script> 74 function foo() {} 75 </script> 76 ``` 77 78 ```css 79 /* This also highlights */ 80 @import url(http://example.com); 81 span[data-test="foo"] > .bar { 82 color: red; 83 -moz-user-select: none; 84 width: 20em; 85 } 86 ``` 87 88 ```ruby 89 # this is a simple ruby example 90 require 'test' 91 class Ok < Object 92 def foo(a) 93 if test.nil? || params[:whatever] 94 print "hi" 95 end 96 end 97 end 98 ``` 99 ) 100 101 102 +/ 103 module adrdox.highlight; 104 105 /// this is public import 106 public import std.stdio; 107 108 public import foo = std.file; 109 110 /// 111 unittest { 112 113 114 int a; 115 116 } 117 118 /// 119 struct LongThing(int a, int b) {} 120 121 /// 122 alias Vector = LongThing!(1, 2); 123 124 /// 125 void a(Vector b) {}