mirror of
https://github.com/cupcakearmy/markdown-it-import.git
synced 2024-12-21 15:56:26 +00:00
12 lines
464 B
TypeScript
12 lines
464 B
TypeScript
import { readFile } from 'node:fs/promises'
|
|
import { join } from 'node:path'
|
|
import MarkdownIt from 'markdown-it'
|
|
import { Options, importPlugin } from '../src/index.ts'
|
|
|
|
export async function render(path: string, options: Options | undefined = undefined): Promise<string> {
|
|
const filename = join('./tests/fixtures', path)
|
|
const input = await readFile(filename, 'utf-8')
|
|
const output = MarkdownIt().use(importPlugin, options).render(input)
|
|
return output
|
|
}
|