Skip to main content
Topic: Markdown (tag?) (Read 3755 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Markdown (tag?)

There's a couple topics on this already:

I don't think markdown would be easy to do and I can see it conflicting with posts that are already made and use the elements of markdown (eg ***something***). I'd propose a markdown tag. Then we'd only parse markdown inside that tag.

The only reason I'm even thinking about this right now is because people's addon repositories have two readme's: one in BBC and one in markdown. If the package has a README.md, just read it as markdown. If not, it's BBC. That makes less work for mod authors.

Parsedown seems to be a good library to use. Might need some changes to make it safe. Not entirely sure though.

Re: Markdown (tag?)

Reply #1

Might make sense to be able to wrap a post in  [md][/md] and have it render as markdown ...

Right now we use the "classic" version of https://michelf.ca/projects/php-markdown/ as we needed to support 5.2 in the 1.0.x branch.  In 1.1 I wanted to move to a new library (like one thats still supported :P ) and was considering https://github.com/michelf/php-markdown but the one you linked looks quite fine as well.

There are a few classes that manipulate our "languages"  Html2BBC.class and Html2MD and of-course Markdown which is basically Md2Html.  At one point I was going to do a direct BBC2MD version but I was lazy and instead do BBC -> HTML (parse_bbc) and then HTML -> MD.  Thats only used by the post by email functions as it takes inbound email (HTML which TBH is often a gawd awful mess) and converts it to BBC.  Outbound is Markdown(ish) (ish since we do a couple of "special" things(and I did not want to support HTML outbound, needless pain for the effort so parsebbc the message and then html2md for the output).

Re: Markdown (tag?)

Reply #2

Dunno... markdown is already a quite geeky thing (even bbcode nowadays is "too much"), I would rather see it parsed or not, but that's just me. :P
Bugs creator.
Features destroyer.
Template killer.

Re: Markdown (tag?)

Reply #3

You mean do just the minimal formatting tags ... so it would work with bold or italics  or strike and a few others, like maybe ##size2##, ###size 3### but not worry about the components like lists and tables etc etc?

Re: Markdown (tag?)

Reply #4

No, I mean "parse the whole body" against "parse he things included in a tag". :P
Bugs creator.
Features destroyer.
Template killer.

Re: Markdown (tag?)

Reply #5

Quote from: Spuds – Might make sense to be able to wrap a post in  [md][/md] and have it render as markdown ...

Right now we use the "classic" version of https://michelf.ca/projects/php-markdown/ as we needed to support 5.2 in the 1.0.x branch.  In 1.1 I wanted to move to a new library (like one thats still supported :P ) and was considering https://github.com/michelf/php-markdown but the one you linked looks quite fine as well.

There are a few classes that manipulate our "languages"  Html2BBC.class and Html2MD and of-course Markdown which is basically Md2Html.  At one point I was going to do a direct BBC2MD version but I was lazy and instead do BBC -> HTML (parse_bbc) and then HTML -> MD.  Thats only used by the post by email functions as it takes inbound email (HTML which TBH is often a gawd awful mess) and converts it to BBC.  Outbound is Markdown(ish) (ish since we do a couple of "special" things(and I did not want to support HTML outbound, needless pain for the effort so parsebbc the message and then html2md for the output).


Aww yiss, partial Markdown support. I started really getting into Markdown thanks to Github and Ghost, the blogging platform.

I'd love to also have the option for Markdown support in Elkarte. Make it optional and give the admins the option to enable or disable.

Is it possible to eventually have all the bbc code converted to Markdown if one chooses to enable Markdown and thus, choose to either disable BBC or even keep both BBC and Markdown enabled?

Re: Markdown (tag?)

Reply #6

I think a standard MD syntax doesn't cover all the possible BBC tags. It would require the introduction of few custom things.
Bugs creator.
Features destroyer.
Template killer.

Re: Markdown (tag?)

Reply #7

Quote from: emanuele – I think a standard MD syntax doesn't cover all the possible BBC tags. It would require the introduction of few custom things.

Or a conscious understanding/disclaimer that using Markdown over BBCode will not allow for as many formatting options.

Re: Markdown (tag?)

Reply #8

Quote from: emanuele – I think a standard MD syntax doesn't cover all the possible BBC tags. It would require the introduction of few custom things.

It's obvious that if one wants to enable MD syntax, that one should be aware of the differences between such. I'm not sure if it's a good idea to enable MD and BBC and leave both enabled. But... it'd probably be best. It would enable MD support for those that want it, leave BBC on for those who aren't quite ready to switch to Markdown syntax.

Re: Markdown (tag?)

Reply #9

How well integrated is BBCode into Elkarte? Would it be as simple as replacing the parse_bbc() function in Subs.php?

Re: Markdown (tag?)

Reply #10

It's used all over and dozen a lot of things. In 1.1 it will be easier to replace it but it will be a later version before it is really easy.


Re: Markdown (tag?)

Reply #12


I had seen this. It looks like you guys already have Markdown implemented, but not in the 1.x branch. This seems to be more for 1.1?

I'll see about implementing this via the hooks function. I'll look into implementing this... I'll also have to look at my install so I have a better idea of how to implement the code you suggested. Would md.php containing the following:

Code: [Select]
require_once(EXTDIR . '/markdown/markdown.php');
$message = Markdown($message);

function parse_markdown(&$message, &$smileys, &$cache_id, &$parse_tags)
{
require_once(EXTDIR . '/markdown/markdown.php');
$message = Markdown($message);
}

Or should I do a little something else to make the hooks work? Besides the obvious enabling of hooks in the forum, that is.

Re: Markdown (tag?)

Reply #13

MD is in the 1.0.x branch as well