formatferry 1.0.15 → 1.0.17

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/dist/index.js +7 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22547,7 +22547,6 @@ function extractVectorLines(fnArray, argsArray, pageWidth, pageHeight) {
22547
22547
  let pathStartX = 0;
22548
22548
  let pathStartY = 0;
22549
22549
  let pending = [];
22550
- const isPathOp = (op) => op === PDF_OP.moveTo || op === PDF_OP.lineTo || op === PDF_OP.closePath || op === PDF_OP.rectangle;
22551
22550
  const isStrokeOp = (op) => op === PDF_OP.stroke || op === PDF_OP.closeStroke || op === PDF_OP.fillStroke;
22552
22551
  const flushPending = () => {
22553
22552
  for (const p of pending) {
@@ -22573,6 +22572,7 @@ function extractVectorLines(fnArray, argsArray, pageWidth, pageHeight) {
22573
22572
  const op = fnArray[i];
22574
22573
  const args = argsArray[i] ?? [];
22575
22574
  if (op === PDF_OP.moveTo) {
22575
+ pending = [];
22576
22576
  curX = args[0] ?? 0;
22577
22577
  curY = args[1] ?? 0;
22578
22578
  pathStartX = curX;
@@ -22598,8 +22598,6 @@ function extractVectorLines(fnArray, argsArray, pageWidth, pageHeight) {
22598
22598
  curY = pathStartY;
22599
22599
  } else if (isStrokeOp(op)) {
22600
22600
  flushPending();
22601
- } else if (!isPathOp(op)) {
22602
- pending = [];
22603
22601
  }
22604
22602
  }
22605
22603
  return lines;
@@ -23058,7 +23056,10 @@ var PdfAdapter = class {
23058
23056
  }
23059
23057
  const paragraphs = page.textContent.split("\n\n").filter((p) => p.trim()).map((p) => {
23060
23058
  const trimmed = p.trim();
23061
- if (trimmed.length < 100 && !trimmed.match(/[.,:;!?]$/)) {
23059
+ const hasWideGap = /( {3,}|\u00A0\u00A0|\t)/.test(trimmed);
23060
+ const looksLikeSentence = trimmed.length > 40 && /^[A-Z]/.test(trimmed);
23061
+ const isShort = trimmed.length < 80 && !/[.,:;!?]$/.test(trimmed) && !/\n/.test(trimmed) && !hasWideGap && !looksLikeSentence;
23062
+ if (isShort) {
23062
23063
  return `<p><strong>${escapeHtml(trimmed)}</strong></p>`;
23063
23064
  }
23064
23065
  return `<p>${escapeHtml(trimmed)}</p>`;
@@ -25314,8 +25315,8 @@ import { readFileSync as readFileSync4 } from "fs";
25314
25315
  import { resolve, dirname as dirname3 } from "path";
25315
25316
  import { fileURLToPath } from "url";
25316
25317
  var getVersion = () => {
25317
- if ("1.0.15") {
25318
- return "1.0.15";
25318
+ if ("1.0.17") {
25319
+ return "1.0.17";
25319
25320
  }
25320
25321
  try {
25321
25322
  const __dirname = dirname3(fileURLToPath(import.meta.url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formatferry",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "FormatFerry CLI — Convert HTML, DOCX, PDF, XLSX, CSV, JSON, XML, PPTX to Markdown",
5
5
  "keywords": [
6
6
  "markdown",