Skip to content

Commit 18891d3

Browse files
committed
Merge branch 'release/v1.7.1'
2 parents f31eb07 + 5376e66 commit 18891d3

File tree

6 files changed

+14
-3
lines changed

6 files changed

+14
-3
lines changed

helpers/code.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var hljs = require('highlight.js');
1111
*/
1212
module.exports = function(language, options) {
1313
if (typeof language === 'undefined') language = 'html';
14+
language = hljs.getLanguage(language) ? language : 'html';
1415

1516
var code = hljs.highlight(language, options.fn(this)).value;
1617

helpers/markdown.js

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var marked = require('marked');
1515
renderer.code = function(code, language) {
1616
if (typeof language === 'undefined') language = 'html';
1717

18+
language = hljs.getLanguage(language) ? language : 'html';
19+
1820
var renderedCode = hljs.highlight(language, code).value;
1921
var output = `<div class="code-example"><pre><code class="${language} hljs">${renderedCode}</code></pre></div>`;
2022

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "panini",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "A super tiny flat file compiler.",
55
"main": "index.js",
66
"scripts": {

test/fixtures/helper-markdown/build/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<body>
33
<h1 id="heading">Heading</h1>
44
<p>Paragraph</p>
5-
5+
<div class="code-example"><pre><code class="html hljs">my code block should default to html</code></pre></div><div class="code-example"><pre><code class="css hljs"><span class="hljs-class">.class</span><span class="hljs-rules">{<span class="hljs-rule"><span class="hljs-attribute">color</span>:<span class="hljs-value">red</span></span></span>}</code></pre></div>
66
</body>
77
</html>

test/fixtures/helper-markdown/expected/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<body>
33
<h1 id="heading">Heading</h1>
44
<p>Paragraph</p>
5-
5+
<div class="code-example"><pre><code class="html hljs">my code block should default to html</code></pre></div><div class="code-example"><pre><code class="css hljs"><span class="hljs-class">.class</span><span class="hljs-rules">{<span class="hljs-rule"><span class="hljs-attribute">color</span>:<span class="hljs-value">red</span></span></span>}</code></pre></div>
66
</body>
77
</html>

test/fixtures/helper-markdown/pages/index.html

+8
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22
# Heading
33

44
Paragraph
5+
6+
```
7+
my code block should default to html
8+
```
9+
10+
```css
11+
.class{color:red}
12+
```
513
{{/markdown}}

0 commit comments

Comments
 (0)