{"_id":"@artem_molchanov/md-lib","_rev":"5-0bc8c9ecaeebba1dbef1b04a7dae8b4a","name":"@artem_molchanov/md-lib","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.2":{"name":"@artem_molchanov/md-lib","version":"1.0.2","keywords":["markdown","telegram","entities","gfm","split"],"author":"","license":"ISC","_id":"@artem_molchanov/md-lib@1.0.2","maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"dist":{"shasum":"43613e887ac20ef397f681dd49cda6246b04312a","tarball":"https://registry.npmjs.org/@artem_molchanov/md-lib/-/md-lib-1.0.2.tgz","fileCount":5,"integrity":"sha512-Y/nISTOEza3oI2qdpIUUlLfee4RkPc2JzMnx8EqXgYvTZcTE8KREJT3V1epaGSSYU1mMnFZm0G1DjhDvhnKyAQ==","signatures":[{"sig":"MEUCID7bB6nfEyncuKcbmvFnGmbv/kIxMVzk9cTJ88wCmkViAiEAnl3vuuC6V2SEgXrEvwWpzJxG64fAO2tRX9456/qQdGI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17868},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"},"_npmVersion":"10.9.2","description":"Convert Markdown to Telegram messages with entities and safe splitting.","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"mdast-util-gfm":"^3.0.0","micromark-extension-gfm":"^3.0.0","mdast-util-from-markdown":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/md-lib_1.0.2_1757331399803_0.2212887845040401","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@artem_molchanov/md-lib","version":"1.0.3","keywords":["markdown","telegram","entities","gfm","split"],"author":"","license":"ISC","_id":"@artem_molchanov/md-lib@1.0.3","maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"dist":{"shasum":"60c3b04f02253549feec59af02a60f3b8cdc91aa","tarball":"https://registry.npmjs.org/@artem_molchanov/md-lib/-/md-lib-1.0.3.tgz","fileCount":5,"integrity":"sha512-6NuFB78j/JIwWp2lhCYLMny/OJHBVz/kJ+90dbSiFgKigtahvywV8FCschB0wkRq1cpVooRG8koRMezzmgPt3w==","signatures":[{"sig":"MEQCIFv7t1oriUdryZ5NwkJ4iXtF3l5GS4zn02u6KWMtYxytAiBFyU1A38wu3PKKF7ZQUnLEc+3Xk6yar0mQ6lt1itR+TA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26520},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"},"_npmVersion":"10.9.2","description":"Convert Markdown to Telegram messages with entities and safe splitting.","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"mdast-util-gfm":"^3.0.0","micromark-extension-gfm":"^3.0.0","mdast-util-from-markdown":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/md-lib_1.0.3_1757337957292_0.39275018665874883","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@artem_molchanov/md-lib","version":"1.0.4","keywords":["markdown","telegram","entities","gfm","split"],"author":"","license":"ISC","_id":"@artem_molchanov/md-lib@1.0.4","maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"dist":{"shasum":"0d3008e7fc7b5f03f0bc1a543b10003f8fecb446","tarball":"https://registry.npmjs.org/@artem_molchanov/md-lib/-/md-lib-1.0.4.tgz","fileCount":5,"integrity":"sha512-YqTFHs13K4g+lFpesktMwkt86QmFp2Eqzs0sO+jwnBfhBj6MmTArFu2IDcDNo+UBeJnLqdO465DPO5nPpA9qaA==","signatures":[{"sig":"MEUCIC9CROwYoP1ThjeN8edqFgk/lCGk/OjzU9sGdKDmy6GCAiEAmd9ovUIn7DB+39rUsLUFTbFLmX+FJtrvYccznjbRIAw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26538},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"},"_npmVersion":"10.9.2","description":"Convert Markdown to Telegram messages with entities and safe splitting.","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"mdast-util-gfm":"^3.0.0","micromark-extension-gfm":"^3.0.0","mdast-util-from-markdown":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/md-lib_1.0.4_1757392684757_0.854651685834944","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@artem_molchanov/md-lib","version":"1.0.5","keywords":["markdown","telegram","entities","gfm","split"],"author":"","license":"ISC","_id":"@artem_molchanov/md-lib@1.0.5","maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"dist":{"shasum":"f897b87f4235737a0b6cf2adb20edeb769b6abcb","tarball":"https://registry.npmjs.org/@artem_molchanov/md-lib/-/md-lib-1.0.5.tgz","fileCount":5,"integrity":"sha512-GEc1VaL/u5vqoFVaTAZq4B1ME5wXKqIHPUoCuQja5g89iAiy+4q/7AdmLT0hZGajlVX/QGXpohRfEG01pmQAkg==","signatures":[{"sig":"MEUCIAz+5ZPEd40/deBxmMrcUuLTZlJUu+GuxeCroG7YJnapAiEAlQoNmGAdMktlNdKafLIFMrJPX1Pdhc49tL/DqxpcttY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26526},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"},"_npmVersion":"10.9.2","description":"Convert Markdown to Telegram messages with entities and safe splitting.","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"mdast-util-gfm":"^3.0.0","micromark-extension-gfm":"^3.0.0","mdast-util-from-markdown":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/md-lib_1.0.5_1757393355217_0.12236903968692747","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@artem_molchanov/md-lib","version":"1.0.6","description":"Convert Markdown to Telegram messages with entities and safe splitting.","license":"ISC","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js","types":"./dist/index.d.ts"}},"sideEffects":false,"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["markdown","telegram","entities","gfm","split"],"author":"","dependencies":{"mdast-util-from-markdown":"^2.0.0","mdast-util-gfm":"^3.0.0","micromark-extension-gfm":"^3.0.0"},"_id":"@artem_molchanov/md-lib@1.0.6","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-emTtXtSOAV677mZO7mRXkz66DzNgDTlIe1CxlnPT1T0m2X7JuciO5CMIPYVBzV+Q/eyZlBRirqQKK6VBceFvXQ==","shasum":"06715d2483ca8a2c961f28cc3bff9fab0a70783a","tarball":"https://registry.npmjs.org/@artem_molchanov/md-lib/-/md-lib-1.0.6.tgz","fileCount":5,"unpackedSize":26986,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEwcenp896hwXssuhdAVZ2F0zDVN7HirwrF8ZbOQq5cgAiEAjrDbf5i+sVEZRvp+Zg9Bh2QXqb6atuNcITuN4LYQSsE="}]},"_npmUser":{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"},"directories":{},"maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/md-lib_1.0.6_1757394922700_0.12337798943434986"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-08T11:36:39.688Z","modified":"2025-09-09T05:15:23.047Z","1.0.2":"2025-09-08T11:36:40.067Z","1.0.3":"2025-09-08T13:25:57.480Z","1.0.4":"2025-09-09T04:38:04.952Z","1.0.5":"2025-09-09T04:49:15.402Z","1.0.6":"2025-09-09T05:15:22.888Z"},"license":"ISC","keywords":["markdown","telegram","entities","gfm","split"],"description":"Convert Markdown to Telegram messages with entities and safe splitting.","maintainers":[{"name":"artem_molchanov","email":"molchanov.artem.1994@gmail.com"}],"readme":"# md-lib\n\nConvert Markdown to Telegram messages with native entities. Safely parses GFM, splits by sentences/words under Telegram 4096 char limit, and tolerates invalid Markdown.\n\n## Install\n\n```bash\nnpm i @artem_molchanov/md-lib\n```\n\n## Usage\n\n```ts\nimport { convertMarkdownToTelegram, splitTelegramMessage, markdownToTelegramMessages } from \"@artem_molchanov/md-lib\";\n\nconst md = \"**Привет**, мир! Ссылка: [GitHub](https://github.com).\";\n\n// 1) Convert once\nconst message = convertMarkdownToTelegram(md);\n// { text: string, entities: TelegramEntity[] }\n\n// 2) Split for Telegram limits (4096 by default)\nconst chunks = splitTelegramMessage(message, { maxLength: 4096 });\n\n// 3) One-shot helper\nconst messages = markdownToTelegramMessages(md, { maxLength: 4096 });\n```\n\n## Behavior\n- Parses GFM via mdast; supports bold, italic, strikethrough, inline code, code blocks (pre with optional language), blockquote, links.\n- Splits by sentences; if a sentence exceeds limit, further splits by words while preserving entities.\n- Invalid Markdown is treated as plain text (e.g., `*привет**` becomes literal text).\n\n## API\n- `convertMarkdownToTelegram(markdown: string): TelegramMessage`\n- `splitTelegramMessage(message: TelegramMessage, options?: { maxLength?: number }): TelegramMessage[]`\n- `markdownToTelegramMessages(markdown: string, options?: { maxLength?: number }): TelegramMessage[]`\n\nTypes are included via `dist/index.d.ts`.\n\n## License\nISC\n\n\n","readmeFilename":"README.md"}