GithubHelp home page GithubHelp logo

ahnan4arch / hypermd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laobubu/hypermd

0.0 2.0 0.0 75 KB

WYSIWYG Markdown Editor for browsers. Breaks the Wall between writing and preview.

License: MIT License

JavaScript 68.64% Shell 0.20% CSS 28.92% HTML 2.24%

hypermd's Introduction

HyperMD

HyperMD Markdown Editor

Breaks the Wall between writing and preview, in a Markdown Editor.

Online Demo

Why use HyperMD ?

HyperMD is a set of [CodeMirror] addons / modes / themes. You may use both original CodeMirror and HyperMD on the same page.

  1. Write, and preview on the fly
    • Strong, Emphasis, Strikethrough, Code
    • Links, Images, Footnotes
    • Block-quotes, code blocks
    • Headers
    • Horizontal Rules
    • Lists (nested, ordered, unordered, tasks with checkbox)
    • [MathJax] Formula, like $ e^{ i\pi } + 1 = 0 $ and math block 1
  2. Alt+Click to follow link / footnote 2
  3. Syntax Highlight for 120+ languages code blocks 3
  4. Hover to read footnotes
  5. Copy and Paste, translate HTML into Markdown
  6. Massive CodeMirror Addons can be loaded, including:
    • VIM/Emacs mode and Configurable keybindings
    • Diff and Merge
    • Fullscren
    • Themes 4
  7. And More...

Quickstart

[RequireJS] is recommended and used during developing HyperMD. You may just open index.js and copy partial code. Don't forget HTML <link> tags to the css files.

If you don't want to use [RequireJS], insert <script> , <link> and other tags manually. Load these files in sequence, before initializing your editor:

  • CodeMirror:
    • codemirror.js and codemirror.css
    • addon/mode/overlay.js from CodeMirror
    • addon/edit/continuelist.js from CodeMirror
    • meta, xml, markdown, gfm modes from CodeMirror
    • (optional) other CodeMirror modes if you need code highlighting
  • HyperMD:
    • mode/hypermd both js and css
    • all addons
    • theme you prefer ( eg. hypermd-light.css )

Once addons and stylesheets are loaded, you may initialize editor, turning your <textarea> into HyperMD editor, with few codes:

Note: This complex approach is temporary. but don't worry, Some easy-to-use functions (methods) will come in a new version.

var myTextarea = document.getElementById('input-area')
var editor = CodeMirror.fromTextArea(myTextarea, {
    lineNumbers: true,
    lineWrapping: true,
    theme: "hypermd-light",
    mode: "text/x-hypermd",

    gutters: [
        "CodeMirror-linenumbers",
        "HyperMD-goback"
    ],
    extraKeys: {
        "Enter": "newlineAndIndentContinueMarkdownList"
    },
    
    hmdHideToken: "(profile-1)",
    hmdCursorDebounce: true,
    hmdAutoFold: 200,
    hmdPaste: true,
    hmdFoldMath: { interval: 200, preview: true }
})

editor.hmdHoverInit()       // tooltips on footnotes
editor.hmdClickInit()       // click to follow links and footnotes 

And that's all. Feel free to modify the options above.

Contributing

HyperMD is a personal Open-Source project by [laobubu]. Contributions are welcomed. You may:


[CodeMirror]: https://codemirror.net/ A powerful text editor for the browser. [RequireJS]: http://requirejs.org/ A JavaScript AMD module loader. [MathJax]: https://www.mathjax.org/ A JavaScript display engine for mathematics. [laobubu]: https://laobubu.net/ The author of HyperMD.

Footnotes

  1. Math block is just like code block. Use $$ to wrap your math expression.

  2. Ctrl+Click works too, but will jump to the footnote if exists.

  3. Languages as many as CodeMirror supports.

  4. If the theme is not designed for HyperMD, some features might not be present.

hypermd's People

Contributors

laobubu avatar

Watchers

James Cloos avatar ahnan 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.