mirror of
https://github.com/cupcakearmy/markdown-it-import.git
synced 2024-12-22 00:06:27 +00:00
don't share options object
This commit is contained in:
parent
bc2f6242b2
commit
b11f94a647
@ -2,16 +2,18 @@ import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
|
||||
const defaultOptions = {
|
||||
function defaultOptions() {
|
||||
return {
|
||||
matcher: /@import\((?<file>.+)\)(\s*?\[(?<range>\d+-\d+)\])?/g,
|
||||
root: process.cwd(),
|
||||
}
|
||||
}
|
||||
|
||||
export type Options = Partial<typeof defaultOptions>
|
||||
export type Options = Partial<ReturnType<typeof defaultOptions>>
|
||||
|
||||
export function importPlugin(md: any, options: Options = {}) {
|
||||
// Options
|
||||
const o = Object.assign(defaultOptions, options)
|
||||
const o = Object.assign(defaultOptions(), options)
|
||||
|
||||
// Parser
|
||||
function parse(code: string, alreadyVisited: string[] = []) {
|
||||
|
Loading…
Reference in New Issue
Block a user