mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
[#14] add initial github-flavored extension
simply handles strike-through for now.
This commit is contained in:
parent
60c6eec3eb
commit
d6d7f807ea
5
compressed/extensions/github.js
Normal file
5
compressed/extensions/github.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//
|
||||
// Github Extension (WIP)
|
||||
// ~~strike-through~~ -> <del>strike-through</del>
|
||||
//
|
||||
(function(){var a=function(a){return[{type:"lang",regex:"(~T){2}([^~]+)(~T){2}",replace:function(a,b,c,d){return"<del>"+c+"</del>"}}]};typeof window!="undefined"&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.github=a),typeof module!="undefined"&&(module.exports=a)})();
|
25
src/extensions/github.js
Normal file
25
src/extensions/github.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// Github Extension (WIP)
|
||||
// ~~strike-through~~ -> <del>strike-through</del>
|
||||
//
|
||||
|
||||
(function(){
|
||||
var github = function(converter) {
|
||||
return [
|
||||
{
|
||||
// strike-through
|
||||
// NOTE: showdown already replaced "~" with "~T", so we need to adjust accordingly.
|
||||
type : 'lang',
|
||||
regex : '(~T){2}([^~]+)(~T){2}',
|
||||
replace : function(match, prefix, content, suffix) {
|
||||
return '<del>' + content + '</del>';
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
// Client-side export
|
||||
if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.github = github; }
|
||||
// Server-side export
|
||||
if (typeof module !== 'undefined') module.exports = github;
|
||||
}());
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
//
|
||||
// Google Prettify
|
||||
// A showdown extension to add Google Prettify (http://code.google.com/p/google-code-prettify/)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
//
|
||||
// Twitter Extension
|
||||
// @username -> <a href="http://twitter.com/username">@username</a>
|
||||
|
|
|
@ -139,7 +139,7 @@ if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof req
|
|||
// Options:
|
||||
//
|
||||
|
||||
// Parse extensinos options into separate arrays
|
||||
// Parse extensions options into separate arrays
|
||||
if (converter_options && converter_options.extensions) {
|
||||
|
||||
// Iterate over each plugin
|
||||
|
|
5
test/extensions/github/basic.html
Normal file
5
test/extensions/github/basic.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<p><a href="http://github.github.com/github-flavored-markdown/">github-flavored markdown</a> adds support for:</p>
|
||||
|
||||
<ul>
|
||||
<li><del>strike-through text</del></li>
|
||||
</ul>
|
3
test/extensions/github/basic.md
Normal file
3
test/extensions/github/basic.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
[github-flavored markdown](http://github.github.com/github-flavored-markdown/) adds support for:
|
||||
|
||||
* ~~strike-through text~~
|
Loading…
Reference in New Issue
Block a user