@sleepwalkerai/cli 0.2.0 → 0.2.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/package.json +1 -1
  2. package/src/okf.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleepwalkerai/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Command-line client for the Sleepwalker API.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/okf.js CHANGED
@@ -196,6 +196,10 @@ function htmlToMarkdown(fragment, baseUrl) {
196
196
  // Drop empty heading markers left when a heading's text lived in nested blocks
197
197
  // that were stripped (avoids junk lines like a bare "#" or "##").
198
198
  out = out.replace(/^[ \t]*#{1,6}[ \t]*$/gm, "");
199
+ // Strip control/bidi characters BEFORE collapsing: if they sit between
200
+ // newlines they break up blank-line runs, and stripping them afterward would
201
+ // leave long orphaned newline runs that nothing re-collapses.
202
+ out = sanitizeText(out);
199
203
  return collapseWhitespace(out);
200
204
  }
201
205
 
@@ -304,7 +308,7 @@ export function extractConcept(html, url) {
304
308
  title: sanitizeText(title).slice(0, 300),
305
309
  description: sanitizeText(firstSentence || "").slice(0, 300),
306
310
  resource,
307
- body: sanitizeText(body),
311
+ body, // already sanitized-then-collapsed inside htmlToMarkdown
308
312
  links: links.map((link) => ({ ...link, text: sanitizeText(link.text) })),
309
313
  };
310
314
  }