Giter Site home page Giter Site logo

phamthaithinh / meltdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iphands/meltdown

0.0 2.0 0.0 1.11 MB

Meltdown (Markdown Extra Live Toolbox): A JQuery plugin that adds Markdown Extra live previews, and a toolbar for common markdown actions.

CSS 8.46% HTML 1.02% JavaScript 90.52%

meltdown's Introduction

Meltdown (Markdown Extra Live Toolbox)

A JQuery plugin that adds Markdown Extra live previews, and a toolbar for common markdown editions. Check out the project page for a live demo.

It also features a fullscreen and a side-by-side mode (vertically split screen). The editor and the preview can be resized with your mouse (in browsers supporting the CSS resize property).

Usage

Simple, standard, awesome

jQuery('texterea').meltdown();

Advanced, fullscreen with preview on the side, still awesome

jQuery('#my_textarea').meltdown({
  fullscreen: true,
  openPreview: true,
  sidebyside: true
});

Options

Option Default Description
fullscreen false Set to true to go in fullscreen mode.
openPreview false Set to true to open the preview area.
previewHeight "editorHeight" With "editorHeight" the preview will have the same height as the textarea. With "auto" its height will adapt to its content. Also accepts any CSS height value (like "300px").
previewCollapses true If set to false, the editor will expand over the preview when the preview is toggled.
sidebyside false Set to true to go in side-by-side editing mode.
autoScrollPreview true Keeps the preview area scrolled at the bottom when you are typing text. Set to false to disable.
parser window.Markdown window.Markdown is the parser function from js-markdown-extra. false will directly parse the text as HTML. A parser function takes a text string as input and returns an HTML formatted string. (More infos in the Parser section below.)

Note: the default options can be changed in: jQuery.meltdown.defaults

API

Calling a method:

$("#my_textarea").meltdown("methodName", arg1, arg2);

Note: methods are chainnable.

Methods

update([force])

Update the preview with the content of the editor. Set force to true to force the the update even if the content of the editor is the same as the last update.

updateWith(text, [force])

Update the preview with the given text. The textwill be parsed before being rendered. Set force to true to force the the update even if the text is the same as the last update.

isPreviewOpen()

Returns true if the preview is open. Otherwise false.

togglePreview([open])

If open is true, open the preview, if false close it. If undefined or not given, toggle preview.

isFullscreen()

Returns true if meltdown is in fullscreen. Otherwise false.

toggleFullscreen([full])

If full is true, go fullscreen, if false leave fullscreen. If undefined or not given, toggle fullscreen.

isSidebyside()

Returns true if meltdown is in side-by-side. Otherwise false.

toggleSidebyside([sidebyside])

If sidebyside is true, go side-by-side, if false leave side-by-side. If undefined or not given, toggle side-by-side.

Parser

By default, uses the js-markdown-extra parser. You can change it to any parser you want (even a non Markdown parser).

Requirements

  • A modern browser: any recent version of Firefox, Chrome, IE 9+, Safari or Opera. Note: works in IE 8 but with some disabled features.
  • jQuery 1.9.1+ Note: works with jQuery 1.7.2+, but with some disabled features.

Changelog

  • v0.2 (??-APR-2014)

    • Fullscreen mode
    • Side-by-side mode
    • Editor and preview can be resized with the mouse
    • Customizable parser
    • Debounced preview updates (while typing)
    • Renamed and added init options
    • Added API to control meltdown from JavaScript (Now the parser must be loaded before jquery.meltdown.js)
    • Dropped IE 6-7 support
    • Removed jQuery-ui dependency
  • v0.1

Libraries used

License

Copyright (c) 2013 Ian Page Hands and Mark Caron. Licensed under the GPLv3 license.

meltdown's People

Contributors

jlgrall avatar iphands avatar beatrichartz avatar connyay avatar hrs113355 avatar mwcz avatar

Watchers

James Cloos avatar Thai Thinh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.