Skip to content

Commit 2e0661d

Browse files
committed
release: publish 0.0.1 version.
1 parent 4c1db02 commit 2e0661d

File tree

20 files changed

+228
-179
lines changed

20 files changed

+228
-179
lines changed

README.MD

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# MDX-DICT-PARSER
2+
3+
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.
4+
5+
## Usage
6+
7+
This package is ESM only.
8+
9+
First, install the package
10+
11+
```bash
12+
npm i mdx-dict-parser
13+
```
14+
15+
You can write such code in typescript.
16+
17+
```ts
18+
import { parseMdict, DictRecord } from "mdx-dict-parser";
19+
20+
const filePath = "./the/path/to/your/dictionary.mdx";
21+
const data: DictRecord[] = parseMdict(filePath);
22+
const thirdRecord = data[3];
23+
console.log(thirdRecord); // Print the third record.
24+
```
25+
26+
## Roadmap
27+
28+
This project is planned to implement these following functions soon.
29+
30+
- mdict 1.0 and 3.0 support.
31+
- Read details for mdict file.
32+
- MDD parser support.
33+
34+
## LICENSE
35+
36+
MIT@[但为君故](https://dreams.plus).

index.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
/* auto-generated by NAPI-RS */
55

6-
export declare function parseMdict(file: string): Array<DictRecord>
6+
export declare function parseMdict(file: string): Array<DictRecord>;
77
export declare class DictRecord {
8-
word: string
9-
definition: string
10-
constructor(word: string, definition: string)
8+
word: string;
9+
definition: string;
10+
constructor(word: string, definition: string);
1111
}

0 commit comments

Comments
 (0)