tellegram 1.1.4 → 1.1.6

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
@@ -4,7 +4,7 @@
4
4
  [![codecov](https://codecov.io/gh/leask/tellegram/branch/master/graph/badge.svg?token=LxCmgGNUHl)](https://codecov.io/gh/leask/tellegram)
5
5
  ![License](https://img.shields.io/github/license/leask/tellegram)
6
6
 
7
- teLLegraM is a library designed to format LLM (Large Language Model) generated text into [Telegram-specific-markdown (MarkdownV2)](https://core.telegram.org/bots/api#formatting-options), based on [Unified](https://github.com/unifiedjs/unified) and [Remark](https://github.com/remarkjs/remark/). It ensures that complex markdown from AI responses is perfectly interpreted by Telegram clients.
7
+ teLLegraM is a library designed to format LLM (Large Language Model) generated text into [Telegram-specific-markdown (MarkdownV2)](https://core.telegram.org/bots/api#formatting-options), based on [Unified](https://github.com/unifiedjs/unified) and [Remark](https://github.com/remarkjs/remark/). It ensures that complex markdown from AI responses is perfectly interpreted by Telegram clients. teLLegraM also supports a syntax-aware and lossless Markdown pagination.
8
8
 
9
9
  ## Acknowledgements
10
10
 
@@ -29,9 +29,7 @@ npm install tellegram
29
29
  ### Basic Conversion
30
30
 
31
31
  ```js
32
- import tellegram from 'tellegram';
33
- // OR
34
- // import { convert } from 'tellegram';
32
+ import { convert } from 'tellegram';
35
33
 
36
34
  const markdown = `
37
35
  # Header
@@ -46,7 +44,7 @@ const markdown = `
46
44
  And simple text with + some - symbols.
47
45
  `;
48
46
 
49
- const result = tellegram(markdown);
47
+ const result = convert(markdown);
50
48
  console.log(result);
51
49
  /*
52
50
  *Header*
@@ -89,7 +87,7 @@ You can also add unsupported tags strategy as a second argument, which can be on
89
87
  - `keep` - ignore unsupported tags
90
88
 
91
89
  ```js
92
- const teLLegraM = require('teLLegraM');
90
+ import { convert } from 'tellegram';
93
91
  const markdown = `
94
92
  # Header
95
93
 
@@ -98,7 +96,7 @@ const markdown = `
98
96
  <div>Text in div</div>
99
97
  `;
100
98
 
101
- teLLegraM(markdown, 'escape');
99
+ convert(markdown, 'escape');
102
100
  /*
103
101
  *Header*
104
102
 
@@ -107,7 +105,7 @@ teLLegraM(markdown, 'escape');
107
105
  <div\>Text in div</div\>
108
106
  */
109
107
 
110
- teLLegraM(markdown, 'remove');
108
+ convert(markdown, 'remove');
111
109
  /*
112
110
  *Header*
113
111
  */
package/lib/paginate.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import assert from 'assert';
2
2
  import convert from './convert.mjs';
3
3
 
4
- const MESSAGE_LENGTH_LIMIT = parseInt(4096 * 0.93); // ~= 3800
4
+ const MESSAGE_LENGTH_LIMIT = parseInt(4096 * 0.9); // ~= 3680
5
5
  const clarify = str => str.toLowerCase().split(/[^a-zA-Z0-9]+/).filter(x => x);
6
6
  const lines = (arr, sep = '\n') => arr.join(sep);
7
7
  const extError = (err, status, opt = {}) => Object.assign(err, { status }, opt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tellegram",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Convert LLM-generated markdown into Telegram-specific markdown (MarkdownV2)",
5
5
  "type": "module",
6
6
  "main": "index.mjs",