ts-markdown-builder 0.1.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.
- package/README.md +30 -6
- package/dist/commonjs/block.js +8 -8
- package/dist/commonjs/block.js.map +1 -1
- package/dist/commonjs/html.js +7 -0
- package/dist/commonjs/html.js.map +1 -0
- package/dist/commonjs/index.js +23 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/inline.js.map +1 -1
- package/dist/commonjs/join-blocks.js +10 -0
- package/dist/commonjs/join-blocks.js.map +1 -0
- package/dist/commonjs/table.js +27 -0
- package/dist/commonjs/table.js.map +1 -0
- package/dist/esm/block.mjs +7 -7
- package/dist/esm/block.mjs.map +1 -1
- package/dist/esm/html.mjs +4 -0
- package/dist/esm/html.mjs.map +1 -0
- package/dist/esm/index.mjs +4 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/inline.mjs.map +1 -1
- package/dist/esm/join-blocks.mjs +7 -0
- package/dist/esm/join-blocks.mjs.map +1 -0
- package/dist/esm/table.mjs +24 -0
- package/dist/esm/table.mjs.map +1 -0
- package/dist/types/block.d.ts +60 -3
- package/dist/types/html.d.ts +15 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/inline.d.ts +44 -0
- package/dist/types/join-blocks.d.ts +7 -0
- package/dist/types/table.d.ts +4 -0
- package/package.json +2 -2
- package/dist/commonjs/types.js +0 -2
- package/dist/commonjs/types.js.map +0 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.mjs.map +0 -1
- package/dist/types/types.d.ts +0 -0
package/README.md
CHANGED
|
@@ -10,11 +10,10 @@ Elegant markdown builder with minimal bundle size.
|
|
|
10
10
|
|
|
11
11
|
## Goal
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
13
|
+
TypeScript markdown generation library:
|
|
14
|
+
- easy to read and write API
|
|
15
|
+
- build CommonMark & GFM compliant markdown
|
|
16
|
+
- minimal bundle size + tree-shakable
|
|
18
17
|
|
|
19
18
|
## Installation
|
|
20
19
|
|
|
@@ -27,7 +26,32 @@ npm install ts-markdown-builder
|
|
|
27
26
|
```js
|
|
28
27
|
import * as md from 'ts-markdown-builder';
|
|
29
28
|
|
|
30
|
-
const output = md.
|
|
29
|
+
const output = md.joinBlocks([
|
|
30
|
+
md.heading('Welcome to TS Markdown Builder'),
|
|
31
|
+
"It's an easy to use modern markdown generator.",
|
|
32
|
+
'It supports:',
|
|
33
|
+
md.list([
|
|
34
|
+
`${md.bold('bold')} and ${md.italic('italic')}`,
|
|
35
|
+
`${md.code('code')} spans and code blocks`,
|
|
36
|
+
'unordered and ordered lists',
|
|
37
|
+
'blockquotes',
|
|
38
|
+
'and more!',
|
|
39
|
+
]),
|
|
40
|
+
]);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
# Welcome to TS Markdown Builder
|
|
45
|
+
|
|
46
|
+
It's an easy to use modern markdown generator.
|
|
47
|
+
|
|
48
|
+
It supports:
|
|
49
|
+
|
|
50
|
+
- **bold** and *italic*
|
|
51
|
+
- \`code\` spans and code blocks
|
|
52
|
+
- unordered and ordered lists
|
|
53
|
+
- blockquotes
|
|
54
|
+
- and more!
|
|
31
55
|
```
|
|
32
56
|
|
|
33
57
|
## Contributing
|
package/dist/commonjs/block.js
CHANGED
|
@@ -4,23 +4,23 @@ exports.blockquote = blockquote;
|
|
|
4
4
|
exports.codeBlock = codeBlock;
|
|
5
5
|
exports.heading = heading;
|
|
6
6
|
exports.horizontalRule = void 0;
|
|
7
|
+
exports.list = list;
|
|
7
8
|
exports.orderedList = orderedList;
|
|
8
|
-
exports.unorderedList = unorderedList;
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
10
|
const horizontalRule = exports.horizontalRule = '\n---\n';
|
|
11
11
|
function heading(text, level = 1) {
|
|
12
12
|
return `${'#'.repeat(level)} ${text}`;
|
|
13
13
|
}
|
|
14
|
-
function blockquote(
|
|
15
|
-
return (0, _utils.prefixLines)(
|
|
14
|
+
function blockquote(content) {
|
|
15
|
+
return (0, _utils.prefixLines)(content, '> ');
|
|
16
16
|
}
|
|
17
|
-
function codeBlock(
|
|
18
|
-
return `\`\`\`\n${
|
|
17
|
+
function codeBlock(content) {
|
|
18
|
+
return `\`\`\`\n${content}\n\`\`\``;
|
|
19
|
+
}
|
|
20
|
+
function list(items) {
|
|
21
|
+
return items.map(item => `- ${item}`).join('\n');
|
|
19
22
|
}
|
|
20
23
|
function orderedList(items) {
|
|
21
24
|
return items.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
|
22
25
|
}
|
|
23
|
-
function unorderedList(items) {
|
|
24
|
-
return items.map(item => `- ${item}`).join('\n');
|
|
25
|
-
}
|
|
26
26
|
//# sourceMappingURL=block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","names":["horizontalRule","exports","heading","text","level","repeat","blockquote","prefixLines","codeBlock","
|
|
1
|
+
{"version":3,"file":"block.js","names":["horizontalRule","exports","heading","text","level","repeat","blockquote","content","prefixLines","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '\\n---\\n';\n\n/**\n * Create a heading block.\n * Markdown: `# Heading`\n *\n * @param text - The text of the heading.\n * @param level - The level of the heading (defaults to 1).\n */\nexport function heading(text: string, level: number = 1): string {\n return `${'#'.repeat(level)} ${text}`;\n}\n\n/**\n * Create a blockquote block.\n *\n * Markdown:\n * ```\n * > Content\n * > Content\n * ```\n *\n * @param text - The content of the blockquote.\n */\nexport function blockquote(content: string): string {\n return prefixLines(content, '> ');\n}\n\n/**\n * Create a code block.\n *\n * Markdown:\n * ````\n * ```\n * Content\n * ```\n * ````\n *\n * @param content - The content of the code block.\n */\nexport function codeBlock(content: string): string {\n return `\\`\\`\\`\\n${content}\\n\\`\\`\\``;\n}\n\n/**\n * Create an unordered list block.\n *\n * Markdown:\n * ```\n * - Item\n * - Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function list(items: string[]): string {\n return items.map((item) => `- ${item}`).join('\\n');\n}\n\n/**\n * Create an ordered list block.\n *\n * Markdown:\n * ```\n * 1. Item\n * 2. Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function orderedList(items: string[]): string {\n return items.map((item, index) => `${index + 1}. ${item}`).join('\\n');\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAS;AAShC,SAASE,OAAOA,CAACC,IAAY,EAAEC,KAAa,GAAG,CAAC,EAAU;EAC/D,OAAO,GAAG,GAAG,CAACC,MAAM,CAACD,KAAK,CAAC,IAAID,IAAI,EAAE;AACvC;AAaO,SAASG,UAAUA,CAACC,OAAe,EAAU;EAClD,OAAO,IAAAC,kBAAW,EAACD,OAAO,EAAE,IAAI,CAAC;AACnC;AAcO,SAASE,SAASA,CAACF,OAAe,EAAU;EACjD,OAAO,WAAWA,OAAO,UAAU;AACrC;AAaO,SAASG,IAAIA,CAACC,KAAe,EAAU;EAC5C,OAAOA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAK,KAAKA,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACpD;AAaO,SAASC,WAAWA,CAACJ,KAAe,EAAU;EACnD,OAAOA,KAAK,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEG,KAAK,KAAK,GAAGA,KAAK,GAAG,CAAC,KAAKH,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACvE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","names":["disclosure","title","content"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n */\nexport function disclosure(title: string, content: string): string {\n return `<details>\\n<summary>${title}</summary>\\n${content}\\n</details>`;\n}\n"],"mappings":";;;AAcO,SAASA,UAAUA,CAACC,KAAa,EAAEC,OAAe,EAAU;EACjE,OAAO,uBAAuBD,KAAK,eAAeC,OAAO,cAAc;AACzE","ignoreList":[]}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -24,6 +24,12 @@ Object.defineProperty(exports, "codeBlock", {
|
|
|
24
24
|
return _block.codeBlock;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
Object.defineProperty(exports, "disclosure", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _html.disclosure;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
27
33
|
Object.defineProperty(exports, "heading", {
|
|
28
34
|
enumerable: true,
|
|
29
35
|
get: function () {
|
|
@@ -48,6 +54,12 @@ Object.defineProperty(exports, "italic", {
|
|
|
48
54
|
return _inline.italic;
|
|
49
55
|
}
|
|
50
56
|
});
|
|
57
|
+
Object.defineProperty(exports, "joinBlocks", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () {
|
|
60
|
+
return _joinBlocks.joinBlocks;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
51
63
|
Object.defineProperty(exports, "lineBreak", {
|
|
52
64
|
enumerable: true,
|
|
53
65
|
get: function () {
|
|
@@ -60,18 +72,27 @@ Object.defineProperty(exports, "link", {
|
|
|
60
72
|
return _inline.link;
|
|
61
73
|
}
|
|
62
74
|
});
|
|
75
|
+
Object.defineProperty(exports, "list", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return _block.list;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
63
81
|
Object.defineProperty(exports, "orderedList", {
|
|
64
82
|
enumerable: true,
|
|
65
83
|
get: function () {
|
|
66
84
|
return _block.orderedList;
|
|
67
85
|
}
|
|
68
86
|
});
|
|
69
|
-
Object.defineProperty(exports, "
|
|
87
|
+
Object.defineProperty(exports, "table", {
|
|
70
88
|
enumerable: true,
|
|
71
89
|
get: function () {
|
|
72
|
-
return
|
|
90
|
+
return _table.table;
|
|
73
91
|
}
|
|
74
92
|
});
|
|
93
|
+
var _joinBlocks = require("./join-blocks.js");
|
|
75
94
|
var _block = require("./block.js");
|
|
76
95
|
var _inline = require("./inline.js");
|
|
96
|
+
var _table = require("./table.js");
|
|
97
|
+
var _html = require("./html.js");
|
|
77
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export { joinBlocks } from './join-blocks';\nexport { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';\nexport { lineBreak, code, italic, bold, link, image } from './inline';\nexport { table } from './table';\nexport { disclosure } from './html';\n\nexport type { TableOptions } from './table';\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","names":["lineBreak","exports","italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"inline.js","names":["lineBreak","exports","italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["/**\n * Create a line break.\n *\n * Markdown: `__\\n`\n */\nexport const lineBreak = ' \\n';\n\n/**\n * Create an italic text.\n *\n * Markdown: `*text*`\n *\n * @param text - The text to be italicized.\n */\nexport function italic(text: string): string {\n return `*${text}*`;\n}\n\n/**\n * Create a bold text.\n *\n * Markdown: `**text**`\n *\n * @param text - The text to be bolded.\n */\nexport function bold(text: string): string {\n return `**${text}**`;\n}\n\n/**\n * Create a code text.\n *\n * Markdown: `\\`text\\``\n *\n * @param text - The text to be marked as code.\n */\nexport function code(text: string): string {\n return `\\`${text}\\``;\n}\n\n/**\n * Create a link or autolink span.\n *\n * Markdown:\n * - `[text](url)` link when `text` is provided\n * - `<url>` autolink when `text` is not provided\n *\n * @param url - The URL to be linked.\n * @param text - The title for the link (optional).\n */\nexport function link(url: string, text?: string): string {\n return text ? `[${text}](${url})` : `<${url}>`;\n}\n\n/**\n * Create an image text.\n *\n * Markdown: ``\n *\n * @param url - The URL of the image.\n * @param text - The description for the image (optional).\n */\nexport function image(url: string, text?: string): string {\n return ``;\n}\n"],"mappings":";;;;;;;;AAKO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,MAAM;AASxB,SAASE,MAAMA,CAACC,IAAY,EAAU;EAC3C,OAAO,IAAIA,IAAI,GAAG;AACpB;AASO,SAASC,IAAIA,CAACD,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AASO,SAASE,IAAIA,CAACF,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AAYO,SAASG,IAAIA,CAACC,GAAW,EAAEJ,IAAa,EAAU;EACvD,OAAOA,IAAI,GAAG,IAAIA,IAAI,KAAKI,GAAG,GAAG,GAAG,IAAIA,GAAG,GAAG;AAChD;AAUO,SAASC,KAAKA,CAACD,GAAW,EAAEJ,IAAa,EAAU;EACxD,OAAO,KAAKA,IAAI,IAAI,EAAE,KAAKI,GAAG,GAAG;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-blocks.js","names":["joinBlocks","blocks","map","trimBlock","join","block","replace"],"sources":["../../src/join-blocks.ts"],"sourcesContent":["/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: string[]): string {\n return blocks.map(trimBlock).join('\\n\\n');\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":";;;AAMO,SAASA,UAAUA,CAACC,MAAgB,EAAU;EACnD,OAAOA,MAAM,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3C;AAEA,SAASD,SAASA,CAACE,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.table = table;
|
|
4
|
+
function table(header, rows, options) {
|
|
5
|
+
if (header.length === 0) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
header = header.map(escapeCellContent);
|
|
9
|
+
rows = rows.map(row => row.map(escapeCellContent));
|
|
10
|
+
const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);
|
|
11
|
+
const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));
|
|
12
|
+
return [renderRow(header, widths), renderRow(separators, widths), ...rows.map(row => renderRow(row, widths))].join('\n');
|
|
13
|
+
}
|
|
14
|
+
function getColumnsWidth(header, rows) {
|
|
15
|
+
return header.map((_, index) => getColumnWidth(header, rows, index));
|
|
16
|
+
}
|
|
17
|
+
function getColumnWidth(header, rows, index) {
|
|
18
|
+
return Math.max(header[index]?.length ?? 0, ...rows.map(row => row[index]?.length ?? 0));
|
|
19
|
+
}
|
|
20
|
+
function renderRow(row, widths) {
|
|
21
|
+
const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));
|
|
22
|
+
return `| ${paddedCells.join(' | ')} |`;
|
|
23
|
+
}
|
|
24
|
+
function escapeCellContent(cell) {
|
|
25
|
+
return cell.replace(/\|/g, '\\|').replace(/\n/g, '<br/>');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(header: string[], rows: string[][], options?: TableOptions): string {\n if (header.length === 0) {\n return '';\n }\n\n // Escape the header and rows content\n header = header.map(escapeCellContent);\n rows = rows.map((row) => row.map(escapeCellContent));\n\n const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);\n const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));\n\n return [\n renderRow(header, widths),\n renderRow(separators, widths),\n ...rows.map((row) => renderRow(row, widths)),\n ].join('\\n');\n}\n\nfunction getColumnsWidth(header: string[], rows: string[][]): number[] {\n return header.map((_, index) => getColumnWidth(header, rows, index));\n}\n\nfunction getColumnWidth(header: string[], rows: string[][], index: number): number {\n return Math.max(header[index]?.length ?? 0, ...rows.map((row) => row[index]?.length ?? 0));\n}\n\nfunction renderRow(row: string[], widths: number[]): string {\n const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));\n return `| ${paddedCells.join(' | ')} |`;\n}\n\nfunction escapeCellContent(cell: string): string {\n return cell.replace(/\\|/g, '\\\\|').replace(/\\n/g, '<br/>');\n}\n"],"mappings":";;;AAIO,SAASA,KAAKA,CAACC,MAAgB,EAAEC,IAAgB,EAAEC,OAAsB,EAAU;EACxF,IAAIF,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;EACX;EAGAH,MAAM,GAAGA,MAAM,CAACI,GAAG,CAACC,iBAAiB,CAAC;EACtCJ,IAAI,GAAGA,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACF,GAAG,CAACC,iBAAiB,CAAC,CAAC;EAEpD,MAAME,MAAM,GAAG,CAACL,OAAO,EAAEM,OAAO,GAAGC,eAAe,CAACT,MAAM,EAAEC,IAAI,CAAC,GAAGD,MAAM,CAACI,GAAG,CAAC,MAAM,CAAC,CAAC;EACtF,MAAMM,UAAU,GAAGV,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEC,CAAC,KAAK,GAAG,CAACC,MAAM,CAACN,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EAEnE,OAAO,CACLE,SAAS,CAACd,MAAM,EAAEO,MAAM,CAAC,EACzBO,SAAS,CAACJ,UAAU,EAAEH,MAAM,CAAC,EAC7B,GAAGN,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKQ,SAAS,CAACR,GAAG,EAAEC,MAAM,CAAC,CAAC,CAC7C,CAACQ,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASN,eAAeA,CAACT,MAAgB,EAAEC,IAAgB,EAAY;EACrE,OAAOD,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEK,KAAK,KAAKC,cAAc,CAACjB,MAAM,EAAEC,IAAI,EAAEe,KAAK,CAAC,CAAC;AACtE;AAEA,SAASC,cAAcA,CAACjB,MAAgB,EAAEC,IAAgB,EAAEe,KAAa,EAAU;EACjF,OAAOE,IAAI,CAACC,GAAG,CAACnB,MAAM,CAACgB,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,EAAE,GAAGF,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACU,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,CAAC,CAAC;AAC5F;AAEA,SAASW,SAASA,CAACR,GAAa,EAAEC,MAAgB,EAAU;EAC1D,MAAMa,WAAW,GAAGd,GAAG,CAACF,GAAG,CAAC,CAACiB,IAAI,EAAEL,KAAK,KAAKK,IAAI,CAACC,MAAM,CAACf,MAAM,CAACS,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;EAC7E,OAAO,KAAKI,WAAW,CAACL,IAAI,CAAC,KAAK,CAAC,IAAI;AACzC;AAEA,SAASV,iBAAiBA,CAACgB,IAAY,EAAU;EAC/C,OAAOA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAC3D","ignoreList":[]}
|
package/dist/esm/block.mjs
CHANGED
|
@@ -3,16 +3,16 @@ export const horizontalRule = '\n---\n';
|
|
|
3
3
|
export function heading(text, level = 1) {
|
|
4
4
|
return `${'#'.repeat(level)} ${text}`;
|
|
5
5
|
}
|
|
6
|
-
export function blockquote(
|
|
7
|
-
return prefixLines(
|
|
6
|
+
export function blockquote(content) {
|
|
7
|
+
return prefixLines(content, '> ');
|
|
8
8
|
}
|
|
9
|
-
export function codeBlock(
|
|
10
|
-
return `\`\`\`\n${
|
|
9
|
+
export function codeBlock(content) {
|
|
10
|
+
return `\`\`\`\n${content}\n\`\`\``;
|
|
11
|
+
}
|
|
12
|
+
export function list(items) {
|
|
13
|
+
return items.map(item => `- ${item}`).join('\n');
|
|
11
14
|
}
|
|
12
15
|
export function orderedList(items) {
|
|
13
16
|
return items.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
|
14
17
|
}
|
|
15
|
-
export function unorderedList(items) {
|
|
16
|
-
return items.map(item => `- ${item}`).join('\n');
|
|
17
|
-
}
|
|
18
18
|
//# sourceMappingURL=block.mjs.map
|
package/dist/esm/block.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.mjs","names":["prefixLines","horizontalRule","heading","text","level","repeat","blockquote","codeBlock","
|
|
1
|
+
{"version":3,"file":"block.mjs","names":["prefixLines","horizontalRule","heading","text","level","repeat","blockquote","content","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '\\n---\\n';\n\n/**\n * Create a heading block.\n * Markdown: `# Heading`\n *\n * @param text - The text of the heading.\n * @param level - The level of the heading (defaults to 1).\n */\nexport function heading(text: string, level: number = 1): string {\n return `${'#'.repeat(level)} ${text}`;\n}\n\n/**\n * Create a blockquote block.\n *\n * Markdown:\n * ```\n * > Content\n * > Content\n * ```\n *\n * @param text - The content of the blockquote.\n */\nexport function blockquote(content: string): string {\n return prefixLines(content, '> ');\n}\n\n/**\n * Create a code block.\n *\n * Markdown:\n * ````\n * ```\n * Content\n * ```\n * ````\n *\n * @param content - The content of the code block.\n */\nexport function codeBlock(content: string): string {\n return `\\`\\`\\`\\n${content}\\n\\`\\`\\``;\n}\n\n/**\n * Create an unordered list block.\n *\n * Markdown:\n * ```\n * - Item\n * - Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function list(items: string[]): string {\n return items.map((item) => `- ${item}`).join('\\n');\n}\n\n/**\n * Create an ordered list block.\n *\n * Markdown:\n * ```\n * 1. Item\n * 2. Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function orderedList(items: string[]): string {\n return items.map((item, index) => `${index + 1}. ${item}`).join('\\n');\n}\n"],"mappings":"SAASA,WAAW;AAOpB,OAAO,MAAMC,cAAc,GAAG,SAAS;AASvC,OAAO,SAASC,OAAOA,CAACC,IAAY,EAAEC,KAAa,GAAG,CAAC,EAAU;EAC/D,OAAO,GAAG,GAAG,CAACC,MAAM,CAACD,KAAK,CAAC,IAAID,IAAI,EAAE;AACvC;AAaA,OAAO,SAASG,UAAUA,CAACC,OAAe,EAAU;EAClD,OAAOP,WAAW,CAACO,OAAO,EAAE,IAAI,CAAC;AACnC;AAcA,OAAO,SAASC,SAASA,CAACD,OAAe,EAAU;EACjD,OAAO,WAAWA,OAAO,UAAU;AACrC;AAaA,OAAO,SAASE,IAAIA,CAACC,KAAe,EAAU;EAC5C,OAAOA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAK,KAAKA,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACpD;AAaA,OAAO,SAASC,WAAWA,CAACJ,KAAe,EAAU;EACnD,OAAOA,KAAK,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEG,KAAK,KAAK,GAAGA,KAAK,GAAG,CAAC,KAAKH,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACvE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.mjs","names":["disclosure","title","content"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n */\nexport function disclosure(title: string, content: string): string {\n return `<details>\\n<summary>${title}</summary>\\n${content}\\n</details>`;\n}\n"],"mappings":"AAcA,OAAO,SAASA,UAAUA,CAACC,KAAa,EAAEC,OAAe,EAAU;EACjE,OAAO,uBAAuBD,KAAK,eAAeC,OAAO,cAAc;AACzE","ignoreList":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { joinBlocks } from "./join-blocks.mjs";
|
|
2
|
+
export { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from "./block.mjs";
|
|
2
3
|
export { lineBreak, code, italic, bold, link, image } from "./inline.mjs";
|
|
4
|
+
export { table } from "./table.mjs";
|
|
5
|
+
export { disclosure } from "./html.mjs";
|
|
3
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["horizontalRule","heading","blockquote","orderedList","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["joinBlocks","horizontalRule","heading","blockquote","orderedList","list","codeBlock","lineBreak","code","italic","bold","link","image","table","disclosure"],"sources":["../../src/index.ts"],"sourcesContent":["export { joinBlocks } from './join-blocks';\nexport { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';\nexport { lineBreak, code, italic, bold, link, image } from './inline';\nexport { table } from './table';\nexport { disclosure } from './html';\n\nexport type { TableOptions } from './table';\n"],"mappings":"SAASA,UAAU;AAAA,SACVC,cAAc,EAAEC,OAAO,EAAEC,UAAU,EAAEC,WAAW,EAAEC,IAAI,EAAEC,SAAS;AAAA,SACjEC,SAAS,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK;AAAA,SAC1CC,KAAK;AAAA,SACLC,UAAU","ignoreList":[]}
|
package/dist/esm/inline.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.mjs","names":["lineBreak","italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"inline.mjs","names":["lineBreak","italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["/**\n * Create a line break.\n *\n * Markdown: `__\\n`\n */\nexport const lineBreak = ' \\n';\n\n/**\n * Create an italic text.\n *\n * Markdown: `*text*`\n *\n * @param text - The text to be italicized.\n */\nexport function italic(text: string): string {\n return `*${text}*`;\n}\n\n/**\n * Create a bold text.\n *\n * Markdown: `**text**`\n *\n * @param text - The text to be bolded.\n */\nexport function bold(text: string): string {\n return `**${text}**`;\n}\n\n/**\n * Create a code text.\n *\n * Markdown: `\\`text\\``\n *\n * @param text - The text to be marked as code.\n */\nexport function code(text: string): string {\n return `\\`${text}\\``;\n}\n\n/**\n * Create a link or autolink span.\n *\n * Markdown:\n * - `[text](url)` link when `text` is provided\n * - `<url>` autolink when `text` is not provided\n *\n * @param url - The URL to be linked.\n * @param text - The title for the link (optional).\n */\nexport function link(url: string, text?: string): string {\n return text ? `[${text}](${url})` : `<${url}>`;\n}\n\n/**\n * Create an image text.\n *\n * Markdown: ``\n *\n * @param url - The URL of the image.\n * @param text - The description for the image (optional).\n */\nexport function image(url: string, text?: string): string {\n return ``;\n}\n"],"mappings":"AAKA,OAAO,MAAMA,SAAS,GAAG,MAAM;AAS/B,OAAO,SAASC,MAAMA,CAACC,IAAY,EAAU;EAC3C,OAAO,IAAIA,IAAI,GAAG;AACpB;AASA,OAAO,SAASC,IAAIA,CAACD,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AASA,OAAO,SAASE,IAAIA,CAACF,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AAYA,OAAO,SAASG,IAAIA,CAACC,GAAW,EAAEJ,IAAa,EAAU;EACvD,OAAOA,IAAI,GAAG,IAAIA,IAAI,KAAKI,GAAG,GAAG,GAAG,IAAIA,GAAG,GAAG;AAChD;AAUA,OAAO,SAASC,KAAKA,CAACD,GAAW,EAAEJ,IAAa,EAAU;EACxD,OAAO,KAAKA,IAAI,IAAI,EAAE,KAAKI,GAAG,GAAG;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-blocks.mjs","names":["joinBlocks","blocks","map","trimBlock","join","block","replace"],"sources":["../../src/join-blocks.ts"],"sourcesContent":["/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: string[]): string {\n return blocks.map(trimBlock).join('\\n\\n');\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":"AAMA,OAAO,SAASA,UAAUA,CAACC,MAAgB,EAAU;EACnD,OAAOA,MAAM,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3C;AAEA,SAASD,SAASA,CAACE,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function table(header, rows, options) {
|
|
2
|
+
if (header.length === 0) {
|
|
3
|
+
return '';
|
|
4
|
+
}
|
|
5
|
+
header = header.map(escapeCellContent);
|
|
6
|
+
rows = rows.map(row => row.map(escapeCellContent));
|
|
7
|
+
const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);
|
|
8
|
+
const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));
|
|
9
|
+
return [renderRow(header, widths), renderRow(separators, widths), ...rows.map(row => renderRow(row, widths))].join('\n');
|
|
10
|
+
}
|
|
11
|
+
function getColumnsWidth(header, rows) {
|
|
12
|
+
return header.map((_, index) => getColumnWidth(header, rows, index));
|
|
13
|
+
}
|
|
14
|
+
function getColumnWidth(header, rows, index) {
|
|
15
|
+
return Math.max(header[index]?.length ?? 0, ...rows.map(row => row[index]?.length ?? 0));
|
|
16
|
+
}
|
|
17
|
+
function renderRow(row, widths) {
|
|
18
|
+
const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));
|
|
19
|
+
return `| ${paddedCells.join(' | ')} |`;
|
|
20
|
+
}
|
|
21
|
+
function escapeCellContent(cell) {
|
|
22
|
+
return cell.replace(/\|/g, '\\|').replace(/\n/g, '<br/>');
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.mjs","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(header: string[], rows: string[][], options?: TableOptions): string {\n if (header.length === 0) {\n return '';\n }\n\n // Escape the header and rows content\n header = header.map(escapeCellContent);\n rows = rows.map((row) => row.map(escapeCellContent));\n\n const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);\n const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));\n\n return [\n renderRow(header, widths),\n renderRow(separators, widths),\n ...rows.map((row) => renderRow(row, widths)),\n ].join('\\n');\n}\n\nfunction getColumnsWidth(header: string[], rows: string[][]): number[] {\n return header.map((_, index) => getColumnWidth(header, rows, index));\n}\n\nfunction getColumnWidth(header: string[], rows: string[][], index: number): number {\n return Math.max(header[index]?.length ?? 0, ...rows.map((row) => row[index]?.length ?? 0));\n}\n\nfunction renderRow(row: string[], widths: number[]): string {\n const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));\n return `| ${paddedCells.join(' | ')} |`;\n}\n\nfunction escapeCellContent(cell: string): string {\n return cell.replace(/\\|/g, '\\\\|').replace(/\\n/g, '<br/>');\n}\n"],"mappings":"AAIA,OAAO,SAASA,KAAKA,CAACC,MAAgB,EAAEC,IAAgB,EAAEC,OAAsB,EAAU;EACxF,IAAIF,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;EACX;EAGAH,MAAM,GAAGA,MAAM,CAACI,GAAG,CAACC,iBAAiB,CAAC;EACtCJ,IAAI,GAAGA,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACF,GAAG,CAACC,iBAAiB,CAAC,CAAC;EAEpD,MAAME,MAAM,GAAG,CAACL,OAAO,EAAEM,OAAO,GAAGC,eAAe,CAACT,MAAM,EAAEC,IAAI,CAAC,GAAGD,MAAM,CAACI,GAAG,CAAC,MAAM,CAAC,CAAC;EACtF,MAAMM,UAAU,GAAGV,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEC,CAAC,KAAK,GAAG,CAACC,MAAM,CAACN,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EAEnE,OAAO,CACLE,SAAS,CAACd,MAAM,EAAEO,MAAM,CAAC,EACzBO,SAAS,CAACJ,UAAU,EAAEH,MAAM,CAAC,EAC7B,GAAGN,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKQ,SAAS,CAACR,GAAG,EAAEC,MAAM,CAAC,CAAC,CAC7C,CAACQ,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASN,eAAeA,CAACT,MAAgB,EAAEC,IAAgB,EAAY;EACrE,OAAOD,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEK,KAAK,KAAKC,cAAc,CAACjB,MAAM,EAAEC,IAAI,EAAEe,KAAK,CAAC,CAAC;AACtE;AAEA,SAASC,cAAcA,CAACjB,MAAgB,EAAEC,IAAgB,EAAEe,KAAa,EAAU;EACjF,OAAOE,IAAI,CAACC,GAAG,CAACnB,MAAM,CAACgB,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,EAAE,GAAGF,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACU,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,CAAC,CAAC;AAC5F;AAEA,SAASW,SAASA,CAACR,GAAa,EAAEC,MAAgB,EAAU;EAC1D,MAAMa,WAAW,GAAGd,GAAG,CAACF,GAAG,CAAC,CAACiB,IAAI,EAAEL,KAAK,KAAKK,IAAI,CAACC,MAAM,CAACf,MAAM,CAACS,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;EAC7E,OAAO,KAAKI,WAAW,CAACL,IAAI,CAAC,KAAK,CAAC,IAAI;AACzC;AAEA,SAASV,iBAAiBA,CAACgB,IAAY,EAAU;EAC/C,OAAOA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAC3D","ignoreList":[]}
|
package/dist/types/block.d.ts
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a horizontal rule block.
|
|
3
|
+
*
|
|
4
|
+
* Markdown: `---`
|
|
5
|
+
*/
|
|
1
6
|
export declare const horizontalRule = "\n---\n";
|
|
7
|
+
/**
|
|
8
|
+
* Create a heading block.
|
|
9
|
+
* Markdown: `# Heading`
|
|
10
|
+
*
|
|
11
|
+
* @param text - The text of the heading.
|
|
12
|
+
* @param level - The level of the heading (defaults to 1).
|
|
13
|
+
*/
|
|
2
14
|
export declare function heading(text: string, level?: number): string;
|
|
3
|
-
|
|
4
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Create a blockquote block.
|
|
17
|
+
*
|
|
18
|
+
* Markdown:
|
|
19
|
+
* ```
|
|
20
|
+
* > Content
|
|
21
|
+
* > Content
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param text - The content of the blockquote.
|
|
25
|
+
*/
|
|
26
|
+
export declare function blockquote(content: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Create a code block.
|
|
29
|
+
*
|
|
30
|
+
* Markdown:
|
|
31
|
+
* ````
|
|
32
|
+
* ```
|
|
33
|
+
* Content
|
|
34
|
+
* ```
|
|
35
|
+
* ````
|
|
36
|
+
*
|
|
37
|
+
* @param content - The content of the code block.
|
|
38
|
+
*/
|
|
39
|
+
export declare function codeBlock(content: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Create an unordered list block.
|
|
42
|
+
*
|
|
43
|
+
* Markdown:
|
|
44
|
+
* ```
|
|
45
|
+
* - Item
|
|
46
|
+
* - Item
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param items - The items of the list.
|
|
50
|
+
*/
|
|
51
|
+
export declare function list(items: string[]): string;
|
|
52
|
+
/**
|
|
53
|
+
* Create an ordered list block.
|
|
54
|
+
*
|
|
55
|
+
* Markdown:
|
|
56
|
+
* ```
|
|
57
|
+
* 1. Item
|
|
58
|
+
* 2. Item
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @param items - The items of the list.
|
|
62
|
+
*/
|
|
5
63
|
export declare function orderedList(items: string[]): string;
|
|
6
|
-
export declare function unorderedList(items: string[]): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a disclosure block.
|
|
3
|
+
*
|
|
4
|
+
* Markdown/Html:
|
|
5
|
+
* ```
|
|
6
|
+
* <details>
|
|
7
|
+
* <summary>Title</summary>
|
|
8
|
+
* Content
|
|
9
|
+
* </details>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param title - The title of the disclosure.
|
|
13
|
+
* @param content - The content of the disclosure.
|
|
14
|
+
*/
|
|
15
|
+
export declare function disclosure(title: string, content: string): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { joinBlocks } from './join-blocks';
|
|
2
|
+
export { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';
|
|
2
3
|
export { lineBreak, code, italic, bold, link, image } from './inline';
|
|
4
|
+
export { table } from './table';
|
|
5
|
+
export { disclosure } from './html';
|
|
6
|
+
export type { TableOptions } from './table';
|
package/dist/types/inline.d.ts
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a line break.
|
|
3
|
+
*
|
|
4
|
+
* Markdown: `__\n`
|
|
5
|
+
*/
|
|
1
6
|
export declare const lineBreak = " \n";
|
|
7
|
+
/**
|
|
8
|
+
* Create an italic text.
|
|
9
|
+
*
|
|
10
|
+
* Markdown: `*text*`
|
|
11
|
+
*
|
|
12
|
+
* @param text - The text to be italicized.
|
|
13
|
+
*/
|
|
2
14
|
export declare function italic(text: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a bold text.
|
|
17
|
+
*
|
|
18
|
+
* Markdown: `**text**`
|
|
19
|
+
*
|
|
20
|
+
* @param text - The text to be bolded.
|
|
21
|
+
*/
|
|
3
22
|
export declare function bold(text: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create a code text.
|
|
25
|
+
*
|
|
26
|
+
* Markdown: `\`text\``
|
|
27
|
+
*
|
|
28
|
+
* @param text - The text to be marked as code.
|
|
29
|
+
*/
|
|
4
30
|
export declare function code(text: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Create a link or autolink span.
|
|
33
|
+
*
|
|
34
|
+
* Markdown:
|
|
35
|
+
* - `[text](url)` link when `text` is provided
|
|
36
|
+
* - `<url>` autolink when `text` is not provided
|
|
37
|
+
*
|
|
38
|
+
* @param url - The URL to be linked.
|
|
39
|
+
* @param text - The title for the link (optional).
|
|
40
|
+
*/
|
|
5
41
|
export declare function link(url: string, text?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Create an image text.
|
|
44
|
+
*
|
|
45
|
+
* Markdown: ``
|
|
46
|
+
*
|
|
47
|
+
* @param url - The URL of the image.
|
|
48
|
+
* @param text - The description for the image (optional).
|
|
49
|
+
*/
|
|
6
50
|
export declare function image(url: string, text?: string): string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-markdown-builder",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Elegant markdown builder with minimal bundle size.",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
7
|
-
"types": "dist/types/
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"files": [
|
package/dist/commonjs/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
package/dist/esm/types.mjs
DELETED
package/dist/esm/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
package/dist/types/types.d.ts
DELETED
|
File without changes
|