Created
June 3, 2010 07:39
-
-
Save FND/423607 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*** | |
| |''Requires''|MarkdownFormatterPlugin| | |
| !Usage | |
| <<md2html [[source]]>> | |
| {{{ | |
| <<md2html tiddler>> | |
| }}} | |
| !Code | |
| ***/ | |
| //{{{ | |
| (function($) { | |
| if(!config.parsers.markdownFormatter) { | |
| throw "Missing dependency: MarkdownFormatterPlugin"; | |
| } | |
| config.macros.md2html = { | |
| btnLabel: "convert markup", | |
| btnTooltip: "generate HTML from tiddler %0", | |
| handler: function(place, macroName, params, wikifier, paramString, tiddler) { | |
| var title = params[0]; | |
| var tooltip = this.btnTooltip.format([title]); | |
| var btn = createTiddlyButton(place, this.btnLabel, tooltip, this.onClick); | |
| $(btn).data("tiddler", title); | |
| }, | |
| onClick: function(ev) { | |
| var title = $(this).data("tiddler"); | |
| var tiddler = store.getTiddler(title); | |
| var html = wikifyStatic(tiddler.text, null, null, "markdown"); | |
| $("<textarea />").val(html).hide(). | |
| prependTo(document.body).slideDown().select(); | |
| } | |
| }; | |
| })(jQuery); | |
| //}}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment