/*
Language: Markdown
Requires: xml.js
Author: John Crepezzi <john.crepezzi@gmail.com>
Website: http://seejohncode.com/
*/

function(hljs) {
  return {
    contains: [
      // highlight headers
      {
        className: 'header',
        begin: '^#{1,3}', end: '$'
      },
      {
        className: 'header',
        begin: '^.+?\\n[=-]{2,}$'
      },
      // inline html
      {
        begin: '<', end: '>',
        subLanguage: 'xml',
        relevance: 0
      },
      // lists (indicators only)
      {
        className: 'bullet',
        begin: '^([*+-]|(\\d+\\.))\\s+'
      },
      // strong segments
      {
        className: 'strong',
        begin: '[*_]{2}.+?[*_]{2}'
      },
      // emphasis segments
      {
        className: 'emphasis',
        begin: '\\*.+?\\*'
      },
      {
        className: 'emphasis',
        begin: '_.+?_',
        relevance: 0
      },
      // blockquotes
      {
        className: 'blockquote',
        begin: '^>\\s+', end: '$'
      },
      // code snippets
      {
        className: 'code',
        begin: '`.+?`'
      },
      {
        className: 'code',
        begin: '^    ', end: '$',
        relevance: 0
      },
      // horizontal rules
      {
        className: 'horizontal_rule',
        begin: '^-{3,}', end: '$'
      },
      // using links - title and link
      {
        begin: '\\[.+?\\]\\(.+?\\)',
        returnBegin: true,
        contains: [
          {
            className: 'link_label',
            begin: '\\[',
            end: '\\]',
            excludeBegin: true,
            excludeEnd: true,
            relevance: 0
          },
          {
            className: 'link_url',
            begin: '\\(', end: '\\)',
            excludeBegin: true, excludeEnd: true
          }
        ],
        relevance: 10
      }
    ]
  };
}

@@ -224,32 +224,56 @@
 header',%0A       
+ variants: %5B%0A          %7B
  begin: '%5E#%7B1,3%7D
@@ -275,38 +275,32 @@
 %7B1,3%7D', end: '$'
-%0A     
  %7D,%0A      %7B%0A    
@@ -297,46 +297,13 @@
     
-%7B%0A        className: 'header',%0A   
     
+%7B
  beg
@@ -324,16 +324,28 @@
 -%5D%7B2,%7D$'
+ %7D%0A        %5D
 %0A      %7D
@@ -766,82 +766,65 @@
     
-begin: '%5C%5C*.+?%5C%5C*'%0A      %7D,%0A      %7B%0A        className: 'emphasis',%0A       
+variants: %5B%0A          %7B begin: '%5C%5C*.+?%5C%5C*' %7D,%0A          %7B
  beg
@@ -834,25 +834,24 @@
  '_.+?_'
-,
 %0A       
  relevan
@@ -834,32 +834,36 @@
  '_.+?_'%0A       
+   ,
  relevance: 0%0A  
@@ -852,32 +852,54 @@
  , relevance: 0%0A
+          %7D%0A        %5D%0A
       %7D,%0A      /
@@ -1066,65 +1066,48 @@
     
-begin: '%60.+?%60'
+variants: %5B
 %0A     
- %7D,%0A
      
- %7B%0A        className: 'code'
+%7B begin: '%60.+?%60' %7D
 ,%0A  
@@ -1103,32 +1103,36 @@
 .+?%60' %7D,%0A       
+   %7B
  begin: '%5E    ',
@@ -1140,25 +1140,24 @@
 end: '$'
-,
 %0A       
  relevan
@@ -1140,32 +1140,36 @@
 end: '$'%0A       
+   ,
  relevance: 0%0A  
@@ -1158,32 +1158,54 @@
  , relevance: 0%0A
+          %7D%0A        %5D%0A
       %7D,%0A      /

Use variants for markdown