ironmark 1.7.1 → 1.8.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 CHANGED
@@ -6,32 +6,50 @@ Fast Markdown to HTML/AST parser written in Rust with **zero third-party** parsi
6
6
 
7
7
  ## Options
8
8
 
9
- ### Extensions
10
-
11
- All extension options default to `true`.
12
-
13
- | Option | JS (`camelCase`) | Rust (`snake_case`) | Description |
14
- | ------------- | --------------------- | ---------------------- | ------------------------------ |
15
- | Hard breaks | `hardBreaks` | `hard_breaks` | Every newline becomes `<br />` |
16
- | Highlight | `enableHighlight` | `enable_highlight` | `==text==` → `<mark>` |
17
- | Strikethrough | `enableStrikethrough` | `enable_strikethrough` | `~~text~~` `<del>` |
18
- | Underline | `enableUnderline` | `enable_underline` | `++text++` → `<u>` |
19
- | Tables | `enableTables` | `enable_tables` | Pipe table syntax |
20
- | Autolink | `enableAutolink` | `enable_autolink` | Bare URLs & emails → `<a>` |
21
- | Task lists | `enableTaskLists` | `enable_task_lists` | `- [ ]` / `- [x]` checkboxes |
9
+ ### Extensions (default `true`)
10
+
11
+ | Option | JS (`camelCase`) | Rust (`snake_case`) | Description |
12
+ | ------------- | -------------------------- | ----------------------------- | ------------------------------ |
13
+ | Hard breaks | `hardBreaks` | `hard_breaks` | Every newline becomes `<br />` |
14
+ | Highlight | `enableHighlight` | `enable_highlight` | `==text==` `<mark>` |
15
+ | Strikethrough | `enableStrikethrough` | `enable_strikethrough` | `~~text~~` `<del>` |
16
+ | Underline | `enableUnderline` | `enable_underline` | `++text++` → `<u>` |
17
+ | Tables | `enableTables` | `enable_tables` | Pipe table syntax |
18
+ | Autolink | `enableAutolink` | `enable_autolink` | Bare URLs & emails → `<a>` |
19
+ | Task lists | `enableTaskLists` | `enable_task_lists` | `- [ ]` / `- [x]` checkboxes |
20
+ | Indented code | `enableIndentedCodeBlocks` | `enable_indented_code_blocks` | 4-space indent → `<pre><code>` |
21
+
22
+ ### Extensions (default `false`)
23
+
24
+ | Option | JS (`camelCase`) | Rust (`snake_case`) | Description |
25
+ | ------------------- | ---------------------- | ------------------------ | ------------------------------------------------------ |
26
+ | Wiki links | `enableWikiLinks` | `enable_wiki_links` | `[[page]]` → `<a href="page">` |
27
+ | LaTeX math | `enableLatexMath` | `enable_latex_math` | `$inline$` and `$$display$$` → `<span class="math-…">` |
28
+ | Heading IDs | `enableHeadingIds` | `enable_heading_ids` | Auto `id=` on headings from slugified text |
29
+ | Heading anchors | `enableHeadingAnchors` | `enable_heading_anchors` | `<a class="anchor">` inside each heading (implies IDs) |
30
+ | Permissive headings | `permissiveAtxHeaders` | `permissive_atx_headers` | Allow `#Heading` without space after `#` |
22
31
 
23
32
  ### Security
24
33
 
25
- | Option | JS (`camelCase`) | Rust (`snake_case`) | Default | Description |
26
- | ---------------- | ---------------- | ------------------- | -------------- | ----------------------------------------------------------- |
27
- | Disable raw HTML | `disableRawHtml` | `disable_raw_html` | `false` | Escape HTML blocks & inline HTML instead of passing through |
28
- | Max nesting | | `max_nesting_depth` | `128` | Limit blockquote/list nesting depth (DoS prevention) |
29
- | Max input size | | `max_input_size` | `0` (no limit) | Truncate input beyond this byte count |
34
+ | Option | JS (`camelCase`) | Rust (`snake_case`) | Default | Description |
35
+ | ---------------- | ---------------- | ------------------- | -------------- | ------------------------------------------------------------------ |
36
+ | Disable raw HTML | `disableRawHtml` | `disable_raw_html` | `false` | Escape **all** HTML blocks and inline HTML |
37
+ | No HTML blocks | `noHtmlBlocks` | `no_html_blocks` | `false` | Escape block-level HTML only (more granular than `disableRawHtml`) |
38
+ | No HTML spans | `noHtmlSpans` | `no_html_spans` | `false` | Escape inline HTML only |
39
+ | Tag filter | `tagFilter` | `tag_filter` | `false` | GFM tag filter: escape `<script>`, `<iframe>`, etc. |
40
+ | Max nesting | — | `max_nesting_depth` | `128` | Limit blockquote/list nesting depth (DoS prevention) |
41
+ | Max input size | — | `max_input_size` | `0` (no limit) | Truncate input beyond this byte count |
30
42
 
31
43
  > In the WASM build, `max_nesting_depth` is fixed at `128` and `max_input_size` at `10 MB`.
32
44
 
33
45
  Dangerous URI schemes (`javascript:`, `vbscript:`, `data:` except `data:image/…`) are **always** stripped from link and image destinations, regardless of options.
34
46
 
47
+ ### Other options
48
+
49
+ | Option | JS (`camelCase`) | Rust (`snake_case`) | Default | Description |
50
+ | ------------------- | -------------------- | --------------------- | ------- | ------------------------------------------------- |
51
+ | Collapse whitespace | `collapseWhitespace` | `collapse_whitespace` | `false` | Collapse runs of spaces/tabs in text to one space |
52
+
35
53
  ## JavaScript / TypeScript
36
54
 
37
55
  ```bash
@@ -188,14 +206,12 @@ Parsing always uses the default `ParseOptions` (all extensions enabled, `disable
188
206
 
189
207
  ## Benchmarks
190
208
 
191
- ![Benchmark results](benchmark/results.svg)
192
-
193
- Compares ironmark against pulldown-cmark, comrak, markdown-it, and markdown-rs. Results are also saved as `benchmark/results.csv`.
209
+ Compares ironmark against pulldown-cmark, comrak, markdown-it, and markdown-rs. Results are available at [ph1p.js.org/ironmark/#benchmark](https://ph1p.js.org/ironmark/#benchmark).
194
210
 
195
211
  ```bash
196
212
  cargo bench # run all benchmarks
197
213
  cargo bench --features bench-md4c # include md4c (requires: brew install md4c)
198
- pnpm bench # run + regenerate SVG report
214
+ pnpm bench # run + update playground data
199
215
  ```
200
216
 
201
217
  ## Development
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ironmark",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "Very fast markdown parser in Rust, consumable from JavaScript/TypeScript via WebAssembly",
5
5
  "keywords": [
6
6
  "markdown",
@@ -58,8 +58,7 @@
58
58
  "release": "semantic-release",
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
- "bench": "cargo bench && node benchmark/report.mjs",
62
- "bench:full": "cargo bench --features bench-md4c && node benchmark/report.mjs",
61
+ "bench": "cargo bench --features bench-md4c && node benchmark/report.mjs",
63
62
  "test": "cargo test --offline"
64
63
  },
65
64
  "devDependencies": {
package/wasm/index.d.ts CHANGED
@@ -15,17 +15,30 @@ export interface ParseOptions {
15
15
  enableAutolink?: boolean;
16
16
  /** Enable GitHub-style task lists (`- [ ] unchecked`, `- [x] checked`). Default: true. */
17
17
  enableTaskLists?: boolean;
18
- /** When true, raw HTML is escaped instead of passed through (XSS prevention). Default: false. */
18
+ /** When true, raw HTML blocks and inline HTML are both escaped (XSS prevention). Default: false. */
19
19
  disableRawHtml?: boolean;
20
+ /** Auto-generate `id=` attributes on headings from their slugified text. Default: false. */
21
+ enableHeadingIds?: boolean;
22
+ /** Render an `<a class="anchor">` inside each heading (implies heading IDs). Default: false. */
23
+ enableHeadingAnchors?: boolean;
24
+ /** When false, 4-space-indented code blocks are disabled (treated as paragraphs). Default: true. */
25
+ enableIndentedCodeBlocks?: boolean;
26
+ /** Disable HTML block constructs (escape them as text). Default: false. */
27
+ noHtmlBlocks?: boolean;
28
+ /** Disable inline HTML spans (escape them as text). Default: false. */
29
+ noHtmlSpans?: boolean;
30
+ /** Enable GFM tag filter: escape dangerous tags like `<script>`, `<iframe>`, etc. Default: false. */
31
+ tagFilter?: boolean;
32
+ /** Collapse runs of spaces/tabs in text nodes to a single space. Default: false. */
33
+ collapseWhitespace?: boolean;
34
+ /** Allow ATX headings without a space after `#` (e.g. `#Heading`). Default: false. */
35
+ permissiveAtxHeaders?: boolean;
36
+ /** Enable `[[wiki link]]` syntax → `<a href="...">`. Default: false. */
37
+ enableWikiLinks?: boolean;
38
+ /** Enable `$...$` and `$$...$$` math syntax with HTML-escaped content. Default: false. */
39
+ enableLatexMath?: boolean;
20
40
  }
21
41
 
22
- /**
23
- * Parse Markdown to HTML.
24
- *
25
- * @param markdown - Markdown source (string or binary).
26
- * @param options - Optional parsing options.
27
- * @returns HTML string.
28
- */
29
42
  /**
30
43
  * Initialize the WASM module.
31
44
  *