ironmark 1.6.0 → 1.7.0
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 +50 -0
- package/package.json +2 -1
- package/wasm/node.js +1 -1
- package/wasm/pkg/ironmark_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -144,10 +144,60 @@ Exported AST types:
|
|
|
144
144
|
- `TableData`
|
|
145
145
|
- `TableAlignment`
|
|
146
146
|
|
|
147
|
+
## C / C++
|
|
148
|
+
|
|
149
|
+
The crate compiles to a static library (`libironmark.a`) that exposes two C functions. A header is provided at `include/ironmark.h`.
|
|
150
|
+
|
|
151
|
+
### Build the library
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cargo build --release
|
|
155
|
+
# output: target/release/libironmark.a
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Link
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
# Linux
|
|
162
|
+
cc -o example example.c -L target/release -l ironmark -lpthread -ldl
|
|
163
|
+
|
|
164
|
+
# macOS
|
|
165
|
+
cc -o example example.c -L target/release -l ironmark \
|
|
166
|
+
-framework CoreFoundation -framework Security
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Usage
|
|
170
|
+
|
|
171
|
+
```c
|
|
172
|
+
#include "include/ironmark.h"
|
|
173
|
+
#include <stdio.h>
|
|
174
|
+
|
|
175
|
+
int main(void) {
|
|
176
|
+
char *html = ironmark_parse("# Hello\n\nThis is **fast**.");
|
|
177
|
+
if (html) {
|
|
178
|
+
printf("%s\n", html);
|
|
179
|
+
ironmark_free(html);
|
|
180
|
+
}
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Memory contract**: `ironmark_parse` returns a heap-allocated string. You **must** free it with `ironmark_free`. Passing any other pointer to `ironmark_free` is undefined behaviour. Both functions are null-safe: `ironmark_parse(NULL)` returns `NULL`; `ironmark_free(NULL)` is a no-op.
|
|
186
|
+
|
|
187
|
+
Parsing always uses the default `ParseOptions` (all extensions enabled, `disable_raw_html` off). Options are not yet configurable through the C API.
|
|
188
|
+
|
|
147
189
|
## Benchmarks
|
|
148
190
|
|
|
149
191
|

|
|
150
192
|
|
|
193
|
+
Compares ironmark against pulldown-cmark, comrak, markdown-it, and markdown-rs. Results are also saved as `benchmark/results.csv`.
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
cargo bench # run all benchmarks
|
|
197
|
+
cargo bench --features bench-md4c # include md4c (requires: brew install md4c)
|
|
198
|
+
pnpm bench # run + regenerate SVG report
|
|
199
|
+
```
|
|
200
|
+
|
|
151
201
|
## Development
|
|
152
202
|
|
|
153
203
|
This project uses [pnpm](https://pnpm.io/) for package management.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ironmark",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Very fast markdown parser in Rust, consumable from JavaScript/TypeScript via WebAssembly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"release:dry": "semantic-release --dry-run",
|
|
60
60
|
"setup:wasm": "PATH=\"$HOME/.cargo/bin:$PATH\" rustup target add wasm32-unknown-unknown && TMPDIR=/tmp PATH=\"$HOME/.cargo/bin:$PATH\" cargo install wasm-bindgen-cli --version 0.2.114 --locked --root .wasm-tools",
|
|
61
61
|
"bench": "cargo bench && node benchmark/report.mjs",
|
|
62
|
+
"bench:full": "cargo bench --features bench-md4c && node benchmark/report.mjs",
|
|
62
63
|
"test": "cargo test --offline"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|