@mtcute/markdown-parser 0.18.0-rc.5 → 0.18.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/index.d.cts +47 -0
- package/markdown-parser.test.d.cts +1 -0
- package/package.json +9 -9
package/index.d.cts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { InputText, MessageEntity, TextWithEntities } from '@mtcute/core';
|
|
2
|
+
import { default as Long } from 'long';
|
|
3
|
+
/**
|
|
4
|
+
* Escape a string to be safely used in Markdown.
|
|
5
|
+
*
|
|
6
|
+
* > **Note**: this function is in most cases not needed, as `md` function
|
|
7
|
+
* > handles all `string`s passed to it automatically as plain text.
|
|
8
|
+
*/
|
|
9
|
+
declare function escape(str: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Add Markdown formatting to the text given the plain text and entities contained in it.
|
|
12
|
+
*/
|
|
13
|
+
declare function unparse(input: InputText): string;
|
|
14
|
+
export declare const md: {
|
|
15
|
+
/**
|
|
16
|
+
* Tagged template based Markdown-to-entities parser function
|
|
17
|
+
*
|
|
18
|
+
* Additionally, `md` function has two static methods:
|
|
19
|
+
* - `md.escape` - escape a string to be safely used in Markdown
|
|
20
|
+
* (should not be needed in most cases, as `md` function itself handles all `string`s
|
|
21
|
+
* passed to it automatically as plain text)
|
|
22
|
+
* - `md.unparse` - add Markdown formatting to the text given the plain text and entities contained in it
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const text = md`**${user.displayName}**`
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
(strings: TemplateStringsArray, ...sub: (InputText | MessageEntity | Long | boolean | number | undefined | null)[]): TextWithEntities;
|
|
30
|
+
/**
|
|
31
|
+
* A variant taking a plain JS string as input
|
|
32
|
+
* and parsing it.
|
|
33
|
+
*
|
|
34
|
+
* Useful for cases when you already have a string
|
|
35
|
+
* (e.g. from some server) and want to parse it.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const string = '**hello**'
|
|
40
|
+
* const text = md(string)
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
(string: string): TextWithEntities;
|
|
44
|
+
escape: typeof escape;
|
|
45
|
+
unparse: typeof unparse;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/markdown-parser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.0
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"description": "Markdown entities parser for mtcute",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://mtcute.dev",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/mtcute/mtcute.git"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {},
|
|
13
7
|
"dependencies": {
|
|
14
|
-
"@mtcute/core": "0.18.0
|
|
8
|
+
"@mtcute/core": "^0.18.0",
|
|
15
9
|
"long": "5.2.3"
|
|
16
10
|
},
|
|
17
11
|
"exports": {
|
|
@@ -27,5 +21,11 @@
|
|
|
27
21
|
}
|
|
28
22
|
},
|
|
29
23
|
"author": "alina sireneva <alina@tei.su>",
|
|
30
|
-
"sideEffects": false
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"homepage": "https://mtcute.dev",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/mtcute/mtcute.git"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {}
|
|
31
31
|
}
|