markdown-magic 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/transforms/code/index.js +15 -14
- package/package.json +1 -1
|
@@ -84,30 +84,31 @@ module.exports = async function CODE(api) {
|
|
|
84
84
|
// https://gist.githubusercontent.com/DavidWells/7d2e0e1bc78f4ac59a123ddf8b74932d/raw/0808a83de7f07c931fb81ed691c1d6bbafad29d1/aligning-images.md
|
|
85
85
|
|
|
86
86
|
let remoteContent
|
|
87
|
+
|
|
88
|
+
if (isGithubLink(src)) {
|
|
89
|
+
remoteContent = await resolveGithubContents({
|
|
90
|
+
repoFilePath: src,
|
|
91
|
+
accessToken,
|
|
92
|
+
// debug: true
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
87
96
|
// Try initial remote request if public url
|
|
88
|
-
if (!
|
|
97
|
+
if (!remoteContent) {
|
|
89
98
|
remoteContent = remoteRequest(src)
|
|
90
99
|
}
|
|
100
|
+
|
|
91
101
|
if (!remoteContent) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
repoFilePath: src,
|
|
95
|
-
accessToken,
|
|
96
|
-
// debug: true
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
if (!remoteContent) {
|
|
100
|
-
console.log(`WARNING: ${src} URL NOT FOUND or internet connection is off or no access to remove URL`)
|
|
101
|
-
return originalContent
|
|
102
|
-
}
|
|
102
|
+
console.log(`WARNING: ${src} URL NOT FOUND or internet connection is off or no access to remove URL`)
|
|
103
|
+
return originalContent
|
|
103
104
|
}
|
|
104
105
|
code = remoteContent
|
|
105
|
-
syntax = path.extname(src).replace(/^./, '')
|
|
106
|
+
syntax = (path.extname(src).replace(/^./, '') || '').split('#')[0]
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
/* handle option `lines` */
|
|
109
110
|
if (options.lines) {
|
|
110
|
-
const lineCount = getLineCount(code)
|
|
111
|
+
// const lineCount = getLineCount(code)
|
|
111
112
|
// console.log('lineCount', lineCount)
|
|
112
113
|
// console.log('src', src)
|
|
113
114
|
// console.log('lines', lines)
|