obby-parser 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
#
|
|
2
|
-
A helper package for converting markdown into html.
|
|
1
|
+
# Obby-Parser
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
A simple TypeScript library for parsing Obsidian-style markdown. It converts `[[wikilinks]]` to HTML anchor tags and collects all unique links.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Features
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- Converts `[[Page Name]]` to `<a href="route/Page-Name">Page Name</a>`
|
|
8
|
+
- Collects all wikilinks in a Set
|
|
9
|
+
- Supports standard markdown formatting via [markdown-it](https://github.com/markdown-it/markdown-it)
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
-
- Node.js (LTS recommended)
|
|
12
|
-
- Python 3
|
|
13
|
-
- Native build tools (gcc/clang/Xcode/Visual Studio Build Tools)
|
|
14
|
-
|
|
15
|
-
## Build
|
|
16
|
-
Install dependencies and build the addon:
|
|
11
|
+
## Installation
|
|
17
12
|
|
|
18
13
|
```bash
|
|
19
|
-
npm install
|
|
20
|
-
# (node-gyp runs via the install script and builds the addon)
|
|
14
|
+
npm install obsi-parser
|
|
21
15
|
```
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
## Usage
|
|
24
18
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```
|
|
19
|
+
```typescript
|
|
20
|
+
import { parseMarkdown } from 'obsi-parser';
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
const markdown = "This references [[My Page]] and also **bold** text.";
|
|
23
|
+
const result = parseMarkdown(markdown, "pages/");
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(add(2, 3)); // 5
|
|
25
|
+
console.log(result.html); // HTML output with anchor tags
|
|
26
|
+
console.log(result.links_set); // Set { "My Page" }
|
|
34
27
|
```
|
|
35
28
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
### `parseMarkdown(markdown: string, route: string): ParseResult`
|
|
32
|
+
|
|
33
|
+
- `markdown`: The markdown string to parse.
|
|
34
|
+
- `route`: The base path for generated links.
|
|
35
|
+
- Returns:
|
|
36
|
+
- `html`: The resulting HTML string.
|
|
37
|
+
- `links_set`: A Set of all unique wikilinks found.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|