tg-html
v0.0.1
Published
Telegram bot HTML bindings for JSX templates
Downloads
3
Readme
tg-html
JSX bindings, for use with Telegram bots.
See the Telegram Bot API documentation for the HTML formatting spec.
Setup
Configure your .tsconfig.json
with the following properties:
{
"compilerOptions": [
"jsx": "react",
"jsxFactory": "tgHtml.createElement",
"jsxFragmentFactory": "tgHtml.createFragment"
]
}
Then, write JSX components like this:
import * as tgHtml from 'tg-html';
export function Greeting({
username,
}: Readonly<{
username: string;
}>): JSX.Element {
return (
<>
<b><i>My Telegram Bot</i></b>\n
\n
Welcome, {username}!
</>
);
}
Thanks
- @nicojs, for inspiration! https://github.com/nicojs/typed-html