1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<h1>CoffeeScript</h1>
<p>To use this language, use the class "language-coffeescript".</p>
<h2>Comments</h2>
<pre><code># This is a comment
### This is a
multi-line comment###</code></pre>
<h2>Strings</h2>
<pre><code>'foo \'bar\' baz'
"foo \"bar\" baz"
'Multi-line
strings are supported'
"Multi-line
strings are supported"
''' 'Block strings'
are supported too'''
""" "Block strings"
are supported too"""</code></pre>
<h2>String interpolation</h2>
<pre><code>"String #{interpolation} is supported"
'This works #{only} between double-quoted strings'</code></pre>
<h2>Object properties</h2>
<pre><code>kids =
brother:
name: "Max"
age: 11
sister:
name: "Ida"
age: 9</code></pre>
<h2>Regexps</h2>
<pre><code>/normal [r]egexp?/;
/// ^(
mul\t[i-l]ine
regexp # with embedded comment
) ///</code></pre>
<h2>Classes</h2>
<pre><code>class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
class Horse extends Animal
move: ->
alert "Galloping..."
super 45
sam = new Snake "Sammy the Python"
tom = new Horse "Tommy the Palomino"
sam.move()
tom.move()</code></pre>
<h2>Inline JavaScript</h2>
<pre><code>`alert("foo")`</code></pre>
<h2>Known failures</h2>
<p>There are certain edge cases where Prism will fail.
There are always such cases in every regex-based syntax highlighter.
However, Prism dares to be open and honest about them.
If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>
<h3>Comment-like substrings</h3>
<pre><code>"foo # bar";</code></pre>