整理 docs 代码

This commit is contained in:
就眠儀式
2021-12-30 14:00:25 +08:00
parent af5a0e0cc9
commit 0b09de219e
11 changed files with 29 additions and 49 deletions

View File

@@ -37,4 +37,4 @@ const plugins = [
}),
] as any
export default plugins
export default plugins

View File

@@ -2,12 +2,9 @@ import container from "markdown-it-container";
import type Token from "markdown-it/lib/token";
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string;
}
];
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(
klass: string,

View File

@@ -2,11 +2,8 @@ import container from 'markdown-it-container'
import type Token from 'markdown-it/lib/token'
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string
}
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(

View File

@@ -2,11 +2,8 @@ import container from 'markdown-it-container'
import type Token from 'markdown-it/lib/token'
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string
}
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(
@@ -27,4 +24,4 @@ export default function createContainer(
},
},
]
}
}

View File

@@ -2,11 +2,8 @@ import container from 'markdown-it-container'
import type Token from 'markdown-it/lib/token'
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string
}
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(
@@ -28,4 +25,4 @@ export default function createContainer(
},
},
]
}
}

View File

@@ -2,11 +2,8 @@ import container from 'markdown-it-container'
import type Token from 'markdown-it/lib/token'
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string
}
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(
@@ -28,4 +25,4 @@ export default function createContainer(
},
},
]
}
}

View File

@@ -2,11 +2,8 @@ import container from 'markdown-it-container'
import type Token from 'markdown-it/lib/token'
type ContainerArgs = [
typeof container,
string,
{
render(tokens: Token[], idx: number): string
}
typeof container, string,
{ render(tokens: Token[], idx: number): string }
]
export default function createContainer(
@@ -23,11 +20,11 @@ export default function createContainer(
if (token.nesting === 1) {
return `<lay-field id="${info || defaultTitle}" title="${
info || defaultTitle
}" style="margin-top:20px;margin-bottom: 20px;">`
}" style="margin-top:21px;margin-bottom: 20px;">`
} else {
return '</lay-field>\n'
}
},
},
]
}
}

View File

@@ -19,13 +19,8 @@ export default (md: MarkdownIt): void => {
}
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 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)
@@ -36,4 +31,4 @@ export default (md: MarkdownIt): void => {
return true
}
md.block.ruler.before('fence', 'snippet', parser)
}
}