@@ -2,6 +2,7 @@ const fs = require('fs')
2
2
const path = require ( 'path' )
3
3
const stemContent = require ( './stem' )
4
4
5
+ const octicons = require ( '@primer/octicons' )
5
6
const faLibrary = require ( '@fortawesome/fontawesome-svg-core' ) . library
6
7
const faIcon = require ( '@fortawesome/fontawesome-svg-core' ) . icon
7
8
const faDom = require ( '@fortawesome/fontawesome-svg-core' ) . dom
@@ -185,30 +186,6 @@ ${syntaxHighlighterFooter(node, syntaxHighlighter, { cdn_base_url: cdnBaseUrl, l
185
186
} ,
186
187
inline_image : ( node , baseConverter ) => {
187
188
if ( node . getType ( ) === 'icon' && isSvgIconEnabled ( node ) ) {
188
- const transform = { }
189
- if ( node . hasAttribute ( 'rotate' ) ) {
190
- transform . rotate = node . getAttribute ( 'rotate' )
191
- }
192
- if ( node . hasAttribute ( 'flip' ) ) {
193
- const flip = node . getAttribute ( 'flip' )
194
- if ( flip === 'vertical' || flip === 'y' || flip === 'v' ) {
195
- transform . flipY = true
196
- } else {
197
- transform . flipX = true
198
- }
199
- }
200
- const options = { }
201
- options . transform = transform
202
- if ( node . hasAttribute ( 'title' ) ) {
203
- options . title = node . getAttribute ( 'title' )
204
- }
205
- options . classes = [ ]
206
- if ( node . hasAttribute ( 'size' ) ) {
207
- options . classes . push ( `fa-${ node . getAttribute ( 'size' ) } ` )
208
- }
209
- if ( node . getRoles ( ) && node . getRoles ( ) . length > 0 ) {
210
- options . classes = options . classes . concat ( node . getRoles ( ) . map ( value => value . trim ( ) ) )
211
- }
212
189
const meta = { }
213
190
const target = node . getTarget ( )
214
191
let iconName = target
@@ -220,9 +197,41 @@ ${syntaxHighlighterFooter(node, syntaxHighlighter, { cdn_base_url: cdnBaseUrl, l
220
197
meta . prefix = parts [ 1 ]
221
198
}
222
199
meta . iconName = iconName
223
- const icon = faIcon ( meta , options )
224
- if ( icon ) {
225
- return icon . html
200
+ if ( meta . prefix === 'octicons' ) {
201
+ const icon = octicons [ meta . iconName ]
202
+ if ( icon ) {
203
+ return icon . toSVG ( )
204
+ }
205
+ } else {
206
+ // FontAwesome
207
+ const transform = { }
208
+ if ( node . hasAttribute ( 'rotate' ) ) {
209
+ transform . rotate = node . getAttribute ( 'rotate' )
210
+ }
211
+ if ( node . hasAttribute ( 'flip' ) ) {
212
+ const flip = node . getAttribute ( 'flip' )
213
+ if ( flip === 'vertical' || flip === 'y' || flip === 'v' ) {
214
+ transform . flipY = true
215
+ } else {
216
+ transform . flipX = true
217
+ }
218
+ }
219
+ const options = { }
220
+ options . transform = transform
221
+ if ( node . hasAttribute ( 'title' ) ) {
222
+ options . title = node . getAttribute ( 'title' )
223
+ }
224
+ options . classes = [ ]
225
+ if ( node . hasAttribute ( 'size' ) ) {
226
+ options . classes . push ( `fa-${ node . getAttribute ( 'size' ) } ` )
227
+ }
228
+ if ( node . getRoles ( ) && node . getRoles ( ) . length > 0 ) {
229
+ options . classes = options . classes . concat ( node . getRoles ( ) . map ( value => value . trim ( ) ) )
230
+ }
231
+ const icon = faIcon ( meta , options )
232
+ if ( icon ) {
233
+ return icon . html
234
+ }
226
235
}
227
236
} else {
228
237
return baseConverter . $convert_inline_image ( node )
0 commit comments