Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo Page: Give user feedback when "options" is not valid JSON. #1360

Merged
merged 2 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ header h1 {
box-sizing: border-box;
}

#options {
resize: both;
}

.pane, .inputPane {
margin-top: 5px;
padding: 0.6em;
Expand All @@ -65,3 +61,8 @@ header h1 {
#preview iframe {
flex-grow: 1;
}

#options.badParse {
border-color: red;
background-color: #FEE
}
2 changes: 2 additions & 0 deletions docs/demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ function checkForChanges() {
var optionsString = $optionsElem.value || '{}';
var newOptions = JSON.parse(optionsString);
options = newOptions;
$optionsElem.classList.remove('badParse');
} catch (err) {
$optionsElem.classList.add('badParse');
}

var lexed = marked.lexer($markdownElem.value, options);
Expand Down