mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 03:32:40 +00:00
Merge branch 'master' into more-style-snippets
This commit is contained in:
@@ -27,35 +27,154 @@ module.exports = [
|
||||
experimental : true,
|
||||
subsnippets : [
|
||||
{
|
||||
name : 'Table of Contents',
|
||||
name : 'Generate Table of Contents',
|
||||
icon : 'fas fa-book',
|
||||
gen : TableOfContentsGen,
|
||||
experimental : true
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H3',
|
||||
icon : 'fas fa-dice-three',
|
||||
name : 'Table of Contents Individual Inclusion',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocInclude# CHANGE # to your header level
|
||||
}}\n`,
|
||||
subsnippets : [
|
||||
{
|
||||
name : 'Individual Inclusion H1',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH1 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Inclusion H2',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH2 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Inclusion H3',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH3 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Inclusion H4',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH4 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Inclusion H5',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH5 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Inclusion H6',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocIncludeH6 \n
|
||||
}}\n`,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name : 'Table of Contents Range Inclusion',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocDepthH3
|
||||
}}\n`,
|
||||
subsnippets : [
|
||||
{
|
||||
name : 'Include in ToC up to H3',
|
||||
icon : 'fas fa-dice-three',
|
||||
gen : dedent `\n{{tocDepthH3
|
||||
}}\n`,
|
||||
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H4',
|
||||
icon : 'fas fa-dice-four',
|
||||
gen : dedent `\n{{tocDepthH4
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H5',
|
||||
icon : 'fas fa-dice-five',
|
||||
gen : dedent `\n{{tocDepthH5
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H6',
|
||||
icon : 'fas fa-dice-six',
|
||||
gen : dedent `\n{{tocDepthH6
|
||||
}}\n`,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H4',
|
||||
icon : 'fas fa-dice-four',
|
||||
gen : dedent `\n{{tocDepthH4
|
||||
name : 'Table of Contents Individual Exclusion',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH1 \n
|
||||
}}\n`,
|
||||
subsnippets : [
|
||||
{
|
||||
name : 'Individual Exclusion H1',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH1 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Exclusion H2',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH2 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Exclusion H3',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH3 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Exclusion H4',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH4 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Exclusion H5',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH5 \n
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Individual Exclusion H6',
|
||||
icon : 'fas fa-book',
|
||||
gen : dedent `\n{{tocExcludeH6 \n
|
||||
}}\n`,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
name : 'Include in ToC up to H5',
|
||||
icon : 'fas fa-dice-five',
|
||||
gen : dedent `\n{{tocDepthH5
|
||||
}}\n`,
|
||||
},
|
||||
{
|
||||
name : 'Include in ToC up to H6',
|
||||
icon : 'fas fa-dice-six',
|
||||
gen : dedent `\n{{tocDepthH6
|
||||
}}\n`,
|
||||
name : 'Table of Contents Toggles',
|
||||
icon : 'fas fa-book',
|
||||
gen : `{{tocGlobalH4}}\n\n`,
|
||||
subsnippets : [
|
||||
{
|
||||
name : 'Enable H1-H4 all pages',
|
||||
icon : 'fas fa-dice-four',
|
||||
gen : `{{tocGlobalH4}}\n\n`,
|
||||
},
|
||||
{
|
||||
name : 'Enable H1-H5 all pages',
|
||||
icon : 'fas fa-dice-five',
|
||||
gen : `{{tocGlobalH5}}\n\n`,
|
||||
},
|
||||
{
|
||||
name : 'Enable H1-H6 all pages',
|
||||
icon : 'fas fa-dice-six',
|
||||
gen : `{{tocGlobalH6}}\n\n`,
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -94,7 +213,7 @@ module.exports = [
|
||||
background-image: linear-gradient(-45deg, #322814, #998250, #322814);
|
||||
line-height: 1em;
|
||||
}\n\n`
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ const dedent = require('dedent-tabs').default;
|
||||
const mapPages = (pages)=>{
|
||||
let actualPage = 0;
|
||||
let mappedPage = 0; // Number displayed in footer
|
||||
let pageMap = [];
|
||||
const pageMap = [];
|
||||
|
||||
pages.forEach(page => {
|
||||
pages.forEach((page)=>{
|
||||
actualPage++;
|
||||
const doSkip = page.querySelector('.skipCounting');
|
||||
const doReset = page.querySelector('.resetCounting');
|
||||
@@ -24,13 +24,13 @@ const mapPages = (pages)=>{
|
||||
return pageMap;
|
||||
};
|
||||
|
||||
const getMarkdown = (headings, pageMap) => {
|
||||
const getMarkdown = (headings, pageMap)=>{
|
||||
const levelPad = ['- ###', ' - ####', ' -', ' -', ' -', ' -'];
|
||||
|
||||
let allMarkdown = [];
|
||||
let depthChain = [0];
|
||||
|
||||
headings.forEach(heading => {
|
||||
const allMarkdown = [];
|
||||
const depthChain = [0];
|
||||
|
||||
headings.forEach((heading)=>{
|
||||
const page = parseInt(heading.closest('.page').id?.replace(/^p/, ''));
|
||||
const mappedPage = pageMap[page].mappedPage;
|
||||
const showPage = pageMap[page].showPage;
|
||||
@@ -42,14 +42,14 @@ const getMarkdown = (headings, pageMap) => {
|
||||
return;
|
||||
|
||||
//If different header depth than last, remove indents until nearest higher-level header, then indent once
|
||||
if (depth !== depthChain[depthChain.length -1]) {
|
||||
if(depth !== depthChain[depthChain.length -1]) {
|
||||
while (depth <= depthChain[depthChain.length - 1]) {
|
||||
depthChain.pop();
|
||||
}
|
||||
depthChain.push(depth);
|
||||
}
|
||||
|
||||
let markdown = `${levelPad[depthChain.length - 2]} [{{ ${title}}}{{ ${mappedPage}}}](#p${page})`;
|
||||
const markdown = `${levelPad[depthChain.length - 2]} [{{ ${title}}}{{ ${mappedPage}}}](#p${page})`;
|
||||
allMarkdown.push(markdown);
|
||||
});
|
||||
return allMarkdown.join('\n');
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
--HB_Color_CaptionText : #766649; // Brown
|
||||
--HB_Color_WatercolorStain : #BBAD82; // Light brown
|
||||
--HB_Color_Footnotes : #C9AD6A; // Gold
|
||||
--TOC : 'include';
|
||||
}
|
||||
|
||||
.useSansSerif() {
|
||||
@@ -797,7 +798,7 @@
|
||||
// *****************************/
|
||||
|
||||
// Default Exclusions
|
||||
// Anything not exlcuded is included, default Headers are H1, H2, and H3.
|
||||
// Anything not excluded is included, default Headers are H1, H2, and H3.
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
@@ -808,12 +809,23 @@ h6,
|
||||
.noToC,
|
||||
.toc { --TOC: exclude; }
|
||||
|
||||
.tocDepthH2 :is(h1, h2) {--TOC: include; }
|
||||
.tocDepthH3 :is(h1, h2, h3) {--TOC: include; }
|
||||
.tocDepthH4 :is(h1, h2, h3, h4) {--TOC: include; }
|
||||
.tocDepthH5 :is(h1, h2, h3, h4, h5) {--TOC: include; }
|
||||
.tocDepthH6 :is(h1, h2, h3, h4, h5, h6) {--TOC: include; }
|
||||
|
||||
// Brew level default inclusion changes.
|
||||
// These add Headers 'back' to inclusion.
|
||||
.pages:has(.tocGlobalH4) {
|
||||
h4 {--TOC: include; }
|
||||
}
|
||||
|
||||
.pages:has(.tocGlobalH5) {
|
||||
h4, h5 {--TOC: include; }
|
||||
}
|
||||
|
||||
.pages:has(.tocGlobalH6) {
|
||||
h4, h5, h6 {--TOC: include; }
|
||||
}
|
||||
|
||||
// Block level inclusion changes
|
||||
// These include either a single (include) or a range (depth)
|
||||
.tocIncludeH1 h1 {--TOC: include; }
|
||||
.tocIncludeH2 h2 {--TOC: include; }
|
||||
.tocIncludeH3 h3 {--TOC: include; }
|
||||
@@ -821,6 +833,21 @@ h6,
|
||||
.tocIncludeH5 h5 {--TOC: include; }
|
||||
.tocIncludeH6 h6 {--TOC: include; }
|
||||
|
||||
.tocDepthH2 :is(h1, h2) {--TOC: include; }
|
||||
.tocDepthH3 :is(h1, h2, h3) {--TOC: include; }
|
||||
.tocDepthH4 :is(h1, h2, h3, h4) {--TOC: include; }
|
||||
.tocDepthH5 :is(h1, h2, h3, h4, h5) {--TOC: include; }
|
||||
.tocDepthH6 :is(h1, h2, h3, h4, h5, h6) {--TOC: include; }
|
||||
|
||||
// Block level exclusion changes
|
||||
// These exclude a single block level
|
||||
.tocExcludeH1 h1 {--TOC: exclude; }
|
||||
.tocExcludeH2 h2 {--TOC: exclude; }
|
||||
.tocExcludeH3 h3 {--TOC: exclude; }
|
||||
.tocExcludeH4 h4 {--TOC: exclude; }
|
||||
.tocExcludeH5 h5 {--TOC: exclude; }
|
||||
.tocExcludeH6 h6 {--TOC: exclude; }
|
||||
|
||||
.page:has(.partCover) {
|
||||
--TOC: exclude;
|
||||
& h1 {
|
||||
|
||||
Reference in New Issue
Block a user