Browse Source

Demo: updated css & browser js files

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
6928f2b4a0
  1. 2
      Makefile
  2. 89
      demo/assets/index.css
  3. 63
      dist/remarkable.js
  4. 4
      dist/remarkable.min.js

2
Makefile

@ -15,7 +15,7 @@ GITHUB_PROJ := https://github.com//jonschlinkert/${NPM_PACKAGE}
demo: lint browserify demo: lint browserify
./support/demodata.js > demo/sample.json ./support/demodata.js > demo/sample.json
jade demo/index.jade -P --obj demo/sample.json jade demo/index.jade -P --obj demo/sample.json
stylus -u autoprefixer-stylus -c demo/assets/index.styl stylus -u autoprefixer-stylus demo/assets/index.styl
rm -rf demo/sample.json rm -rf demo/sample.json

89
demo/assets/index.css

@ -1 +1,88 @@
html,body,.full-height{height:100%}body{overflow-x:hidden;padding-bottom:180px}.demo-options{margin-bottom:10px}.checkbox{margin-right:10px}.source{width:100%}.result{padding-right:20px;overflow:auto;}.result img{max-width:100%}.result-src{display:none}.result-src-content{white-space:pre}.result-as-text .result-src{display:block}.result-as-text .result{display:none}.demo-control{position:absolute;right:15px;top:0;padding:0 10px;border-radius:0 4px;font-size:12px;background-color:#666;color:#fff !important;opacity:.6;-webkit-transition:opacity .5s ease-in-out;transition:opacity .5s ease-in-out;}.demo-control:hover{opacity:1}.demo-control a{margin:0 20px;color:#fff !important}.hljs{background:none;padding:0}.gh-ribbon{display:block;position:absolute;right:-60px;top:44px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);width:230px;z-index:10000;white-space:nowrap;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;background-color:#686868;box-shadow:0 0 2px rgba(102,102,102,0.4);padding:1px 0;}.gh-ribbon a{text-decoration:none !important;border:1px solid #ccc;color:#fff;display:block;font-size:13px;font-weight:700;outline:medium none;padding:4px 50px 2px;text-align:center} html,
body,
.full-height {
height: 100%;
}
body {
overflow-x: hidden;
padding-bottom: 180px;
}
.demo-options {
margin-bottom: 10px;
}
.checkbox {
margin-right: 10px;
}
.source {
width: 100%;
}
.result {
padding-right: 20px;
overflow: auto;
}
.result img {
max-width: 100%;
}
.result-src {
display: none;
}
.result-src-content {
white-space: pre;
}
.result-as-text .result-src {
display: block;
}
.result-as-text .result {
display: none;
}
.demo-control {
position: absolute;
right: 15px;
top: 0;
padding: 0 10px;
border-radius: 0 4px;
font-size: 12px;
background-color: #666;
color: #fff !important;
opacity: 0.6;
-webkit-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.demo-control:hover {
opacity: 1;
}
.demo-control a {
margin: 0 20px;
color: #fff !important;
}
.hljs {
background: none;
padding: 0;
}
.gh-ribbon {
display: block;
position: absolute;
right: -60px;
top: 44px;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
width: 230px;
z-index: 10000;
white-space: nowrap;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: #686868;
box-shadow: 0 0 2px rgba(102,102,102,0.4);
padding: 1px 0;
}
.gh-ribbon a {
text-decoration: none !important;
border: 1px solid #ccc;
color: #fff;
display: block;
font-size: 13px;
font-weight: 700;
outline: medium none;
padding: 4px 50px 2px;
text-align: center;
}

63
dist/remarkable.js

@ -2754,12 +2754,17 @@ LexerBlock.prototype.tokenize = function (state, startLine, endLine) {
throw new Error('None of rules updated state.line'); throw new Error('None of rules updated state.line');
} }
line = state.line;
// set state.tight iff we had an empty line before current tag // set state.tight iff we had an empty line before current tag
// i.e. latest empty line should not count // i.e. latest empty line should not count
state.tight = !hasEmptyLines; state.tight = !hasEmptyLines;
// paragraph might "eat" one newline after it in nested lists
if (isEmpty(state, state.line - 1)) {
hasEmptyLines = true;
}
line = state.line;
if (line < endLine && isEmpty(state, line)) { if (line < endLine && isEmpty(state, line)) {
hasEmptyLines = true; hasEmptyLines = true;
line++; line++;
@ -4169,8 +4174,11 @@ function isAlphaNum(code) {
(code >= 0x61 /* a */ && code <= 0x7A /* z */); (code >= 0x61 /* a */ && code <= 0x7A /* z */);
} }
// returns the amount of markers (1, 2, 3), or -1 on failure; // returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
// "start" should point at a valid marker // "start" should point at a valid marker
//
// note: in case if 4+ markers it is still not a valid emphasis,
// should be treated as a special case
function parseStart(state, start) { function parseStart(state, start) {
var pos = start, lastChar, count, var pos = start, lastChar, count,
max = Math.min(state.posMax, pos + 4), max = Math.min(state.posMax, pos + 4),
@ -4195,7 +4203,7 @@ function parseStart(state, start) {
if (count >= 4) { if (count >= 4) {
// check condition 1 // check condition 1
// sequence of four or more unescaped markers can't start an emphasis // sequence of four or more unescaped markers can't start an emphasis
return -1; return count;
} }
// check condition 2, marker followed by whitespace // check condition 2, marker followed by whitespace
@ -4210,8 +4218,11 @@ function parseStart(state, start) {
return count; return count;
} }
// returns the amount of markers (1, 2, 3), or -1 on failure; // returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
// "start" should point at a valid marker // "start" should point at a valid marker
//
// note: in case if 4+ markers it is still not a valid emphasis,
// should be treated as a special case
function parseEnd(state, start) { function parseEnd(state, start) {
var pos = start, lastChar, count, var pos = start, lastChar, count,
max = Math.min(state.posMax, pos + 4), max = Math.min(state.posMax, pos + 4),
@ -4219,8 +4230,6 @@ function parseEnd(state, start) {
lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1; lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1;
if (lastChar === marker) { return -1; }
while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; } while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; }
count = pos - start; count = pos - start;
@ -4234,7 +4243,7 @@ function parseEnd(state, start) {
if (count >= 4) { if (count >= 4) {
// check condition 1 // check condition 1
// sequence of four or more unescaped markers can't start an emphasis // sequence of four or more unescaped markers can't start an emphasis
return -1; return count;
} }
// check condition 2, marker preceded by whitespace // check condition 2, marker preceded by whitespace
@ -4264,12 +4273,18 @@ module.exports = function emphasis(state/*, silent*/) {
breakOutOfOuterLoop, breakOutOfOuterLoop,
max = state.posMax, max = state.posMax,
start = state.pos, start = state.pos,
haveLiteralAsterisk,
marker = state.src.charCodeAt(start); marker = state.src.charCodeAt(start);
if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; } if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; }
startCount = parseStart(state, start); startCount = parseStart(state, start);
if (startCount < 0) { return false; } if (startCount < 0) { return false; }
if (startCount >= 4) {
state.pos += startCount;
state.pending += state.src.slice(start, startCount);
return true;
}
oldLength = state.tokens.length; oldLength = state.tokens.length;
oldPending = state.pending; oldPending = state.pending;
@ -4280,9 +4295,9 @@ module.exports = function emphasis(state/*, silent*/) {
len = rules.length; len = rules.length;
while (state.pos < max) { while (state.pos < max) {
if (state.src.charCodeAt(state.pos) === marker) { if (state.src.charCodeAt(state.pos) === marker && !haveLiteralAsterisk) {
count = parseEnd(state, state.pos); count = parseEnd(state, state.pos);
if (count >= 1) { if (count >= 1 && count < 4) {
oldCount = stack.pop(); oldCount = stack.pop();
newCount = count; newCount = count;
@ -4336,7 +4351,13 @@ module.exports = function emphasis(state/*, silent*/) {
if (ok) { break; } if (ok) { break; }
} }
if (!ok) { state.pending += state.src[state.pos++]; } if (ok) {
haveLiteralAsterisk = false;
} else {
haveLiteralAsterisk = state.src.charCodeAt(state.pos) === marker;
state.pending += state.src[state.pos];
state.pos++;
}
} }
// restore old state // restore old state
@ -4539,8 +4560,6 @@ module.exports = function htmltag(state) {
'use strict'; 'use strict';
var skipSpaces = require('../helpers').skipSpaces;
// //
// Parse link label // Parse link label
// //
@ -4738,7 +4757,11 @@ function links(state) {
// [link]( <href> "title" ) // [link]( <href> "title" )
// ^^ skipping these spaces // ^^ skipping these spaces
pos++; pos++;
if ((pos = skipSpaces(state, pos)) >= max) { return false; } for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
if (pos >= max) { return false; }
// [link]( <href> "title" ) // [link]( <href> "title" )
// ^^^^^^ parsing link destination // ^^^^^^ parsing link destination
@ -4753,7 +4776,10 @@ function links(state) {
// [link]( <href> "title" ) // [link]( <href> "title" )
// ^^ skipping these spaces // ^^ skipping these spaces
start = pos; start = pos;
pos = skipSpaces(state, pos); for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
// [link]( <href> "title" ) // [link]( <href> "title" )
// ^^^^^^^ parsing link title // ^^^^^^^ parsing link title
@ -4762,7 +4788,10 @@ function links(state) {
// [link]( <href> "title" ) // [link]( <href> "title" )
// ^^ skipping these spaces // ^^ skipping these spaces
pos = skipSpaces(state, pos); for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
} else { } else {
title = ''; title = '';
} }
@ -4837,7 +4866,7 @@ module.exports.parseLinkDestination = parseLinkDestination;
module.exports.parseLinkTitle = parseLinkTitle; module.exports.parseLinkTitle = parseLinkTitle;
module.exports.normalizeReference = normalizeReference; module.exports.normalizeReference = normalizeReference;
},{"../helpers":6}],28:[function(require,module,exports){ },{}],28:[function(require,module,exports){
// Proceess '\n' // Proceess '\n'
module.exports = function escape(state) { module.exports = function escape(state) {

4
dist/remarkable.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save