Skip to content

Commit

Permalink
release: publish 0.0.1 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinOrange committed Dec 12, 2024
1 parent 4c1db02 commit 2e0661d
Show file tree
Hide file tree
Showing 20 changed files with 228 additions and 179 deletions.
36 changes: 36 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# MDX-DICT-PARSER

This is a package based on [napi-rs](https://napi.rs/) and [mdict-parser](https://crates.io/crates/mdict-parser), which provides the node-binding to read all the words and their definitions from mdict(.mdx) file.

## Usage

This package is ESM only.

First, install the package

```bash
npm i mdx-dict-parser
```

You can write such code in typescript.

```ts
import { parseMdict, DictRecord } from "mdx-dict-parser";

const filePath = "./the/path/to/your/dictionary.mdx";
const data: DictRecord[] = parseMdict(filePath);
const thirdRecord = data[3];
console.log(thirdRecord); // Print the third record.
```

## Roadmap

This project is planned to implement these following functions soon.

- mdict 1.0 and 3.0 support.
- Read details for mdict file.
- MDD parser support.

## LICENSE

MIT@[但为君故](https://dreams.plus).
8 changes: 4 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

/* auto-generated by NAPI-RS */

export declare function parseMdict(file: string): Array<DictRecord>
export declare function parseMdict(file: string): Array<DictRecord>;
export declare class DictRecord {
word: string
definition: string
constructor(word: string, definition: string)
word: string;
definition: string;
constructor(word: string, definition: string);
}
Loading

0 comments on commit 2e0661d

Please sign in to comment.