Commit 7a8f3d4d authored by Björn Bartels's avatar Björn Bartels

fixed some markdown rendering

parent ec7b16f8
......@@ -43,10 +43,10 @@ function getGitInfo(value, config, pl) {
' timestamp: %ct'+'%n'+
' author: %an'+'%n'+
' email: %ae'+'%n'+
' message: \"%s\"'+'%n'+
' message: \'\"%s\"\''+'%n'+
' commit: %h'+'%n'+
' hash: %H'+'%n'+
' body: \"%b\"'+'%n'+
' body: \'\"%b\"\''+'%n'+
'%n';
var logFormatCompact =
......
......@@ -11,12 +11,8 @@ var multiline = require('multiline');
var highlightCode = require('../util/highlight-code');
var HTML_EXAMPLE_TEMPLATE = multiline(function() {/*
<div class="docs-code" data-docs-code>
<pre>
<code class="{0}">
{1}
</code>
</pre>
<div class="docs-code" data-patternlibrary-copycode>
<pre><code class="language-{0}">{1}</code></pre>
</div>
*/}).replace(/(^(\s)*)/gm, '');
......
......@@ -2,11 +2,28 @@ var hljs = require('highlight.js');
function highlightCode(code, language) {
if (typeof language === 'undefined') language = 'html';
var renderedCode = hljs.highlight(language, code).value;
var output = '<div class="code-example"><pre><code class="'+language+'">'+renderedCode+'</code></pre></div>';
if ( (typeof language === 'undefined') || (language == '') ) {
language = 'html';
}
var lang = language.replace('_example', '');
if (lang == '') {
lang == 'html';
}
var example = language != lang;
var renderedCode = hljs.highlight(lang, code, true).value;
var output = '<pre class="docs-code" data-docs-code><code class="'+lang+'">'+renderedCode+'</code></pre>';
//var output = ''+renderedCode+'';
if (example) {
output = '<pre class="hide hidden" style="display: none !important;"></pre>'
+ '<h3>Source</h3>'
+ '<pre class="docs-code" data-docs-code><code class="'+lang+'">'+renderedCode+'</code></pre>'
+ '<h3>Output</h3>'
+ '<div class="code-example">'+code+'</div>';
}
return output;
};
......@@ -23,19 +40,19 @@ var $markdown = require('markdown-it')({
highlight : highlightCode
})
.use(require("markdown-it-abbr"))
.use(require("markdown-it-anchor"))
.use(require("markdown-it-deflist"))
.use(require("markdown-it-emoji"))
.use(require("markdown-it-footnote"))
//.use(require("markdown-it-pandoc-renderer"))
.use(require("markdown-it-sub"))
.use(require("markdown-it-sup"))
.use(require("markdown-it-anchor"))
.use(require("markdown-it-table-of-contents"))
.use(require("markdown-it-container"))
.use(require("markdown-it-component"))
.use(require("markdown-it-task-lists"))
.use(require("markdown-it-fontawesome"))
//.use(require('markdown-it-highlightjs'))
//.use(require("markdown-it-prism"))
;
module.exports = $markdown;
\ No newline at end of file
<html>
<body>
<h1>Heading</h1>
<h1 id="heading">Heading</h1>
<p>Paragraph</p>
</body>
</html>
<html>
<body>
<h1>Heading</h1>
<h1 id="heading">Heading</h1>
<p>Paragraph</p>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment