docpad-archive / docpad-plugin-robotskirt

Markdown rendering for DocPad, using Robotskirt (Sundown)
Other
6 stars 0 forks source link

Add GFM support #1

Open pismute opened 12 years ago

pismute commented 12 years ago

make this render GFM page

pismute commented 12 years ago

Hi, @chase @balupton.

I had little survey about GFM. I think Robotskirt(sundown) seem to almostly support GFM.

GFM has 6 markdown extensions like this. Robotskirt already has them.:

Newlines

Robotskirt support this with HTML_HARD_WRAP option.

Multiple underscores in words

Robotskirt support this with EXT_NO_INTRA_EMPHASIS option.

URL autolinking

Robotskirt support this with EXT_AUTOLINK option.

Fenced code blocks

Robotskirt support this with EXT_FENCED_CODE option.

Syntax highlighting

User can customise it. Marked is the same.

A bit of the GitHub spice

I think this is only one Robotskirt has no a GFM feature. It is mandatory in only Github, these spices doesn't matter in outland.

Marked has no this spice too.

* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* \#Num: #1
* User/#Num: mojombo#1
* User/Project#Num: mojombo/god#1

Is it right? let me know. I want to close if ok.

chase commented 12 years ago

Marked has a lot of tests. Some of them, maybe all of them, test for GFM/GHM features.

You could make tests for Robotskirt that test the same things.

pismute commented 12 years ago

Thank you. @chase

Ok, I do.

pismute commented 11 years ago

I did more test for GFM. Customizing robotskirt code:

  var rs = require('robotskirt');
  var rend = new rs.HtmlRenderer([rs.HTML_HARD_WRAP]);

  rend.blockcode = function(code, lang){
    var open = '<pre><code>';

    if( lang ) {
      var l = lang.trim();

      if( l && l.length > 0 ) {
        open = '<pre><code class="lang-' + l + '">';
      }
    }

    return open + rs.houdini.escapeHTML(code) + '</code></pre>';
  }

  var md = new rs.Markdown(rend, [rs.EXT_AUTOLINK, rs.EXT_FENCED_CODE, rs.EXT_NO_INTRA_EMPHASIS, rs.EXT_STRIKETHROUGH, rs.EXT_SUPERSCRIPT]);

It passed on GFM tests of Marked, but made more failed about non-GFM tests.

My tests is on https://github.com/pismute/robotskirt/tree/gfm/benchmark. I could not port Marked's tests to docpad-plugin-robotskirt. Docpad testers is not easy for me.--; I need a short guide.