jQuery plugin to add MarkDown butttons and preview to any kind of input field.
Check the demo page
## How it works
A special control buttons will be added on top of the selected input field with commands like:
- bold
- italic
- link
- list
- title
And a preview div will be added on the bottom of the selected input field with a MarkDown previsualization of the selected input field content.
- 0.0.1 (but already in production applications)
Using the $(<selector>).mdmagick()
call:
<textarea id="my-textarea"></textarea>
<script>
$(function(){ $("#my-textarea").mdmagick(); })
</script>
or Implicitly:
Adding the special class mdm-input
to any input field:
<textarea class="mdm-input"></textarea>
Tested in:
- (OSX) Chrome 21.0.1180.57
- (OSX) Firefox 8.0.1
- (OSX) Safari 6.0
1. Download the last version of the code.
3. Copy vendor
, lib
and assets
folders to a public folder in your web application. Let's call it mdmagick
.
<script src="./mdmagick/vendor/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="./mdmagick/vendor/a-tools.js" type="text/javascript" charset="utf-8"></script>
<script src="./mdmagick/vendor/showdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./mdmagick/lib/mdmagick.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="./mdmagick/assets/mdmagick.css" ></style>
<link rel="stylesheet" href="./mdmagick/assets/icon_font/style.css" />
<!--[if lte IE 7]><script src="./mdmagick/assets/icon_font/lte-ie7.js"></script><![endif]-->
Note: if you application is already importing some of the dependencies you have not to do it twice.
Add:
<script> window.MDM_SILENT = true; </script>
Before the:
<script src="./lib/mdmagick.js" type="text/javascript" charset="utf-8"></script>
- Check for performance issues
- Improve the slideOut and In animations
- Icons used in the control div from: IcoMoon
MIT License
Copyright (c) 2012 Fernando Guillen Suarez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.