@berun/runner-tdx-frontmatter
Version:
BeRun runner for using yaml frontmatter with TDX documentation applications
38 lines (27 loc) • 681 B
text/typescript
import commonTransform from './transform'
class FuseBoxTDXFrontMatterPlugin {
public test: RegExp
constructor() {
this.test = /\.(?:md|mdx|tdx)$/
}
init(context) {
context.allowExtension('.md')
context.allowExtension('.mdx')
context.allowExtension('.tdx')
}
async transform(file) {
const { context } = file
if (context.useCache) {
if (file.loadFromCache()) {
return
}
}
file.loadContents()
const result = await commonTransform(file.contents)
file.contents = result
}
}
export { FuseBoxTDXFrontMatterPlugin }
export const TDXFrontMatterPlugin = () => {
return new FuseBoxTDXFrontMatterPlugin()
}