File tree 4 files changed +74
-2
lines changed
4 files changed +74
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
You can see below the API reference of this module.
4
4
5
+ ### ` showdownHighlight() `
6
+ Highlight the code in the showdown input.
7
+
8
+ Examples:
9
+
10
+ ``` js
11
+ let converter = new showdown.Converter ({
12
+ extensions: [showdownHighlight]
13
+ });
14
+ ```
15
+
16
+ Enable the classes in the ` <pre> ` element:
17
+
18
+ ``` js
19
+ let converter = new showdown.Converter ({
20
+ extensions: [showdownHighlight ({ pre: true })]
21
+ });
22
+ ```
23
+
Original file line number Diff line number Diff line change @@ -81,7 +81,10 @@ const showdown = require('showdown')
81
81
// After requiring the module, use it as extension
82
82
let converter = new showdown.Converter ({
83
83
// That's it
84
- extensions: [showdownHighlight]
84
+ extensions: [showdownHighlight ({
85
+ // Whether to add the classes to the <pre> tag
86
+ pre: true
87
+ })]
85
88
});
86
89
87
90
// Now you can Highlight code blocks
@@ -133,6 +136,30 @@ There are few ways to get help:
133
136
134
137
135
138
139
+ ## :memo : Documentation
140
+
141
+
142
+ ### ` showdownHighlight() `
143
+ Highlight the code in the showdown input.
144
+
145
+ Examples:
146
+
147
+ ``` js
148
+ let converter = new showdown.Converter ({
149
+ extensions: [showdownHighlight]
150
+ });
151
+ ```
152
+
153
+ Enable the classes in the ` <pre> ` element:
154
+
155
+ ``` js
156
+ let converter = new showdown.Converter ({
157
+ extensions: [showdownHighlight ({ pre: true })]
158
+ });
159
+ ```
160
+
161
+
162
+
136
163
137
164
138
165
Original file line number Diff line number Diff line change @@ -7,7 +7,10 @@ const showdown = require('showdown')
7
7
// After requiring the module, use it as extension
8
8
let converter = new showdown . Converter ( {
9
9
// That's it
10
- extensions : [ showdownHighlight ]
10
+ extensions : [ showdownHighlight ( {
11
+ // Whether to add the classes to the <pre> tag
12
+ pre : true
13
+ } ) ]
11
14
} ) ;
12
15
13
16
// Now you can Highlight code blocks
Original file line number Diff line number Diff line change @@ -6,6 +6,29 @@ const decodeHtml = require("html-encoder-decoder").decode
6
6
, classAttr = 'class="'
7
7
;
8
8
9
+ /**
10
+ * showdownHighlight
11
+ * Highlight the code in the showdown input.
12
+ *
13
+ * Examples:
14
+ *
15
+ * ```js
16
+ * let converter = new showdown.Converter({
17
+ * extensions: [showdownHighlight]
18
+ * });
19
+ * ```
20
+ *
21
+ * Enable the classes in the `<pre>` element:
22
+ *
23
+ * ```js
24
+ * let converter = new showdown.Converter({
25
+ * extensions: [showdownHighlight({ pre: true })]
26
+ * });
27
+ * ```
28
+ *
29
+ * @name showdownHighlight
30
+ * @function
31
+ */
9
32
module . exports = function showdownHighlight ( { pre = false } ) {
10
33
return [
11
34
{
You can’t perform that action at this time.
0 commit comments