mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-20 09:42:41 +00:00
Removed dep on marked, added in a definition list for list types
This commit is contained in:
@@ -29,7 +29,6 @@
|
|||||||
"jwt-simple": "^0.5.1",
|
"jwt-simple": "^0.5.1",
|
||||||
"lodash": "^4.17.3",
|
"lodash": "^4.17.3",
|
||||||
"loglevel": "^1.4.1",
|
"loglevel": "^1.4.1",
|
||||||
"marked": "^0.3.5",
|
|
||||||
"moment": "^2.11.0",
|
"moment": "^2.11.0",
|
||||||
"mongoose": "^4.3.3",
|
"mongoose": "^4.3.3",
|
||||||
"nconf": "^0.8.4",
|
"nconf": "^0.8.4",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const Markdown = require('marked');
|
//const Markdown = require('marked');
|
||||||
|
const Markdown = require('./marked.lib.js');
|
||||||
|
|
||||||
|
|
||||||
const renderer = new Markdown.Renderer();
|
const renderer = new Markdown.Renderer();
|
||||||
@@ -25,19 +26,27 @@ renderer.paragraph = function(text){
|
|||||||
}, []).join('\n');
|
}, []).join('\n');
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer.image = function(href, title, text){
|
renderer.image = function(href, title, text){
|
||||||
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
|
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
|
||||||
};
|
};
|
||||||
|
renderer.list = function(list, isOrdered, isDef){
|
||||||
|
if(isDef) return `<ul class='def'>${list}</ul>`;
|
||||||
|
if(isOrdered) return `<ol>${list}</ol>`;
|
||||||
|
return `<ul>${list}</ul>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
marked : Markdown,
|
marked : Markdown,
|
||||||
render : (rawBrewText)=>{
|
render : (rawBrewText)=>{
|
||||||
blockCount = 0;
|
blockCount = 0;
|
||||||
|
|
||||||
rawBrewText = rawBrewText.replace(/\\column/g, '{{columnSplit }}')
|
rawBrewText = rawBrewText.replace(/\\column/g, '{{columnSplit }}');
|
||||||
|
|
||||||
|
|
||||||
|
let html = Markdown(rawBrewText,{renderer : renderer, sanitize: true});
|
||||||
|
|
||||||
|
|
||||||
let html = Markdown(rawBrewText, {renderer : renderer, sanitize: true});
|
|
||||||
//Close all hanging block tags
|
//Close all hanging block tags
|
||||||
html += _.times(blockCount, ()=>{return '</div>'}).join('\n');
|
html += _.times(blockCount, ()=>{return '</div>'}).join('\n');
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
1288
shared/homebrewery/marked.lib.js
Normal file
1288
shared/homebrewery/marked.lib.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,7 @@
|
|||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
.spell{
|
.spell{
|
||||||
ul:first-of-type{
|
|
||||||
margin-top : -0.5em;
|
|
||||||
margin-bottom : 0.5em;
|
|
||||||
|
|
||||||
list-style-type : none;
|
|
||||||
&+p{
|
|
||||||
text-indent : 0em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.monster{
|
.monster{
|
||||||
.breakAvoid();
|
.breakAvoid();
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
|
|
||||||
pre{
|
pre{
|
||||||
font-family : monospace;
|
padding : 12px;
|
||||||
background-color : @yellow;
|
background-color : @yellow;
|
||||||
padding : 12px;
|
font-family : monospace;
|
||||||
border: 1px solid #bfbfbf;
|
color : #333;
|
||||||
white-space: pre-wrap;
|
border : 1px solid #bfbfbf;
|
||||||
color : #333;
|
white-space : pre-wrap;
|
||||||
-webkit-column-break-inside : avoid;
|
-webkit-column-break-inside : avoid;
|
||||||
column-break-inside : avoid;
|
column-break-inside : avoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hr{
|
hr{
|
||||||
visibility : visible;
|
visibility : visible;
|
||||||
height : 6px;
|
height : 6px;
|
||||||
@@ -18,65 +17,49 @@ hr{
|
|||||||
background-size : 100% 100%;
|
background-size : 100% 100%;
|
||||||
border : none;
|
border : none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
p{
|
p{
|
||||||
padding-bottom : 0.8em;
|
padding-bottom : 0.8em;
|
||||||
line-height : 1.3em;
|
line-height : 1.3em;
|
||||||
&+p{
|
&+p{
|
||||||
margin-top : -0.8em;
|
margin-top : -0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
blockquote{
|
blockquote{
|
||||||
font-style : italic;
|
font-style : italic;
|
||||||
&>p{
|
&>p{
|
||||||
line-height: 1.8em;
|
line-height : 1.8em;
|
||||||
|
|
||||||
//Why did I do this?
|
//Why did I do this?
|
||||||
&:first-child::first-line{
|
&:first-child::first-line{
|
||||||
|
font-family : ScalySansSmallCaps;
|
||||||
//TODO: Find the right font for block quotes
|
//TODO: Find the right font for block quotes
|
||||||
font-style: normal;
|
font-style : normal;
|
||||||
font-family: ScalySansSmallCaps;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.cite{
|
.cite{
|
||||||
font-style: normal;
|
font-style : normal;
|
||||||
text-align: right;
|
text-align : right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// IMAGE
|
// IMAGE
|
||||||
img{
|
img{
|
||||||
z-index : -1;
|
display : block;
|
||||||
display: block;
|
z-index : -1;
|
||||||
mix-blend-mode:multiply;
|
mix-blend-mode : multiply;
|
||||||
|
|
||||||
&.center{
|
&.center{
|
||||||
margin-right: auto;
|
margin-right : auto;
|
||||||
margin-left: auto;
|
margin-left : auto;
|
||||||
|
}
|
||||||
|
&.noBlend{
|
||||||
|
mix-blend-mode : normal;
|
||||||
|
}
|
||||||
|
&.bg, &.background{
|
||||||
|
position : absolute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Indents after p or lists
|
//Indents after p or lists
|
||||||
p+p, ul+p, ol+p{
|
p+p, ul+p, ol+p{
|
||||||
text-indent : 1em;
|
text-indent : 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
strong{
|
strong{
|
||||||
font-weight : bold;
|
font-weight : bold;
|
||||||
letter-spacing : 0.03em;
|
letter-spacing : 0.03em;
|
||||||
@@ -127,8 +110,6 @@ h5{
|
|||||||
font-size : 0.423cm;
|
font-size : 0.423cm;
|
||||||
font-weight : 900;
|
font-weight : 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//******************************
|
//******************************
|
||||||
// LISTS
|
// LISTS
|
||||||
//******************************
|
//******************************
|
||||||
@@ -154,17 +135,26 @@ ol{
|
|||||||
list-style-position : outside;
|
list-style-position : outside;
|
||||||
list-style-type : decimal;
|
list-style-type : decimal;
|
||||||
}
|
}
|
||||||
|
ul.def{
|
||||||
|
margin-top : -0.5em;
|
||||||
|
margin-bottom : 0.5em;
|
||||||
|
padding-left : 0em;
|
||||||
|
list-style-position : outside;
|
||||||
|
list-style-type : none;
|
||||||
|
list-style-type : none;
|
||||||
|
&+p{
|
||||||
|
text-indent : 0em;
|
||||||
|
}
|
||||||
|
}
|
||||||
//*****************************
|
//*****************************
|
||||||
// * TABLE
|
// * TABLE
|
||||||
// *****************************/
|
// *****************************/
|
||||||
table{
|
table{
|
||||||
.useSansSerif();
|
.useSansSerif();
|
||||||
break-inside: avoid-column;
|
|
||||||
width : 100%;
|
width : 100%;
|
||||||
margin-bottom : 1em;
|
margin-bottom : 1em;
|
||||||
font-size : 10pt;
|
font-size : 10pt;
|
||||||
|
break-inside : avoid-column;
|
||||||
thead{
|
thead{
|
||||||
font-weight : 800;
|
font-weight : 800;
|
||||||
th{
|
th{
|
||||||
|
|||||||
Reference in New Issue
Block a user