Browse Source

Added strict commonmark option to demo

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
f17ce5a663
  1. 19
      demo/assets/index.js
  2. 5
      demo/assets/index.styl
  3. 18
      demo/index.jade

19
demo/assets/index.js

@ -13,6 +13,7 @@
// options below are for demo only
_highlight: false,
_strict: false,
_src: false
};
@ -32,9 +33,18 @@
return '';
};
function setOptionClass(name, val) {
if (val) {
$('body').addClass('opt_' + name);
} else {
$('body').removeClass('opt_' + name);
}
}
function mdInit() {
mdHtml = new window.Remarkable(defaults);
mdSrc = new window.Remarkable(defaults);
var opts = defaults._strict ? 'commonmark' : defaults;
mdHtml = new window.Remarkable(opts);
mdSrc = new window.Remarkable(opts);
// Beautify output of parser for html content
mdHtml.renderer.rules.table_open = function () {
@ -108,10 +118,13 @@
if (_.isBoolean(val)) {
$el.prop('checked', val);
$el.on('change', function () {
defaults[key] = Boolean($el.prop('checked'));
var value = Boolean($el.prop('checked'));
setOptionClass(key, value);
defaults[key] = value;
mdInit();
updateResult();
});
setOptionClass(key, val);
} else {
$(el).val(val);

5
demo/assets/index.styl

@ -9,6 +9,9 @@ body
.demo-options
margin-bottom 10px
.opt__strict .not-strict
opacity 0.5
.checkbox
margin-right 10px
@ -21,7 +24,7 @@ body
padding-right 20px
overflow auto
img
max-width 100%
max-width 50%
.result-src
display none

18
demo/index.jade

@ -28,36 +28,40 @@ html
code.js= s.code
.form-inline.demo-options
.checkbox
.checkbox.not-strict
label._tip(title='enable html tags in source text')
input#html(type='checkbox')
| html
.checkbox
.checkbox.not-strict
label._tip(title='produce xtml output (add / to single tags (<br /> instead of <br>)')
input#xhtmlOut(type='checkbox')
| xhtmlOut
.checkbox
.checkbox.not-strict
label._tip(title='newlines in paragraphs are rendered as <br>')
input#breaks(type='checkbox')
| breaks
.checkbox
.checkbox.not-strict
label._tip(title='autoconvert link-like texts to links')
input#linkify(type='checkbox')
| linkify
.checkbox
.checkbox.not-strict
label._tip(title='do typographyc replacements, (c) -> © and so on')
input#typographer(type='checkbox')
| typographer
.checkbox
.checkbox.not-strict
label._tip(title='enable output highlight for fenced blocks')
input#_highlight(type='checkbox')
| highlight
.form-group
.form-group.not-strict
input#langPrefix.form-control._tip(
type='input'
placeholder='language prefix'
title='css class language prefix for fenced code blocks'
)
.checkbox
label._tip(title='force strict CommonMark mode - output will be equal to reference parser')
input#_strict(type='checkbox')
| CommonMark strict
.container.full-height
.row.full-height

Loading…
Cancel
Save