@promptbook/markdown-utils 0.74.0-7 → 0.74.0-8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/markdown-utils",
3
- "version": "0.74.0-7",
3
+ "version": "0.74.0-8",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-6';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-7';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  */
@@ -4283,10 +4283,12 @@
4283
4283
  * @public exported from `@promptbook/utils`
4284
4284
  */
4285
4285
  function countPages(text) {
4286
- var sentencesPerPage = 5; // Assuming each page has 5 sentences
4287
- var sentences = text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
4288
- var pageCount = Math.ceil(sentences.length / sentencesPerPage);
4289
- return pageCount;
4286
+ if (text === '') {
4287
+ return 0;
4288
+ }
4289
+ var pagesByLinesCount = Math.ceil(countLines(text) / 44);
4290
+ var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
4291
+ return Math.max(pagesByLinesCount, pagesByCharactersCount);
4290
4292
  }
4291
4293
 
4292
4294
  /**