Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 21, 2015
0 parents commit 833edc5
Show file tree
Hide file tree
Showing 72 changed files with 3,786 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{html,json,mdastrc,eslintrc,sh}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/
components/
coverage/
build.js
mdast-html.js
mdast-html.min.js
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"env": {
"node": true,
"browser": true
},
"rules": {
"quotes": [2, "single"]
}
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
*.log
bower_components/
build/
components/
coverage/
node_modules/
build.js
166 changes: 166 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"excludeFiles": [
"build/",
"components/",
"coverage/",
"node_modules/",
"build.js",
"lib/expression.js",
"mdast-html.js",
"mdast-html.min.js"
],
"plugins": [
"jscs-jsdoc"
],
"jsDoc": {
"checkAnnotations": "jsdoc3",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "strictNativeCase",
"checkRedundantAccess": true,
"enforceExistence": true,
"requireHyphenBeforeDescription": true
},
"jsDoc": {
"checkAnnotations": "jsdoc3",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "strictNativeCase",
"checkRedundantAccess": true,
"enforceExistence": true,
"requireHyphenBeforeDescription": true
},
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireBlocksOnNewline": true,
"disallowPaddingNewlinesInBlocks": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"requireSpacesInsideObjectBrackets": "all",
"disallowDanglingUnderscores": true,
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"maximumLineLength": 79,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "self",
"requireDotNotation": true,
"disallowYodaConditions": true,
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}
3 changes: 3 additions & 0 deletions .mdastignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
components/
bower_components/
test/
11 changes: 11 additions & 0 deletions .mdastrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
"lint",
"github",
"toc",
"yaml-config"
],
"settings": {
"bullet": "*"
}
}
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
script: npm run-script test-travis
node_js:
- '0.10'
- '0.11'
- '0.12'
- iojs
after_script: npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls
sudo: false
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(The MIT License)

Copyright (c) 2015 Titus Wormer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 36 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "mdast-html",
"main": "mdast-html.js",
"description": "Compile Markdown to HTML with mdast",
"license": "MIT",
"keywords": [
"markdown",
"html",
"stringify",
"compile",
"mdast"
],
"repository": {
"type": "git",
"url": "https://github.com/wooorm/mdast-html.git"
},
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com"
},
"ignore": [
".*",
"*.log",
"*.md",
"build/",
"components/",
"coverage/",
"node_modules/",
"test/",
"build.js",
"example.js",
"index.js",
"component.json",
"package.json"
]
}
21 changes: 21 additions & 0 deletions component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "mdast-html",
"version": "0.0.0",
"description": "Compile Markdown to HTML with mdast",
"license": "MIT",
"keywords": [
"markdown",
"html",
"stringify",
"compile",
"mdast"
],
"dependencies": {
"jonschlinkert/repeat-string": "^1.5.2"
},
"repository": "wooorm/mdast-html",
"scripts": [
"index.js",
"lib/"
]
}
6 changes: 6 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
mdast:
setext: true
---

<!--lint disable no-multiple-toplevel-headings -->
60 changes: 60 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use strict';

/*
* Dependencies.
*/

var compilers = require('./lib/compilers.js');

/**
* Attach an HTML compiler.
*
* @param {MDAST} mdast
* @param {Object?} [options]
*/
function plugin(mdast, options) {
var MarkdownCompiler = mdast.Compiler;
var ancestor = MarkdownCompiler.prototype;
var proto;
var key;

/**
* Extensible prototype.
*/
function HTMLCompilerPrototype() {}

HTMLCompilerPrototype.prototype = ancestor;

proto = new HTMLCompilerPrototype();

proto.options.xhtml = false;
proto.options.sanitize = false;
proto.options.entities = 'true';

/**
* Extensible constructor.
*/
function HTMLCompiler(file) {
file.extension = 'html';

MarkdownCompiler.apply(this, [file, options]);
}

HTMLCompiler.prototype = proto;

/*
* Expose compilers.
*/

for (key in compilers) {
proto[key] = compilers[key];
}

mdast.Compiler = HTMLCompiler;
}

/*
* Expose `plugin`.
*/

module.exports = plugin;

0 comments on commit 833edc5

Please sign in to comment.