@qrcommunication/gigapdf-lib 0.60.0 → 0.62.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/CHANGELOG.md CHANGED
@@ -4,6 +4,36 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and the
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.62.0] - 2026-06-22
8
+
9
+ ### Added
10
+
11
+ - **Markdown importer** — `mdToModel(md)` parses CommonMark-ish Markdown
12
+ (pure Rust, zero deps) into the unified editable model: ATX headings,
13
+ paragraphs, ordered/unordered nested lists, inline bold/italic/code/links with
14
+ backslash escapes, fenced code blocks, block quotes, thematic breaks, and GFM
15
+ pipe tables. ABI `gp_model_from_md`.
16
+ - **CSV importer** — `csvToModel(csv)` parses RFC 4180 CSV (quoted fields with
17
+ embedded delimiters/newlines, `""` escape, CRLF/CR/LF, UTF-8 BOM strip,
18
+ delimiter auto-detection among `,` `;` tab `|`) into a single table block
19
+ (header row bold + shaded). ABI `gp_model_from_csv`. Returns `null` for empty
20
+ input.
21
+
22
+ ## [0.61.0] - 2026-06-22
23
+
24
+ ### Fixed
25
+
26
+ - **Form layouts no longer mis-detected as giant tables.** The layout
27
+ reconstruction (`recon/tables`, surfaced by `pageBlocks`/`toModel`) clustered
28
+ every ruling line into grid edges and claimed every text line inside the grid
29
+ bounding box, so a form's field-separator rules synthesised a giant table that
30
+ swallowed the title and intro prose into cells. A geometric sanity gate now
31
+ rejects a table candidate when `n_cols > 14`, `n_rows × n_cols > 160`, or the
32
+ cell fill ratio `< 0.28` — the text flows back to the heading/paragraph
33
+ pipeline. Real data tables (regular grid, well-filled) are preserved; dense
34
+ ruled forms (16–47 columns, 7–24% fill) become standalone headings/paragraphs
35
+ in reading order. No change to genuine `table` blocks.
36
+
7
37
  ## [0.60.0] - 2026-06-22
8
38
 
9
39
  ### Added
package/dist/index.cjs CHANGED
@@ -737,6 +737,27 @@ var GigaPdfEngine = class _GigaPdfEngine {
737
737
  (p, l) => JSON.parse(this._str((o) => this.ex.gp_model_from_html(p, l, o)))
738
738
  );
739
739
  }
740
+ /**
741
+ * Lower a Markdown string into the unified {@link GigaDocument} model
742
+ * (CommonMark-ish: headings, lists, GFM tables, fenced code, emphasis/links).
743
+ */
744
+ mdToModel(md) {
745
+ return this._withStr(
746
+ md,
747
+ (p, l) => JSON.parse(this._str((o) => this.ex.gp_model_from_md(p, l, o)))
748
+ );
749
+ }
750
+ /**
751
+ * Lower a CSV file (UTF-8 bytes, RFC 4180, auto-detected `,`/`;`/tab/`|`
752
+ * delimiter) into the unified {@link GigaDocument} model as a single editable
753
+ * table. Returns `null` if the bytes contain no parseable fields.
754
+ */
755
+ csvToModel(csv) {
756
+ return this._withBytes(
757
+ csv,
758
+ (p, l) => this._modelOrNull((o) => this.ex.gp_model_from_csv(p, l, o))
759
+ );
760
+ }
740
761
  /**
741
762
  * Apply a batch of {@link ModelOp} edits to a model and return the edited
742
763
  * model. Ops run in order; out-of-range addresses (and any op that can't be