-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
149 changed files
with
1,605 additions
and
1,832 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,51 @@ | ||
// copy from [vitepress](https://github.com/vuejs/vitepress) | ||
import fs from 'fs' | ||
// MIT License Copyright (c) 2019-present, Yuxi (Evan) You | ||
import { existsSync, readFileSync } from 'node:fs' | ||
import MarkdownIt from 'markdown-it' | ||
import { RuleBlock } from 'markdown-it/lib/parser_block' | ||
|
||
export default (md: MarkdownIt): void => { | ||
const parser: RuleBlock = (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) { | ||
md.block.ruler.before( | ||
'fence', | ||
'snippet', | ||
(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(/^@/, process.cwd()) | ||
const content = existsSync(rawPath) | ||
? readFileSync(rawPath).toString() | ||
: 'Not found: ' + rawPath | ||
const meta = rawPath.replace(rawPath, '') | ||
|
||
state.line = startLine + 1 | ||
|
||
const token = state.push('fence', 'code', 0) | ||
token.info = rawPath.split('.').pop() + meta | ||
token.content = content | ||
token.markup = '```' | ||
token.map = [startLine, startLine + 1] | ||
|
||
return true | ||
} | ||
|
||
const start = pos + 3 | ||
const end = state.skipSpacesBack(max, pos) | ||
const rawPath = state.src | ||
.slice(start, end) | ||
.trim() | ||
.replace(/^@/, process.cwd()) | ||
const content = fs.existsSync(rawPath) | ||
? fs.readFileSync(rawPath).toString() | ||
: 'Not found: ' + rawPath | ||
const meta = rawPath.replace(rawPath, '') | ||
|
||
state.line = startLine + 1 | ||
|
||
const token = state.push('fence', 'code', 0) | ||
token.info = rawPath.split('.').pop() + meta | ||
token.content = content | ||
token.markup = '```' | ||
token.map = [startLine, startLine + 1] | ||
|
||
return true | ||
} | ||
|
||
md.block.ruler.before('fence', 'snippet', parser) | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
<template> | ||
<pro-card header="header"> | ||
Content | ||
</pro-card> | ||
<pro-card header="header"> Content </pro-card> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.