Skip to content

Commit

Permalink
Browser files build
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Jan 1, 2015
1 parent 2938016 commit e08ede9
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
73 changes: 73 additions & 0 deletions dist/markdown-it-sup.js
@@ -0,0 +1,73 @@
/*! markdown-it-sup 0.1.0 https://github.com//markdown-it/markdown-it-sup @license MIT */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.markdownitSup=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Process ^superscript^

'use strict';

// same as UNESCAPE_MD_RE plus a space
var UNESCAPE_RE = /\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;

function superscript(state, silent) {
var found,
content,
max = state.posMax,
start = state.pos;

if (state.src.charCodeAt(start) !== 0x5E/* ^ */) { return false; }
if (silent) { return false; } // don't run any pairs in validation mode
if (start + 2 >= max) { return false; }

state.pos = start + 1;

while (state.pos < max) {
if (state.src.charCodeAt(state.pos) === 0x5E/* ^ */) {
found = true;
break;
}

state.md.inline.skipToken(state);
}

if (!found || start + 1 === state.pos) {
state.pos = start;
return false;
}

content = state.src.slice(start + 1, state.pos);

// don't allow unescaped spaces/newlines inside
if (content.match(/(^|[^\\])(\\\\)*\s/)) {
state.pos = start;
return false;
}

// found!
state.posMax = state.pos;
state.pos = start + 1;

// Earlier we checked !silent, but this implementation does not need it
state.push({ type: 'sup_open', level: state.level++ });
state.push({
type: 'text',
level: state.level,
content: content.replace(UNESCAPE_RE, '$1')
});
state.push({ type: 'sup_close', level: --state.level });

state.pos = state.posMax + 1;
state.posMax = max;
return true;
}


function sup_open() { return '<sup>'; }
function sup_close() { return '</sup>'; }


module.exports = function sup_plugin(md) {
md.inline.ruler.after('emphasis', 'sup', superscript);
md.renderer.rules.sup_open = sup_open;
md.renderer.rules.sup_close = sup_close;
};

},{}]},{},[1])(1)
});
2 changes: 2 additions & 0 deletions dist/markdown-it-sup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e08ede9

Please sign in to comment.