Skip to content

Commit

Permalink
Merge branch 'release/v1.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeworkman committed Jul 23, 2020
2 parents f31eb07 + 5376e66 commit 18891d3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions helpers/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var hljs = require('highlight.js');
*/
module.exports = function(language, options) {
if (typeof language === 'undefined') language = 'html';
language = hljs.getLanguage(language) ? language : 'html';

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

Expand Down
2 changes: 2 additions & 0 deletions helpers/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var marked = require('marked');
renderer.code = function(code, language) {
if (typeof language === 'undefined') language = 'html';

language = hljs.getLanguage(language) ? language : 'html';

var renderedCode = hljs.highlight(language, code).value;
var output = `<div class="code-example"><pre><code class="${language} hljs">${renderedCode}</code></pre></div>`;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "panini",
"version": "1.7.0",
"version": "1.7.1",
"description": "A super tiny flat file compiler.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/helper-markdown/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<body>
<h1 id="heading">Heading</h1>
<p>Paragraph</p>

<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>
</body>
</html>
2 changes: 1 addition & 1 deletion test/fixtures/helper-markdown/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<body>
<h1 id="heading">Heading</h1>
<p>Paragraph</p>

<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>
</body>
</html>
8 changes: 8 additions & 0 deletions test/fixtures/helper-markdown/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@
# Heading

Paragraph

```
my code block should default to html
```

```css
.class{color:red}
```
{{/markdown}}

0 comments on commit 18891d3

Please sign in to comment.