Giter Site home page Giter Site logo

gilbert / mirrormark Goto Github PK

View Code? Open in Web Editor NEW

This project forked from squiddev/mirrormark

23.0 1.0 6.0 1.09 MB

Simple, yet extensible Markdown editor built with Codemirror.

Home Page: http://squiddev.github.io/MirrorMark

JavaScript 57.70% CSS 23.21% HTML 19.09%

mirrormark's Introduction

MirrorMark

Demo. MirrorMark is a simple, yet extensible Markdown editor created with Codemirror.

Features

  • Preview mode
  • Fullscreen
  • Syntax highlighting, including in fenced code blocks

Install

bower install --save squiddev/mirrormark

Dependencies

CSS

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href="./css/mirrormark.package.min.css" rel="stylesheet" />

You can load always load each components' CSS individually. mirrormark.css contains the theme for the editor, toolbar and preview.

Javascript

<script src="./js/mirrormark.package.min.js"></script>

If you are so inclined, you can just load mirrormark.js and CodeMirror separately

Basic Usage

HTML

<textarea id="textarea1"></textarea>

Javascript

textarea1 = mirrorMark(document.getElementById("textarea1"), { showToolbar: false });
textarea1.render();

or if you are feeling groovy:

var mirrors = document.querySelectorAll('[mirrormark]')
for(var i = 0; i < mirrors.length; i++) {
	mirrorMark(mirrors[i]).render();
}

Options

When instantiating the editor you can pass the various Codemirror options available. There is also an option to opt to show toolbar showToolbar: false (Default: true) and the option to change the theme theme: name.

Custom Actions, Keymaps, and Toolbar.

MirrorMark allows you to add custom actions, keymaps, and toolbar options. Included in the demo is an example of how to add custom options.

Custom Methods

  • registerActions(actions) - Accepts an object with an Action name as the key and an anonymous function for the value.
  • registerKeymaps(keymaps) - Accepts an object with Keymap name as the key and an anonymous function for the value.
  • registerTools(tools, replace) - Accepts an array of custom tool objects with the option of replacing (default: false) the existing toolbar.

Insertion Methods

  • this.insert(string) - Inserts a string at the current cursor position
  • this.toggleBefore(string) - Toggles a string at the beginning of a line
  • this.toggleAround(start, end) - Toggles a string at the beginning and end of a selection

mirrormark's People

Contributors

squiddev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.