mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-14 17:12:40 +00:00
Add Styles for Forced Justifcation Tokens
This commit is contained in:
17
themes/V4/Blank/snippets/footer.gen.js
Normal file
17
themes/V4/Blank/snippets/footer.gen.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Markdown from '../../../../shared/naturalcrit/markdown.js';
|
||||
|
||||
module.exports = {
|
||||
createFooterFunc : function(headerSize=1){
|
||||
return (props)=>{
|
||||
const cursorPos = props.cursorPos;
|
||||
|
||||
const markdownText = props.brew.text.split('\n').slice(0, cursorPos.line).join('\n');
|
||||
const markdownTokens = Markdown.marked.lexer(markdownText);
|
||||
const headerToken = markdownTokens.findLast((lexerToken)=>{ return lexerToken.type === 'heading' && lexerToken.depth === headerSize; });
|
||||
const headerText = headerToken?.tokens.map((token)=>{ return token.text; }).join('');
|
||||
const outputText = headerText || 'PART 1 | SECTION NAME';
|
||||
|
||||
return `\n{{footnote ${outputText}}}\n`;
|
||||
};
|
||||
}
|
||||
};
|
||||
46
themes/V4/Blank/snippets/imageMask.gen.js
Normal file
46
themes/V4/Blank/snippets/imageMask.gen.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const _ = require('lodash');
|
||||
const dedent = require('dedent-tabs').default;
|
||||
|
||||
module.exports = {
|
||||
center : ()=>{
|
||||
return dedent`
|
||||
{{imageMaskCenter${_.random(1, 16)},--offsetX:0%,--offsetY:0%,--rotation:0
|
||||
{height:100%}
|
||||
}}
|
||||
<!-- Use --offsetX to shift the mask left or right (can use cm instead of %)
|
||||
Use --offsetY to shift the mask up or down
|
||||
Use --rotation to set rotation angle in degrees. -->\n\n`;
|
||||
},
|
||||
|
||||
edge : (side = 'bottom')=>{
|
||||
const rotation = {
|
||||
'bottom' : 0,
|
||||
'top' : 180,
|
||||
'left' : 90,
|
||||
'right' : 270
|
||||
}[side];
|
||||
return dedent`
|
||||
{{imageMaskEdge${_.random(1, 8)},--offset:0%,--rotation:${rotation}
|
||||
{height:100%}
|
||||
}}
|
||||
<!-- Use --offset to shift the mask away from page center (can use cm instead of %)
|
||||
Use --rotation to set rotation angle in degrees. -->\n\n`;
|
||||
},
|
||||
|
||||
corner : (y = 'top', x = 'left')=>{
|
||||
const offsetX = (x == 'left' ? '-50%' : '50%');
|
||||
const offsetY = (y == 'top' ? '50%' : '-50%');
|
||||
return dedent`
|
||||
{{imageMaskCorner${_.random(1, 37)},--offsetX:${offsetX},--offsetY:${offsetY},--rotation:0
|
||||
{height:100%}
|
||||
}}
|
||||
<!-- Use --offsetX to shift the mask left or right (can use cm instead of %)
|
||||
Use --offsetY to shift the mask up or down
|
||||
Use --rotation to set rotation angle in degrees. -->\n\n`;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
()=>{
|
||||
|
||||
};
|
||||
5
themes/V4/Blank/snippets/watercolor.gen.js
Normal file
5
themes/V4/Blank/snippets/watercolor.gen.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const _ = require('lodash');
|
||||
|
||||
module.exports = ()=>{
|
||||
return `{{watercolor${_.random(1, 12)},top:20px,left:30px,width:300px,background-color:#BBAD82,opacity:80%}}\n\n`;
|
||||
};
|
||||
Reference in New Issue
Block a user