EdJoPaTo / grammy-inline-menu

Inline Menus for Telegram made simple. Successor of telegraf-inline-menu.
MIT License
357 stars 44 forks source link

Formatted text (html/markdown) in menu's message #61

Closed mirismaili closed 4 years ago

mirismaili commented 4 years ago

Possibility to use a formatted text as menu's main message. For example:

new TelegrafInlineMenu('*bold text*', {extra: Extra.markdown(),})

or:

new TelegrafInlineMenu('<a href="https://example.com">link</a>', {
    extra: Extra.html(), 
    photo: '...',
})

Thank good library

mirismaili commented 4 years ago

It seems markdown formatting is enabled by default. So I change the requested feature to be able to customize it (html, markdown, plain, etc). And to well-documenting it. Current documentation says:

const menu = new TelegrafInlineMenu(text, {photo})

Creates a new Menu. ... text is the text in the message itself. This can be a string or function(ctx) ...

EdJoPaTo commented 4 years ago

With the current version 4 of the library the text is always assumed to be Markdown.

I am currently working on an overhaul (see #32). It will introduce breaking changes and it will also address this issue: Ability to select your own parse_mode.

maslopop commented 4 years ago

Hi, using markdown I can insert an image in the text of the select and button menu ?

Like this ...

 [Text](link image)

Massimo

EdJoPaTo commented 4 years ago

images can not be included via the formatting options available currently. Links to images are possible.

But I think that is unrelated to the issue of not having support for the different parse_modes in this library.

EdJoPaTo commented 4 years ago

Take a look at Can I use HTML / MarkdownV2 in the message body? for the upcoming version 5.

Thanks for bringing this up!