This repository was archived by the owner on May 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1+ const Handlebars = require ( 'handlebars' ) ;
2+
3+ const hljs = require ( 'highlight.js' ) ;
4+ const markdown = require ( 'markdown-it' ) ( {
5+ highlight ( code ) {
6+
7+ return hljs . highlight ( 'javascript' , code ) . value ;
8+
9+ } ,
10+ 'html' : true ,
11+ 'linkify' : true
12+ } ) ;
13+
14+ Handlebars . registerHelper ( 'highlightBlock' , block => {
15+
16+ if ( block ) {
17+
18+ return hljs . highlight ( 'javascript' , block ) . value ;
19+
20+ }
21+
22+ return null ;
23+
24+ } ) ;
25+
26+ Handlebars . registerHelper ( 'markdown' , block => {
27+
28+ if ( block ) {
29+
30+ return markdown . render ( block ) ;
31+
32+ }
33+
34+ return null ;
35+
36+ } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ const path = require('path');
33
44const Handlebars = require ( 'handlebars' ) ;
55
6+ require ( './helpers' ) ;
7+
68/**
79 * Custom Handlebars template plugin for doxdox.
810 *
Original file line number Diff line number Diff line change 88 },
99 "license" : " MIT" ,
1010 "dependencies" : {
11- "handlebars" : " 4.0.6"
11+ "handlebars" : " 4.0.6" ,
12+ "highlight.js" : " 9.8.0" ,
13+ "markdown-it" : " 8.1.0"
1214 },
1315 "devDependencies" : {
1416 "@neogeek/eslint-config-standards" : " 1.8.0" ,
2325 "keywords" : [
2426 " doxdox" ,
2527 " plugin" ,
26- " handlebars"
28+ " handlebars" ,
29+ " markdown"
2730 ],
2831 "authors" : [
2932 {
You can’t perform that action at this time.
0 commit comments