1

Update


I'm trying to create a simple Go function which will simply take in a string of reddit-style Markdown and return the appropriate HTML.

Right now, I know that having Discount installed is a prerequisite and that at least the following three files are used by reddit as wrappers around Discount:

Based on this, does anyone know how I can sort of glue all this together with Cgo and go-python to create a simple Markdown function? (independent of the rest of the reddit source code)

Ryan Lester
  • 2,363
  • 7
  • 25
  • 38

1 Answers1

3

If all you want is Markdown, I don't see how Python fits into this. Maybe there's more to it, but if at all possible you should leave Python out of this. If there's a reason to use Python that wasn't in the question, I can edit this answer and address that.

First, try this native Go Markdown package: https://github.com/knieriem/markdown

If that doesn't work, the next easiest thing is to take Discount (or any other Markdown library written in C, such as GitHub's Upskirt fork) and wrap it with cgo or SWIG.

Evan Shaw
  • 23,839
  • 7
  • 70
  • 61
  • Awesome, thanks! I wanted to take reddit's code to be sure that I would be getting exactly the same style of Markdown (they seem to have made various small changes over time), but it looks like such a hassle that it seems useless when there's already a native Go implementation. Alternatively, it doesn't look too difficult to wrap Discount (sans reddit wrapping), which seems to be the fastest implementation around. Relevant: http://stackoverflow.com/questions/889434/markdown-implementations-for-c-c – Ryan Lester May 23 '11 at 08:26