1

markdown is well-known and used on sites like github and here also. I want to create a little blog module for my CMS and am wondering how markdown is converted to HTML in practice.

  1. Do sites like this or github render the .md files with some JavaScript or is it transformed when saved to HTML?

  2. Are there free tools that I can use to transform my .md file to HTML to store for my blog module, or should I just have some JavaScript render the HTML on every page load from the .md file?

  3. What are best practices?

Agi Hammerthief
  • 1,915
  • 1
  • 19
  • 32
Poul K. Sørensen
  • 15,251
  • 16
  • 104
  • 257
  • Check the related column on right-bottom of page. http://stackoverflow.com/questions/763087/how-do-i-convert-wmd-markdown-syntax-to-html-on-my-site?rq=1 – hjpotter92 Mar 29 '13 at 22:53

2 Answers2

1
  1. From what I understand from the markdown main page, markdown files are run through a converter/ parser written in PERL (or potentially any language capable of text-processing). The parser replaces certain symbols/ tokens (eg. -, =, #) with HTML tags. So yes, you could write a transformer in JavaScript or find one online. (The technical details of how to go about coding said parser are a little beyond me).

  2. Use a search engine (or search SO itself) to answer that one.

  3. As I don't know best practices for markdown, I'm leaving that to somebody else to answer. I'd suggest searching for them.

I'd provide more links, but my low rep prevents me from doing so.

Agi Hammerthief
  • 1,915
  • 1
  • 19
  • 32
0

Here's my two cents:

  1. I think they convert it on their servers when you save the file.

  2. I don't think so. It would probably be a simple task of just using PHP to get the file and
    using REGEX with Javscript to convert it to the HTML.

  3. As for best practices, keep your rules consistent with the official MD library.
Noah Buscher
  • 106
  • 1
  • 9