0
This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
highlight_js-rails/vendor/assets/javascripts/highlight_js/languages/markdown.js
2012-08-14 23:47:39 +08:00

88 lines
1.9 KiB
JavaScript

/*
Language: Markdown
Requires: xml.js
Author: John Crepezzi <john.crepezzi@gmail.com>
Website: http://seejohncode.com/
*/
hljs.LANGUAGES['markdown'] = function(hljs) {
return {
case_insensitive: true,
defaultMode: {
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: '\\[.+\\]'
},
{
className: 'link_url',
begin: '\\(', end: '\\)',
excludeBegin: true, excludeEnd: true
}
]
}
]
}
};
}(hljs);