obby-parser 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +27 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,39 +1,41 @@
1
1
  # Obsi-Parser
2
- A helper package for converting markdown into html.
3
2
 
4
- Supports obsidian style links and returns translated html and links to then be used on something like my personal website
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
- # c-addon-example
5
+ ## Features
7
6
 
8
- Minimal example npm package showing how to call C code from Node using an N-API native addon.
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
- ## Requirements
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
- Or explicitly:
17
+ ## Usage
24
18
 
25
- ```bash
26
- npm run build
27
- ```
19
+ ```typescript
20
+ import { parseMarkdown } from 'obsi-parser';
28
21
 
29
- ## Usage
22
+ const markdown = "This references [[My Page]] and also **bold** text.";
23
+ const result = parseMarkdown(markdown, "pages/");
30
24
 
31
- ```js
32
- const { add } = require('c-addon-example');
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
- ## Notes
37
- - To link an external C library, add the library to the repo or system and update `binding.gyp` with include_dirs and libraries entries.
38
- - To publish prebuilt binaries for many platforms, use tools like `prebuild` or `prebuildify` and CI to build artifacts.
39
- - For an alternative that avoids native compilation on user machines, consider compiling the C to WebAssembly or using `ffi-napi` to call precompiled shared libraries.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obby-parser",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Parse Obsidian-style markdown files including ([[links]]) into HTML and extract links",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",