Code Monkey home page Code Monkey logo

mmd.js's Introduction

Hello, this is mmd.js

mmd.js is a standalone minimalist Markdown parser written in ~815 bytes of JavaScript.

All the cool kids use Markdown. If you are not familiar with it already, have a look at the original Markdown syntax. Check the source code of this page, it is written in Markdown and parsed using mmd.js.

Why so small ?

mmd.js is only small because of its simple design and feature set. Using dirty size optimization tricks it should be possible to reach the 5-600 bytes mark. Maybe smaller. Except that's not the idea. Enough yak shaving!

How does mmd.js work ?

The input text is split into blocks separated by one or more blank lines. The type of each block is determined by checking the first character of the block. Headers, HTML and paragraphs are handled separetely. Multi line blocks are split using a regular expression. HTML escaping and span elements ( link, images, emphasis ) are processed for each line of the blocks. This allow to be close to the original Markdown syntax.

How to use mmd.js ?

<script src=mmd.min.js></script>
<script>console.log( mmd('Markdown is **sweet**') );</script>

Supported features

  • Headers #
  • Blockquotes >
  • Ordered lists 1
  • Unordered lists *
  • Paragraphs
  • Links
  • Images
  • Inline emphasis *
  • Inline emphasis **

Unsupported features

  • References and IDs
  • Escaping of Markdown characters
  • Nesting

Supported browsers

So far mmd.js has been tested in recent versions of Opera ( all flavours including Mini ), Chrome and Firefox. Pull requests addressing compatibility issues are most welcome, esp. regarding IE and Safari.

Why ?

mmd.js is the result of some very intensive yak shaving. Let's be honest, it was just an excuse to procastinate and do something different.

That's all folks.

mmd.js's People

Contributors

p01 avatar jussi-kalliokoski avatar

Watchers

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