在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):justinmc/markdown-html-form开源软件地址(OpenSource Url):https://github.com/justinmc/markdown-html-form开源编程语言(OpenSource Language):CoffeeScript 100.0%开源软件介绍(OpenSource Introduction):markdown-html-form
The purpose of this project is to create the most simple and efficient way to write blog posts and other content on the web. This is accomplished through an easy to setup markdown to html form element and preview. UsageHTML SetupIn order to use this project, you must have at least one textarea tag with the <!-- Edit markdown here! -->
<textarea class="mdhtmlform-md">## Write markdown in the textarea!</textarea>
<br /><br />
<!-- Display converted html here! -->
<div class="mdhtmlform-html"></div>
<br /><br />
<!-- And insert converted html for submission here. -->
<textarea class="mdhtmlform-html" style="display: none;"></textarea> Javascript SetupSimply include the Two-way ConversionI've shown how to sync the Markdown to an HTML preview div or textarea, but if you also want the HTML textarea to sync back to Markdown then that's easy too. Just make sure you also include to-markdown before mdhtmlform and the HTML will sync back automatically. Don't forget your HTML textarea still needs the Multiple InstancesIf you need multiple Markdown textareas syncing their HTML to separate elements on the same page, this is also easily accomplished. Just add a unique <!-- The first Markdown input -->
<textarea class="mdhtmlform-md" data-mdhtmlform-group="0">## Write markdown in the textarea!</textarea>
<br /><br />
<!-- HTML preview of whatever is in the first Markdown input -->
<div class="mdhtmlform-html" data-mdhtml-group="0"></div>
<br /><br />
<!-- The second Markdown input -->
<textarea class="mdhtmlform-md" data-mdhtmlform-group="1">## Write completely different markdown in this textarea!</textarea>
<br /><br />
<!-- HTML preview of whatever is in the second Markdown input -->
<div class="mdhtmlform-html" data-mdhtml-group="1"></div> Check out the InitializationThe project will initialize itself and start working automatically when jQuery is ready, but if you want to initialize it yourself at a differnt time, simply call its constructor and pass in the Markdown textarea you're using: new MdHtmlForm($("textarea.mdhtmlform-md")) ExamplesCheck out the examples in the Simple ExampleLive at: http://justinmccandless.com/demos/markdown-html-form/examples/simple/index.html The simple example is probably the most basic use case of the project. Markdown entered into a form shows a preview in realtime, and on submission of the form submits the converted html via a hidden input. Two-way ExampleLive at: http://justinmccandless.com/demos/markdown-html-form/examples/two-way/index.html This examples shows how to sync in both directions, with a raw HTML textarea syncing with a Markdown textarea and a preview div. Multiple ExampleLive at: http://justinmccandless.com/demos/markdown-html-form/examples/multiple/index.html This examples shows how to get two independent instances of the project working on the same page. Convert two differnt Markdown textareas to two differnt HTML previews. Hallo ExampleLive at: http://justinmccandless.com/demos/markdown-html-form/examples/hallo/index.html This example makes use of Hallo to make the live preview of the markdown editable. This basically gives you a markdown editor and a WYSIWYG editor kept in sync. LicenseThis project is free software licensed under the MIT license. See LICENSE.md. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论