diff --git a/.gitignore b/.gitignore index f68357d..41432a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ lib/ esm/ -tsconfig.tsbuildinfo \ No newline at end of file +tsconfig.tsbuildinfo +release-toolbox.json diff --git a/src/index.ts b/src/index.ts index e69de29..5a317b4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1,3 @@ +export { md } from './md.js'; + +export { createMd, insertMd } from './utils.js'; diff --git a/src/md.ts b/src/md.ts index c92cf78..80a0746 100644 --- a/src/md.ts +++ b/src/md.ts @@ -40,7 +40,7 @@ type TableParamsType = { type: 'table'; params: [header: string[], content: stri type DataType = (HeadingParamsType | BlockquoteParamsType | LinkParamsType | TableParamsType)[]; -export const write = (data: DataType) => { +export const md = (data: DataType) => { const headingMap = Array(5) .fill(undefined) .map((_, index) => index + 1) diff --git a/src/test.js b/src/test.ts similarity index 79% rename from src/test.js rename to src/test.ts index 30b17e4..0cb232d 100644 --- a/src/test.js +++ b/src/test.ts @@ -1,9 +1,9 @@ -import { writeFileToLine } from './utils.js'; -import { write } from './md.js'; +import { insertMd } from './utils.js'; +import { md } from './md.js'; -writeFileToLine( +insertMd( 'TEST.md', - write([ + md([ { type: 'h1', params: '123' }, { type: 'h2', params: '123' }, { type: 'h3', params: '123' }, diff --git a/src/utils.ts b/src/utils.ts index ea31b79..ef3bff1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,10 +1,9 @@ import fs from 'fs'; import path from 'path'; - import { LF } from './md.js'; //往固定的行写入数据 -export const writeFileToLine = (fileName: string, content: string, line = 0) => { +export const insertMd = (fileName: string, content: string, line = 0) => { const _path = path.resolve('./', fileName); // 计算行 @@ -18,7 +17,7 @@ export const writeFileToLine = (fileName: string, content: string, line = 0) => fs.writeFileSync(_path, outputMd); }; -export const createNewFile = (fileName: string, content: string) => { +export const createMd = (fileName: string, content: string) => { const _path = path.resolve('./', fileName); fs.writeFileSync(_path, content); };