Skip to content

Commit a543dc2

Browse files
committed
Fixing marked configuration. Adding highliting to code snippets
1 parent a1fbc38 commit a543dc2

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

dist/examples/leagues.raml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ securitySchemes:
4848

4949
securedBy: [ basic, digest_auth, oauth_2_0 ]
5050

51-
5251
/teams:
5352
displayName: Teams
5453
post:

dist/scripts/api-console.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,30 @@
3030
var loc = window.location;
3131
var uri = loc.protocol + '//' + loc.host + loc.pathname.replace(/\/$/, '');
3232

33-
// Marked Settings
34-
renderer.paragraph = function (text) {
35-
return text;
36-
};
37-
3833
window.marked.setOptions({
3934
renderer: renderer,
4035
gfm: true,
4136
tables: true,
42-
breaks: false,
37+
breaks: true,
4338
pedantic: false,
44-
sanitize: true,
39+
sanitize: false,
4540
smartLists: true,
46-
smartypants: false
41+
smartypants: false,
42+
highlight: function (code, lang) {
43+
var result = [
44+
'<pre class="raml-console-resource-pre">',
45+
'<code class="raml-console-hljs"',
46+
'<pre>',
47+
'<code class="hljs">',
48+
lang ? window.hljs.highlightAuto(code).value.replace(/hljs/g, 'raml-console-hljs') : code,
49+
'</code>',
50+
'</pre>',
51+
'</code>',
52+
'</pre>'
53+
];
54+
55+
return result.join('');
56+
}
4757
});
4858

4959
// Settings

src/app/app.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,30 @@
3030
var loc = window.location;
3131
var uri = loc.protocol + '//' + loc.host + loc.pathname.replace(/\/$/, '');
3232

33-
// Marked Settings
34-
renderer.paragraph = function (text) {
35-
return text;
36-
};
37-
3833
window.marked.setOptions({
3934
renderer: renderer,
4035
gfm: true,
4136
tables: true,
42-
breaks: false,
37+
breaks: true,
4338
pedantic: false,
44-
sanitize: true,
39+
sanitize: false,
4540
smartLists: true,
46-
smartypants: false
41+
smartypants: false,
42+
highlight: function (code, lang) {
43+
var result = [
44+
'<pre class="raml-console-resource-pre">',
45+
'<code class="raml-console-hljs"',
46+
'<pre>',
47+
'<code class="hljs">',
48+
lang ? window.hljs.highlightAuto(code).value.replace(/hljs/g, 'raml-console-hljs') : code,
49+
'</code>',
50+
'</pre>',
51+
'</code>',
52+
'</pre>'
53+
];
54+
55+
return result.join('');
56+
}
4757
});
4858

4959
// Settings

src/assets/examples/leagues.raml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ securitySchemes:
4848

4949
securedBy: [ basic, digest_auth, oauth_2_0 ]
5050

51-
5251
/teams:
5352
displayName: Teams
5453
post:

0 commit comments

Comments
 (0)