We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 524f52f commit 761ccc2Copy full SHA for 761ccc2
src/core/render/compiler.js
@@ -42,6 +42,21 @@ const compileMedia = {
42
},
43
audio (url, config) {
44
return `<audio src="${url}" ${config || 'controls'}>Not Support</audio>`
45
+ },
46
+ code (url, config) {
47
+ const request = get(url, false)
48
+ const id = `docsify-get-${request.uid}`
49
+ let ext = url.match(/\.(\w+)$/)
50
+
51
+ ext = config.ext || (ext && ext[0])
52
53
+ request.then(text => {
54
+ document.getElementById(id).innerHTML = this.compile(
55
+ '```' + ext + '\n ' + text + '\n```\n'
56
+ )
57
+ })
58
59
+ return `<div data-origin="${url}" id=${id}></div>`
60
}
61
62
0 commit comments