Add introductory text to demo, default all links to target=_blank.

This commit is contained in:
David Anson 2015-05-07 09:15:41 -07:00
parent 8aa3ee66e4
commit 661073b249
4 changed files with 58 additions and 3 deletions

View file

@ -35,6 +35,9 @@
var options = {
"strings": {
"content": content
},
"config": {
"MD013": false
}
};
var results = window.markdownlint.sync(options).toString();
@ -44,8 +47,8 @@
function replacer(match, p1, p2, p3) {
var ruleRef = rulesMd + "#" + p2.toLowerCase() + "---" +
p3.toLowerCase().replace(/ /g, "-");
return "&nbsp;<a href='#" + p1 + "'><em>" + p1 + "</em></a> - " +
"<a href='" + ruleRef + "' target='_blank'>" + p2 + "</a> " + p3;
return "<a href='#" + p1 + "'><em>" + p1 + "</em></a> - " +
"<a href='" + ruleRef + "'>" + p2 + "</a> " + p3;
});
}).join("<br/>");
}
@ -110,4 +113,33 @@
openFile.addEventListener("change", onOpenFileChange);
markdown.addEventListener("input", onMarkdownInput);
violations.addEventListener("click", onLineNumberClick, true);
/*eslint-disable max-len */
markdown.value = [
"## Introduction",
"",
"`markdownlint` is a [Node.js](https://nodejs.org/)/[io.js](https://iojs.org/) style checker and lint tool for [Markdown](http://en.wikipedia.org/wiki/Markdown) files to automatically validate content, prevent rendering problems, and promote consistency.",
"This page offers an easy way to try it out interactively!",
"",
"#### Instructions",
"",
"Type or paste `Markdown ` content in the upper-left box, drag-and-drop a file, or open one with the chooser at the top.",
"Content gets parsed and displayed in the upper-right box; rule violations (if any) show up in the lower-right box.",
"Click a violation for information about it or click its line number to highlighted it in the lower-left box.",
"",
"> *Note*: [All rules](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md) are enabled except for [MD013 Line length](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013---line-length). ",
"",
"",
"#### Resources",
"* [`markdownlint` on GitHub](https://github.com/DavidAnson/markdownlint)",
"* [`markdownlint` on npm](https://www.npmjs.com/package/markdownlint)",
"* [Markdown specification](http://daringfireball.net/projects/markdown/)",
"*\t[CommonMark specification](http://commonmark.org/)",
"",
"#### Thanks",
"",
"[`markdownlint/Ruby`](https://github.com/mivok/markdownlint) for the inspiration and [`markdown-it`](https://github.com/markdown-it/markdown-it) for the parser and interactive demo idea!"
].join("\n");
/*eslint-enable max-len */
onMarkdownInput();
}());