aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vuepress/lib/markdown/snippet.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/vuepress/lib/markdown/snippet.js
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.tar.gz
xmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/vuepress/lib/markdown/snippet.js')
-rw-r--r--node_modules/vuepress/lib/markdown/snippet.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/node_modules/vuepress/lib/markdown/snippet.js b/node_modules/vuepress/lib/markdown/snippet.js
deleted file mode 100644
index a677e12f..00000000
--- a/node_modules/vuepress/lib/markdown/snippet.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const fs = require('fs')
-
-module.exports = function snippet (md, options = {}) {
- const root = options.root || process.cwd()
- function parser (state, startLine, endLine, silent) {
- const CH = '<'.charCodeAt(0)
- const pos = state.bMarks[startLine] + state.tShift[startLine]
- const max = state.eMarks[startLine]
-
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false
- }
-
- for (let i = 0; i < 3; ++i) {
- const ch = state.src.charCodeAt(pos + i)
- if (ch !== CH || pos + i >= max) return false
- }
-
- if (silent) {
- return true
- }
-
- const start = pos + 3
- const end = state.skipSpacesBack(max, pos)
- const rawPath = state.src.slice(start, end).trim().replace(/^@/, root)
- const filename = rawPath.split(/[{:\s]/).shift()
- const content = fs.existsSync(filename) ? fs.readFileSync(filename).toString() : 'Not found: ' + filename
- const meta = rawPath.replace(filename, '')
-
- state.line = startLine + 1
-
- const token = state.push('fence', 'code', 0)
- token.info = filename.split('.').pop() + meta
- token.content = content
- token.markup = '```'
- token.map = [startLine, startLine + 1]
-
- return true
- }
-
- md.block.ruler.before('fence', 'snippet', parser)
-}