-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathdevice-frame.js
More file actions
executable file
·48 lines (48 loc) · 1.12 KB
/
device-frame.js
File metadata and controls
executable file
·48 lines (48 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict'
/**
* Adds device frames to images
*
* For example:
* /// frame ios
* <img src="ios_screenshot.png">
* ///
*
* /// frame android
* <img src="android_screenshot.png">
* ///
*/
Object.defineProperty(exports, '__esModule', { value: true })
exports.createDeviceFrameContainer = void 0
const container = require('markdown-it-container')
const klass = 'frame'
function createDeviceFrameContainer() {
return [
container,
klass,
{
marker: '/',
render(tokens, idx) {
const token = tokens[idx]
const info = token.info.trim().slice(klass.length).trim()
const deviceFrameStart = `
<div class="${info} device-frame">
<div class="${info} small-round-top"/>
<div class="${info} round-top-left"/>
<div class="${info} speaker"/>
<div class="${info} screenshot">
`
const deviceFrameEnd = `
</div>
<div class="${info} button"/>
</div>
`
if (token.nesting === 1) {
return deviceFrameStart
} else {
return deviceFrameEnd
}
},
},
]
}
exports.createDeviceFrameContainer = createDeviceFrameContainer