forked from valeriangalliat/markdown-it-highlightjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
39 lines (33 loc) · 1.04 KB
/
test.js
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
const { equal } = require('assert')
const md = require('markdown-it')
const highlightjs = require('./')
equal(
md().use(highlightjs).render('```js\nconsole.log(42)\n```'),
`<pre><code class="hljs language-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">42</span>)
</code></pre>
`)
equal(
md().use(highlightjs).render('```\ntest\n```'),
`<pre><code class="hljs"><span class="hljs-keyword">test
</span></code></pre>
`)
equal(
md().use(highlightjs).render(' test\n'),
`<pre><code class="hljs">test
</code></pre>
`)
equal(
md().use(highlightjs, { code: false }).render(' test\n'),
`<pre><code>test
</code></pre>
`)
equal(
md().use(highlightjs).render('```\n<?php echo 42;\n```'),
`<pre><code class="hljs"><span class="php"><span class="hljs-meta"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-number">42</span>;
</span></code></pre>
`)
equal(
md().use(highlightjs, { auto: false }).render('```\n<?php echo 42;\n```'),
`<pre><code class="hljs"><?php echo 42;
</code></pre>
`)