erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.74k stars 1.12k forks source link

Feature request: supporting Telegram syntax #690

Closed Lohoris closed 5 years ago

Lohoris commented 5 years ago

Telegram uses a slightly unusual Markdown syntax.

Like it or not, it would be very useful to be able to parse that, for anybody who need to work with it.

The main difference I've found, is that on Telegram the double underscore is parsed as italics, while here it's parsed as bold.

Is there any chance of such an option to happen?

Lohoris commented 5 years ago

Meanwhile I've created an hack which mimics this behaviour, in case anyone's interested.

Lohoris commented 5 years ago

I've just noticed that this is ever more convoluted than how it looked at first.

The web client wants a double symbol, i.e. **bold** and __italics__, while the bot interface wants a single symbol, i.e. *bold* and _italics_.

Since I need it for a bot, I've updated it this way on my personal branch. Unsure what we might want for this to end up in the official library…

aidantwoods commented 5 years ago

Probably this kind of behaviour is best done via an extension since double asterisk and double underscore both mean <strong> in the CommonMark spec (and so there's already expectation for what this should do).