I'd like to have a built-in BBcode or - even better - a switch to use Markdown for formatting my postings.
If there already is a parser, it should be easy to just use it?
require_once(EXTDIR . '/markdown/markdown.php');
$message = Markdown($message);
You can use the hook integrate_pre_parsebbc so a function like:
function parse_markdown(&$message, &$smileys, &$cache_id, &$parse_tags)
{
require_once(EXTDIR . '/markdown/markdown.php');
$message = Markdown($message);
}
attached to that hook should do the trick.
Why markdown is better? I find it harder to use.
It's different.
I find it easier to do
bold or
underline rather than have to use square brackets and letters, for example. Also lists are usually easier.
Links and images... meh, both a bit difficult (I always forget what comes first in markdown).
Then bbcode is much more for formatting, while "
Markdown is a writing format (http://daringfireball.net/projects/markdown/syntax#html)", so two different things. ;)
Today we have:
MD to HTML = Markdown in the ext dir
BBC to HTML = our buddy parse_bbc
HTML to BBC = Html2BBC.class in subs
HTML to MD = Html2Md.class in subs
I had intended to write a BBC to MD or was that MD to BBC? now I can't remember which direction I wanted now LOL ...
Today to do those swaps you need to to BBC to HTML then HTML to MD or MD to HTML and HTML to BBC and each time you swap the language, indeed something is lost plus its 2x the overhead.
For a simple MD post to work, what emanuele said should work AFAIK, the issue of course is overhead, none of those functions are lite weight, and chaining them could be an issue. Providing a very lite weight MD to html (or really bbc) for basic bold, itailic, etc md text may be the best option.
Not on smartphone keyboards.