0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Updating project version

This commit is contained in:
Scott Tolksdorf
2016-09-12 09:10:36 -04:00
parent 9a96eebdb1
commit c7ccf6747c
2 changed files with 3 additions and 43 deletions

View File

@@ -1,5 +1,8 @@
# changelog
### Friday, 09/09/2016 - v2.4.0
- Adding in a HTML validator that will display warnings whenever you save. This should stop a lot of the issues generated with pages not showing up.
### Saturday, 20/08/2016 - v2.3.0
- Added in a license file
- Updated the welcome text

View File

@@ -1,43 +0,0 @@
var _ = require('lodash');
var Markdown = require('marked');
var renderer = new Markdown.Renderer();
//Processes the markdown within an HTML block if it's just a class-wrapper
renderer.html = function (html) {
if(_.startsWith(_.trim(html), '<div') && _.endsWith(_.trim(html), '</div>')){
var openTag = html.substring(0, html.indexOf('>')+1);
html = html.substring(html.indexOf('>')+1);
html = html.substring(0, html.lastIndexOf('</div>'));
return `${openTag} ${Markdown(html)} </div>`;
}
return html;
};
module.exports = {
render : (rawText)=>{
return Markdown(rawText, {renderer : renderer})
},
validate : (rawText)=>{
var errors = [];
var tokens = Markdown.lexer(rawText);
_.each(tokens, (token)=>{
if(token.type === 'paragraph'){
if(_.startsWith(token.text, '<div')){
errors.push({
err : ' No closing tag',
token : token
});
}else if(_.startsWith(token.text, '</div>')){
errors.push({
err : ' No opening tag',
token : token
})
}
}
});
return errors;
},
marked : Markdown
};