From eebc9c2bfae935072a49453a50ae390829140ac0 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 22 Jan 2025 15:04:33 -0500 Subject: [PATCH 01/22] commit changes so far --- client/homebrew/brewRenderer/brewRenderer.jsx | 23 +++++++++++++++++-- shared/naturalcrit/markdown.js | 19 ++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 17f261c2d..529605a40 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -40,7 +40,7 @@ const BrewPage = (props)=>{ ...props }; const pageRef = useRef(null); - const cleanText = safeHTML(props.contents); + let cleanText = safeHTML(props.contents); useEffect(()=>{ if(!pageRef.current) return; @@ -78,6 +78,20 @@ const BrewPage = (props)=>{ }; }, []); + // Extract any page styles from `\page{cssProp:value}` + if(cleanText.match(/^ { + const [key, value] = curr.split(':').map(item => item.trim()); + const camelCaseKey = key.replace(/-([a-z])/g, g => g[1].toUpperCase()); //Convert to camelCase for React + acc[camelCaseKey] = value; + return acc; + }, {}); + + props.style = {...props.style, ...styleObject}; + cleanText = cleanText.substring(cleanText.indexOf('\n')); + } + return
; @@ -126,7 +140,7 @@ const BrewRenderer = (props)=>{ if(props.renderer == 'legacy') { rawPages = props.text.split('\\page'); } else { - rawPages = props.text.split(/^\\page$/gm); + rawPages = props.text.split(/^(?=\\page(?:{[^\n{}]+})?$)/gm); } const handlePageVisibilityChange = (pageNum, isVisible, isCenter)=>{ @@ -183,6 +197,11 @@ const BrewRenderer = (props)=>{ return ; } else { + let pageText2 = pageText.substring(0, pageText.indexOf('\n')); + let butt = Markdown.marked.lexer(pageText2); + console.log(butt) + + pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear) const html = Markdown.render(pageText, index); diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index c2aa89fb5..78eef8ebd 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -527,6 +527,21 @@ const definitionListsMultiLine = { } }; +const pageBreak = { + name : 'pageBreak', + level : 'block', + start(src) { return src.match(/\n\\page/m)?.index; }, // Hint to Marked.js to stop and check for a match + tokenizer(src) { + const regex = /^\\page(?:$|(?={[^\n{}]+}$))/m; + const match = regex.exec(src); + if(match?.length) + return { type : 'pageBreak', raw : match[0] }; + }, + renderer(token) { + return `\n`; + } +}; + //v=====--------------------< Variable Handling >-------------------=====v// 242 lines const replaceVar = function(input, hoist=false, allowUnresolved=false) { const regex = /([!$]?)\[((?!\s*\])(?:\\.|[^\[\]\\])+)\]/g; @@ -795,7 +810,7 @@ const tableTerminators = [ ]; Marked.use(MarkedVariables()); -Marked.use({ extensions : [justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, +Marked.use({ extensions : [pageBreak, justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, nonbreakingSpaces, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] }); Marked.use(mustacheInjectBlock); Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false }); @@ -992,6 +1007,8 @@ const Markdown = { return errors; }, + + extractHTMLStyleTags : extractHTMLStyleTags }; export default Markdown; From 0ac981586f0f2bb4a6713f7e8b69989aa52a0ff4 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 24 Jan 2025 01:16:22 -0500 Subject: [PATCH 02/22] Clean up --- client/homebrew/brewRenderer/brewRenderer.jsx | 35 ++++++++----------- shared/naturalcrit/markdown.js | 21 ++--------- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 529605a40..a4774523f 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -77,22 +77,8 @@ const BrewPage = (props)=>{ centerObserver.disconnect(); }; }, []); - - // Extract any page styles from `\page{cssProp:value}` - if(cleanText.match(/^ { - const [key, value] = curr.split(':').map(item => item.trim()); - const camelCaseKey = key.replace(/-([a-z])/g, g => g[1].toUpperCase()); //Convert to camelCase for React - acc[camelCaseKey] = value; - return acc; - }, {}); - - props.style = {...props.style, ...styleObject}; - cleanText = cleanText.substring(cleanText.indexOf('\n')); - } - return
+ return
; }; @@ -187,25 +173,32 @@ const BrewRenderer = (props)=>{ const renderPage = (pageText, index)=>{ - const styles = { + let styles = { ...(!displayOptions.pageShadows ? { boxShadow: 'none' } : {}) // Add more conditions as needed }; + let attributes = {}; if(props.renderer == 'legacy') { const html = MarkdownLegacy.render(pageText); return ; } else { - let pageText2 = pageText.substring(0, pageText.indexOf('\n')); - let butt = Markdown.marked.lexer(pageText2); - console.log(butt) - + if(pageText.startsWith('\\page')) { + let firstLineTokens = Markdown.marked.lexer(pageText.split('\n', 1)[0])[0].tokens; + let injectedTags = firstLineTokens.find(obj => obj.injectedTags !== undefined)?.injectedTags; + if(injectedTags) { + styles = {...styles, ...injectedTags.styles}; + styles = _.mapKeys(styles, (v, k) => _.camelCase(k)); // Convert CSS to camelCase for React + attributes = injectedTags.attributes; + } + pageText = pageText.includes('\n') ? pageText.substring(pageText.indexOf('\n') + 1) : ''; // Remove the \page line + } pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear) const html = Markdown.render(pageText, index); - return ; + return ; } }; diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index c0feef234..ab19d06ba 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -527,21 +527,6 @@ const definitionListsMultiLine = { } }; -const pageBreak = { - name : 'pageBreak', - level : 'block', - start(src) { return src.match(/\n\\page/m)?.index; }, // Hint to Marked.js to stop and check for a match - tokenizer(src) { - const regex = /^\\page(?:$|(?={[^\n{}]+}$))/m; - const match = regex.exec(src); - if(match?.length) - return { type : 'pageBreak', raw : match[0] }; - }, - renderer(token) { - return `\n`; - } -}; - //v=====--------------------< Variable Handling >-------------------=====v// 242 lines const replaceVar = function(input, hoist=false, allowUnresolved=false) { const regex = /([!$]?)\[((?!\s*\])(?:\\.|[^\[\]\\])+)\]/g; @@ -810,7 +795,7 @@ const tableTerminators = [ ]; Marked.use(MarkedVariables()); -Marked.use({ extensions : [pageBreak, justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, +Marked.use({ extensions : [justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, nonbreakingSpaces, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] }); Marked.use(mustacheInjectBlock); Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false }); @@ -1017,9 +1002,7 @@ const Markdown = { }); return errors; - }, - - extractHTMLStyleTags : extractHTMLStyleTags + } }; export default Markdown; From 9f8831eed620fb28ee3b5cda22bffa032b76c192 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 24 Jan 2025 01:16:55 -0500 Subject: [PATCH 03/22] Adjust display and page count when first line has \page --- client/homebrew/editor/editor.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index bba5f3ad9..3bda5f989 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -126,15 +126,15 @@ const Editor = createClass({ }, updateCurrentCursorPage : function(cursor) { - const lines = this.props.brew.text.split('\n').slice(0, cursor.line + 1); - const pageRegex = this.props.brew.renderer == 'V3' ? /^\\page$/ : /\\page/; + const lines = this.props.brew.text.split('\n').slice(1, cursor.line + 1); + const pageRegex = this.props.brew.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/ : /\\page/; const currentPage = lines.reduce((count, line)=>count + (pageRegex.test(line) ? 1 : 0), 1); this.props.onCursorPageChange(currentPage); }, updateCurrentViewPage : function(topScrollLine) { - const lines = this.props.brew.text.split('\n').slice(0, topScrollLine + 1); - const pageRegex = this.props.brew.renderer == 'V3' ? /^\\page$/ : /\\page/; + const lines = this.props.brew.text.split('\n').slice(1, topScrollLine + 1); + const pageRegex = this.props.brew.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/ : /\\page/; const currentPage = lines.reduce((count, line)=>count + (pageRegex.test(line) ? 1 : 0), 1); this.props.onViewPageChange(currentPage); }, @@ -174,7 +174,7 @@ const Editor = createClass({ for (let i=customHighlights.length - 1;i>=0;i--) customHighlights[i].clear(); - let editorPageCount = 2; // start page count from page 2 + let editorPageCount = 1; // start page count from page 1 _.forEach(this.props.brew.text.split('\n'), (line, lineNumber)=>{ @@ -190,7 +190,10 @@ const Editor = createClass({ // Styling for \page breaks if((this.props.renderer == 'legacy' && line.includes('\\page')) || - (this.props.renderer == 'V3' && line.match(/^\\page$/))) { + (this.props.renderer == 'V3' && line.match(/^(?=\\page(?:{[^\n{}]+})?$)/))) { + + if(lineNumber > 1) // Since \page is optional on first line of document, + editorPageCount += 1; // don't use it to increment page count; stay at 1 // add back the original class 'background' but also add the new class '.pageline' codeMirror.addLineClass(lineNumber, 'background', 'pageLine'); @@ -199,8 +202,6 @@ const Editor = createClass({ textContent : editorPageCount }); codeMirror.setBookmark({ line: lineNumber, ch: line.length }, pageCountElement); - - editorPageCount += 1; }; // New Codemirror styling for V3 renderer @@ -358,7 +359,7 @@ const Editor = createClass({ if(!this.isText() || isJumping) return; - const textSplit = this.props.renderer == 'V3' ? /^\\page$/gm : /\\page/; + const textSplit = this.props.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/gm : /\\page/; const textString = this.props.brew.text.split(textSplit).slice(0, targetPage-1).join(textSplit); const targetLine = textString.match('\n') ? textString.split('\n').length - 1 : -1; From 7610466ee455a05cf11d1210e7828519796408f8 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 24 Jan 2025 01:48:18 -0500 Subject: [PATCH 04/22] Off by 1 error --- client/homebrew/editor/editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 3bda5f989..fc2813f38 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -192,7 +192,7 @@ const Editor = createClass({ if((this.props.renderer == 'legacy' && line.includes('\\page')) || (this.props.renderer == 'V3' && line.match(/^(?=\\page(?:{[^\n{}]+})?$)/))) { - if(lineNumber > 1) // Since \page is optional on first line of document, + if(lineNumber > 0) // Since \page is optional on first line of document, editorPageCount += 1; // don't use it to increment page count; stay at 1 // add back the original class 'background' but also add the new class '.pageline' From 36df121cf66b530d30beb6266ed897115b4fe350 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 27 Jan 2025 23:10:37 -0500 Subject: [PATCH 05/22] Lint --- client/homebrew/brewRenderer/brewRenderer.jsx | 12 ++++++------ client/homebrew/editor/editor.jsx | 2 +- shared/naturalcrit/markdown.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index a4774523f..a11710433 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -40,7 +40,7 @@ const BrewPage = (props)=>{ ...props }; const pageRef = useRef(null); - let cleanText = safeHTML(props.contents); + const cleanText = safeHTML(props.contents); useEffect(()=>{ if(!pageRef.current) return; @@ -77,7 +77,7 @@ const BrewPage = (props)=>{ centerObserver.disconnect(); }; }, []); - + return
; @@ -185,11 +185,11 @@ const BrewRenderer = (props)=>{ return ; } else { if(pageText.startsWith('\\page')) { - let firstLineTokens = Markdown.marked.lexer(pageText.split('\n', 1)[0])[0].tokens; - let injectedTags = firstLineTokens.find(obj => obj.injectedTags !== undefined)?.injectedTags; + const firstLineTokens = Markdown.marked.lexer(pageText.split('\n', 1)[0])[0].tokens; + const injectedTags = firstLineTokens.find((obj)=>obj.injectedTags !== undefined)?.injectedTags; if(injectedTags) { - styles = {...styles, ...injectedTags.styles}; - styles = _.mapKeys(styles, (v, k) => _.camelCase(k)); // Convert CSS to camelCase for React + styles = { ...styles, ...injectedTags.styles }; + styles = _.mapKeys(styles, (v, k)=>_.camelCase(k)); // Convert CSS to camelCase for React attributes = injectedTags.attributes; } pageText = pageText.includes('\n') ? pageText.substring(pageText.indexOf('\n') + 1) : ''; // Remove the \page line diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index fc2813f38..f56b18618 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -193,7 +193,7 @@ const Editor = createClass({ (this.props.renderer == 'V3' && line.match(/^(?=\\page(?:{[^\n{}]+})?$)/))) { if(lineNumber > 0) // Since \page is optional on first line of document, - editorPageCount += 1; // don't use it to increment page count; stay at 1 + editorPageCount += 1; // don't use it to increment page count; stay at 1 // add back the original class 'background' but also add the new class '.pageline' codeMirror.addLineClass(lineNumber, 'background', 'pageLine'); diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index ab19d06ba..99766b536 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -1002,7 +1002,7 @@ const Markdown = { }); return errors; - } + }, }; export default Markdown; From f1ff032e1e42041c53743255c9140d1346a99f12 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 27 Jan 2025 23:24:25 -0500 Subject: [PATCH 06/22] Extract repeated pagebreak regex into a constant --- client/homebrew/editor/editor.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index f56b18618..9a88efca5 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -12,7 +12,8 @@ const MetadataEditor = require('./metadataEditor/metadataEditor.jsx'); const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME'; -const SNIPPETBAR_HEIGHT = 25; +const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:{[^\n{}]+})?$)/m; +const SNIPPETBAR_HEIGHT = 25; const DEFAULT_STYLE_TEXT = dedent` /*=======--- Example CSS styling ---=======*/ /* Any CSS here will apply to your document! */ @@ -21,6 +22,8 @@ const DEFAULT_STYLE_TEXT = dedent` color: black; }`; + + let isJumping = false; const Editor = createClass({ @@ -127,14 +130,14 @@ const Editor = createClass({ updateCurrentCursorPage : function(cursor) { const lines = this.props.brew.text.split('\n').slice(1, cursor.line + 1); - const pageRegex = this.props.brew.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/ : /\\page/; + const pageRegex = this.props.brew.renderer == 'V3' ? PAGEBREAK_REGEX_V3 : /\\page/; const currentPage = lines.reduce((count, line)=>count + (pageRegex.test(line) ? 1 : 0), 1); this.props.onCursorPageChange(currentPage); }, updateCurrentViewPage : function(topScrollLine) { const lines = this.props.brew.text.split('\n').slice(1, topScrollLine + 1); - const pageRegex = this.props.brew.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/ : /\\page/; + const pageRegex = this.props.brew.renderer == 'V3' ? PAGEBREAK_REGEX_V3 : /\\page/; const currentPage = lines.reduce((count, line)=>count + (pageRegex.test(line) ? 1 : 0), 1); this.props.onViewPageChange(currentPage); }, @@ -190,7 +193,7 @@ const Editor = createClass({ // Styling for \page breaks if((this.props.renderer == 'legacy' && line.includes('\\page')) || - (this.props.renderer == 'V3' && line.match(/^(?=\\page(?:{[^\n{}]+})?$)/))) { + (this.props.renderer == 'V3' && line.match(PAGEBREAK_REGEX_V3))) { if(lineNumber > 0) // Since \page is optional on first line of document, editorPageCount += 1; // don't use it to increment page count; stay at 1 @@ -359,7 +362,7 @@ const Editor = createClass({ if(!this.isText() || isJumping) return; - const textSplit = this.props.renderer == 'V3' ? /^(?=\\page(?:{[^\n{}]+})?$)/gm : /\\page/; + const textSplit = this.props.renderer == 'V3' ? PAGEBREAK_REGEX_V3 : /\\page/; const textString = this.props.brew.text.split(textSplit).slice(0, targetPage-1).join(textSplit); const targetLine = textString.match('\n') ? textString.split('\n').length - 1 : -1; From be18843b092003cbf729b888d2a5a6f910f8daf9 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 27 Jan 2025 23:27:03 -0500 Subject: [PATCH 07/22] Allow empty braces: \page{} --- client/homebrew/brewRenderer/brewRenderer.jsx | 2 +- client/homebrew/editor/editor.jsx | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index a11710433..7210a65d0 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -126,7 +126,7 @@ const BrewRenderer = (props)=>{ if(props.renderer == 'legacy') { rawPages = props.text.split('\\page'); } else { - rawPages = props.text.split(/^(?=\\page(?:{[^\n{}]+})?$)/gm); + rawPages = props.text.split(/^(?=\\page(?:{[^\n{}]*})?$)/gm); } const handlePageVisibilityChange = (pageNum, isVisible, isCenter)=>{ diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 9a88efca5..20cb8968c 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -12,7 +12,7 @@ const MetadataEditor = require('./metadataEditor/metadataEditor.jsx'); const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME'; -const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:{[^\n{}]+})?$)/m; +const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:{[^\n{}]*})?$)/m; const SNIPPETBAR_HEIGHT = 25; const DEFAULT_STYLE_TEXT = dedent` /*=======--- Example CSS styling ---=======*/ @@ -22,8 +22,6 @@ const DEFAULT_STYLE_TEXT = dedent` color: black; }`; - - let isJumping = false; const Editor = createClass({ From 6dfd44e2f12e3daa5e94c91c25e3f9f4457095f1 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 29 Jan 2025 11:48:18 -0500 Subject: [PATCH 08/22] Allow spaces between `\page` and `{}` Consistent behavior with other curly injections --- client/homebrew/brewRenderer/brewRenderer.jsx | 5 ++--- client/homebrew/editor/editor.jsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 7210a65d0..fd88af403 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -17,10 +17,9 @@ const dedent = require('dedent-tabs').default; const { printCurrentBrew } = require('../../../shared/helpers.js'); import HeaderNav from './headerNav/headerNav.jsx'; - import { safeHTML } from './safeHTML.js'; - +const PAGEBREAK_REGEX_V3 = /^(?=\\page(?: *{[^\n{}]*})?$)/m; const PAGE_HEIGHT = 1056; const INITIAL_CONTENT = dedent` @@ -126,7 +125,7 @@ const BrewRenderer = (props)=>{ if(props.renderer == 'legacy') { rawPages = props.text.split('\\page'); } else { - rawPages = props.text.split(/^(?=\\page(?:{[^\n{}]*})?$)/gm); + rawPages = props.text.split(PAGEBREAK_REGEX_V3); } const handlePageVisibilityChange = (pageNum, isVisible, isCenter)=>{ diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 20cb8968c..2d0a26268 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -12,7 +12,7 @@ const MetadataEditor = require('./metadataEditor/metadataEditor.jsx'); const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME'; -const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:{[^\n{}]*})?$)/m; +const PAGEBREAK_REGEX_V3 = /^(?=\\page(?: *{[^\n{}]*})?$)/m; const SNIPPETBAR_HEIGHT = 25; const DEFAULT_STYLE_TEXT = dedent` /*=======--- Example CSS styling ---=======*/ From d0a06b5cf755472841c039a56659087d77ef82a7 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 29 Jan 2025 12:00:36 -0500 Subject: [PATCH 09/22] Fix class injection --- client/homebrew/brewRenderer/brewRenderer.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index fd88af403..e15cec3bb 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -176,6 +176,7 @@ const BrewRenderer = (props)=>{ ...(!displayOptions.pageShadows ? { boxShadow: 'none' } : {}) // Add more conditions as needed }; + let classes = 'page'; let attributes = {}; if(props.renderer == 'legacy') { @@ -187,8 +188,9 @@ const BrewRenderer = (props)=>{ const firstLineTokens = Markdown.marked.lexer(pageText.split('\n', 1)[0])[0].tokens; const injectedTags = firstLineTokens.find((obj)=>obj.injectedTags !== undefined)?.injectedTags; if(injectedTags) { - styles = { ...styles, ...injectedTags.styles }; - styles = _.mapKeys(styles, (v, k)=>_.camelCase(k)); // Convert CSS to camelCase for React + styles = { ...styles, ...injectedTags.styles }; + styles = _.mapKeys(styles, (v, k)=>_.camelCase(k)); // Convert CSS to camelCase for React + classes = [classes, injectedTags.classes].join(' ').trim(); attributes = injectedTags.attributes; } pageText = pageText.includes('\n') ? pageText.substring(pageText.indexOf('\n') + 1) : ''; // Remove the \page line @@ -197,7 +199,7 @@ const BrewRenderer = (props)=>{ pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear) const html = Markdown.render(pageText, index); - return ; + return ; } }; From 7f4a304f04bc0323bd00bbb6630ec24d5e865cdf Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 29 Jan 2025 12:10:50 -0500 Subject: [PATCH 10/22] Fix custom CSS variables --- client/homebrew/brewRenderer/brewRenderer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index e15cec3bb..a82ea8b34 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -189,7 +189,7 @@ const BrewRenderer = (props)=>{ const injectedTags = firstLineTokens.find((obj)=>obj.injectedTags !== undefined)?.injectedTags; if(injectedTags) { styles = { ...styles, ...injectedTags.styles }; - styles = _.mapKeys(styles, (v, k)=>_.camelCase(k)); // Convert CSS to camelCase for React + styles = _.mapKeys(styles, (v, k) => k.startsWith('--') ? k : _.camelCase(k)); // Convert CSS to camelCase for React classes = [classes, injectedTags.classes].join(' ').trim(); attributes = injectedTags.attributes; } From d8d403ffb8887a27124e736dfae19005a77cd6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 30 Jan 2025 18:54:27 +0100 Subject: [PATCH 11/22] Update to v3.17.0 --- changelog.md | 45 ++++++++++++++++++++++++++++++++++ package-lock.json | 61 ++--------------------------------------------- package.json | 2 +- 3 files changed, 48 insertions(+), 60 deletions(-) diff --git a/changelog.md b/changelog.md index 3736ba9b0..723b5f1b2 100644 --- a/changelog.md +++ b/changelog.md @@ -85,6 +85,51 @@ pre { ## changelog For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). +### Thursday 01/30/2024 - v3.17.0 + +{{tasklist +##### 5e-Cleric + +- Update FAQ +- Fix styling for Vault buttons and checkboxes +- Improve navigation bar styling +- Add author renaming backend functions +- Fix malformed URI error when generating Reddit links +- Refactor User Page's Brew item component +- Refactor Share Page +- Refactor `dialog` notifications (with calculuschild and G-Ambatte) + +##### dbolack + +- Fix page shadows toolbar option - fixes issue [#3919](https://github.com/naturalcrit/homebrewery/issues/3919) +- Add Markdown for non-breaking spaces (` :>>> `) +- Update Docker install instructions - fixes issue [#1930](https://github.com/naturalcrit/homebrewery/issues/1930) +- Fix incorrect state update call - fixes issue [#3974](https://github.com/naturalcrit/homebrewery/issues/3974) +- Allow CSS inject directly in page by doing: `/page{}` - fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) With calculuschild +- Update Ubuntu install instructions - fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) +- Add align paragraph markdown (`:-: text`) + +##### G-Ambatte + +- Correct obsolete tag data - fixes issue [#3927](https://github.com/naturalcrit/homebrewery/issues/3927) +- Stop admin user being added as an author when updating brews via admin tools - fixes issue [#3952](https://github.com/naturalcrit/homebrewery/issues/3952) +- Add steps to refresh Google token to error page - fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) +- Add navigation by header/ID menu + +##### calculuschild + +- Fetch Google brews using user auth instead of service account - fixes issue [#2954](https://github.com/naturalcrit/homebrewery/issues/2954) +- Fix content negotiation middleware and tests - fixes issue [#3904](https://github.com/naturalcrit/homebrewery/issues/3904) +- Add Emojis testing +- Fix `toWellFormed() is not a function` for Win 7 users +- Add `content-visibility` property to decrease reflow time on large brews + +##### Gazook89 + +- Use Intersection Observers to detect on-screen pages - fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) + +}} + ### Wednesday 11/27/2024 - v3.16.1 {{taskList diff --git a/package-lock.json b/package-lock.json index 281c24b1f..1697ccc35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebrewery", - "version": "3.16.1", + "version": "3.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "homebrewery", - "version": "3.16.1", + "version": "3.17.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -3837,16 +3837,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "license": "MIT", - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -6337,13 +6327,6 @@ "node": ">=16.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "license": "MIT", - "optional": true - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -6517,20 +6500,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -10365,13 +10334,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "node_modules/nan": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", - "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", - "license": "MIT", - "optional": true - }, "node_modules/nanoid": { "version": "5.0.9", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz", @@ -14429,25 +14391,6 @@ "node": ">=0.10.0" } }, - "node_modules/watchify/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, "node_modules/watchify/node_modules/glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", diff --git a/package.json b/package.json index 840975977..854f0c2f7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebrewery", "description": "Create authentic looking D&D homebrews using only markdown", - "version": "3.16.1", + "version": "3.17.0", "type": "module", "engines": { "npm": "^10.2.x", From d733b1f8f83b3bc43819ddef90872ae58314d8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 30 Jan 2025 20:02:34 +0100 Subject: [PATCH 12/22] reformat changelog --- changelog.md | 90 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/changelog.md b/changelog.md index 723b5f1b2..c6e712105 100644 --- a/changelog.md +++ b/changelog.md @@ -90,43 +90,83 @@ For a full record of development, visit our [Github Page](https://github.com/nat {{tasklist ##### 5e-Cleric -- Update FAQ -- Fix styling for Vault buttons and checkboxes -- Improve navigation bar styling -- Add author renaming backend functions -- Fix malformed URI error when generating Reddit links -- Refactor User Page's Brew item component -- Refactor Share Page -- Refactor `dialog` notifications (with calculuschild and G-Ambatte) +* [x] Update FAQ + +* [x] Fix styling for Vault buttons and checkboxes + +* [x] Improve navigation bar styling + +* [x] Add author renaming backend functions + +* [x] Fix malformed URI error when generating Reddit links + +* [x] Refactor User Page's Brew item component + +* [x] Refactor Share Page + +* [x] Refactor `dialog` notifications (with calculuschild and G-Ambatte) ##### dbolack -- Fix page shadows toolbar option - fixes issue [#3919](https://github.com/naturalcrit/homebrewery/issues/3919) -- Add Markdown for non-breaking spaces (` :>>> `) -- Update Docker install instructions - fixes issue [#1930](https://github.com/naturalcrit/homebrewery/issues/1930) -- Fix incorrect state update call - fixes issue [#3974](https://github.com/naturalcrit/homebrewery/issues/3974) -- Allow CSS inject directly in page by doing: `/page{}` - fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) With calculuschild -- Update Ubuntu install instructions - fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) -- Add align paragraph markdown (`:-: text`) +* [x] Fix page shadows toolbar option + +Fixes issue [#3919](https://github.com/naturalcrit/homebrewery/issues/3919) + +* [x] Add Markdown for non-breaking spaces (` :>>> `) + +* [x] Update Docker install instructions + +Fixes issue [#1930](https://github.com/naturalcrit/homebrewery/issues/1930) + +* [x] Fix incorrect state update call + +Fixes issue [#3974](https://github.com/naturalcrit/homebrewery/issues/3974) + +* [x] Allow CSS inject directly in page by doing: `/page{}` + +Fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) With calculuschild + +* [x] Update Ubuntu install instructions + +Fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) + +* [x] Add align paragraph markdown (`:-: text`) ##### G-Ambatte -- Correct obsolete tag data - fixes issue [#3927](https://github.com/naturalcrit/homebrewery/issues/3927) -- Stop admin user being added as an author when updating brews via admin tools - fixes issue [#3952](https://github.com/naturalcrit/homebrewery/issues/3952) -- Add steps to refresh Google token to error page - fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) -- Add navigation by header/ID menu +* [x] Correct obsolete tag data + +Fixes issue [#3927](https://github.com/naturalcrit/homebrewery/issues/3927) + +* [x] Stop admin user being added as an author when updating brews via admin tools + +Fixes issue [#3952](https://github.com/naturalcrit/homebrewery/issues/3952) + +* [x] Add steps to refresh Google token to error page + +Fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) + +* [x] Add navigation by header/ID menu ##### calculuschild -- Fetch Google brews using user auth instead of service account - fixes issue [#2954](https://github.com/naturalcrit/homebrewery/issues/2954) -- Fix content negotiation middleware and tests - fixes issue [#3904](https://github.com/naturalcrit/homebrewery/issues/3904) -- Add Emojis testing -- Fix `toWellFormed() is not a function` for Win 7 users -- Add `content-visibility` property to decrease reflow time on large brews +* [x] Fetch Google brews using user auth instead of service account + +Fixes issue [#2954](https://github.com/naturalcrit/homebrewery/issues/2954) + +* [x] Fix content negotiation middleware and tests + +Fixes issue [#3904](https://github.com/naturalcrit/homebrewery/issues/3904) + +* [x] Add Emojis testing + +* [x] Fix `toWellFormed() is not a function` for Win 7 users + +* [x] Add `content-visibility` property to decrease reflow time on large brews ##### Gazook89 -- Use Intersection Observers to detect on-screen pages - fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) +* [x] Use Intersection Observers to detect on-screen pages - fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) }} From f005cb784f2c57119f03f462fde3b7101af8b59b Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 30 Jan 2025 14:18:26 -0500 Subject: [PATCH 13/22] Update changelog.md --- changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index c6e712105..89cb73e41 100644 --- a/changelog.md +++ b/changelog.md @@ -166,7 +166,9 @@ Fixes issue [#3904](https://github.com/naturalcrit/homebrewery/issues/3904) ##### Gazook89 -* [x] Use Intersection Observers to detect on-screen pages - fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) +* [x] Use Intersection Observers to detect on-screen pages + +Fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) }} From e4df577a322a5ed47c13f2f5dae13f292a37c7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 30 Jan 2025 23:33:49 +0100 Subject: [PATCH 14/22] remove internal changes --- changelog.md | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/changelog.md b/changelog.md index c6e712105..facf8d647 100644 --- a/changelog.md +++ b/changelog.md @@ -96,16 +96,10 @@ For a full record of development, visit our [Github Page](https://github.com/nat * [x] Improve navigation bar styling -* [x] Add author renaming backend functions +* [x] Add author renaming feature * [x] Fix malformed URI error when generating Reddit links -* [x] Refactor User Page's Brew item component - -* [x] Refactor Share Page - -* [x] Refactor `dialog` notifications (with calculuschild and G-Ambatte) - ##### dbolack * [x] Fix page shadows toolbar option @@ -118,13 +112,9 @@ Fixes issue [#3919](https://github.com/naturalcrit/homebrewery/issues/3919) Fixes issue [#1930](https://github.com/naturalcrit/homebrewery/issues/1930) -* [x] Fix incorrect state update call +* [x] Allow CSS inject directly in page by doing: `/page{}` (With calculuschild) -Fixes issue [#3974](https://github.com/naturalcrit/homebrewery/issues/3974) - -* [x] Allow CSS inject directly in page by doing: `/page{}` - -Fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) With calculuschild +Fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) * [x] Update Ubuntu install instructions @@ -134,15 +124,11 @@ Fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) ##### G-Ambatte -* [x] Correct obsolete tag data +* [x] Fix crash when opening brew Properties tab Fixes issue [#3927](https://github.com/naturalcrit/homebrewery/issues/3927) -* [x] Stop admin user being added as an author when updating brews via admin tools - -Fixes issue [#3952](https://github.com/naturalcrit/homebrewery/issues/3952) - -* [x] Add steps to refresh Google token to error page +* [x] Show credentials error when oportune Fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) @@ -150,15 +136,7 @@ Fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) ##### calculuschild -* [x] Fetch Google brews using user auth instead of service account - -Fixes issue [#2954](https://github.com/naturalcrit/homebrewery/issues/2954) - -* [x] Fix content negotiation middleware and tests - -Fixes issue [#3904](https://github.com/naturalcrit/homebrewery/issues/3904) - -* [x] Add Emojis testing +* [x] Add CMM and emojis tests * [x] Fix `toWellFormed() is not a function` for Win 7 users From 37d56f736537147f79c797ab2d7aa5f9ae1614c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 30 Jan 2025 23:35:42 +0100 Subject: [PATCH 15/22] compile removed items --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 521ef39a4..926d213ef 100644 --- a/changelog.md +++ b/changelog.md @@ -148,6 +148,10 @@ Fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) Fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) + +##### All +* [x] Update dependencies and scripts +* [x] Refactor components and fix various errors }} ### Wednesday 11/27/2024 - v3.16.1 From 8848c06b15cb4d3d7a80b5867308ee35a3ae1b78 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 30 Jan 2025 22:37:55 -0500 Subject: [PATCH 16/22] Rewording. Add more detailed examples. Add Table width syntax --- changelog.md | 55 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/changelog.md b/changelog.md index 926d213ef..8cfb499f6 100644 --- a/changelog.md +++ b/changelog.md @@ -77,17 +77,20 @@ pre { } .varSyntaxTable th:first-of-type { - width:6cm; + width:6cm; +} + +.page .exampleTable td,th { + border:1px dashed #00000030; } ``` - ## changelog For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). ### Thursday 01/30/2024 - v3.17.0 -{{tasklist +{{taskList ##### 5e-Cleric * [x] Update FAQ @@ -96,9 +99,9 @@ For a full record of development, visit our [Github Page](https://github.com/nat * [x] Improve navigation bar styling -* [x] Add author renaming feature +* [x] Add feature to change username at https://www.naturalcrit.com/account -* [x] Fix malformed URI error when generating Reddit links +* [x] Fix Reddit link crash when title has non-latin chars ##### dbolack @@ -106,13 +109,13 @@ For a full record of development, visit our [Github Page](https://github.com/nat Fixes issue [#3919](https://github.com/naturalcrit/homebrewery/issues/3919) -* [x] Add Markdown for non-breaking spaces (` :>>> `) +* [x] Add `:>>>` syntax for horizontal :>>>>> spaces * [x] Update Docker install instructions Fixes issue [#1930](https://github.com/naturalcrit/homebrewery/issues/1930) -* [x] Allow CSS inject directly in page by doing: `/page{}` (With calculuschild) +* [x] Allow styling pages via `\page{myStyles}` (with calculuschild) Fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) @@ -120,7 +123,24 @@ Fixes issue [#3901](https://github.com/naturalcrit/homebrewery/issues/3901) Fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) -* [x] Add align paragraph markdown (`:-: text`) +* [x] Add `:-:` `:-` `-:` syntax for paragraph alignment, similar to table column alignment; for example: + +-: -: Right-aligned + +:-: :-: Centered + +* [x] Add `:-- 50% --:` syntax to allow setting table column widths by percentage; for example: +``` +| Narrow | Wide | +|:- 10% -:|:-90%--:| +| Cell | Cell | +``` + + +| Narrow | Wide | +|:- 10% -:|:-90%--:| +|Cell | Cell | +{exampleTable} ##### G-Ambatte @@ -128,32 +148,29 @@ Fixes issue [#1952](https://github.com/naturalcrit/homebrewery/issues/1952) Fixes issue [#3927](https://github.com/naturalcrit/homebrewery/issues/3927) -* [x] Show credentials error when oportune +* [x] Update error pages with steps to refresh credentials Fixes issue [#3955](https://github.com/naturalcrit/homebrewery/issues/3955) -* [x] Add navigation by header/ID menu +* [x] Add {{openSans :fas_rectangle_list: **NAVIGATION**}} menu to the viewer toolbar ##### calculuschild -* [x] Add CMM and emojis tests - -* [x] Fix `toWellFormed() is not a function` for Win 7 users - -* [x] Add `content-visibility` property to decrease reflow time on large brews +* [x] Reduce display lag on large brews ##### Gazook89 -* [x] Use Intersection Observers to detect on-screen pages +* [x] Smarter detection of current page number Fixes issue [#3824](https://github.com/naturalcrit/homebrewery/issues/3824) - ##### All * [x] Update dependencies and scripts * [x] Refactor components and fix various errors }} +\column + ### Wednesday 11/27/2024 - v3.16.1 {{taskList @@ -200,6 +217,8 @@ Fixes issue [#3744](https://github.com/naturalcrit/homebrewery/issues/3744) * [x] Multiple code refactors, cleanups, and security fixes }} +\page + ### Saturday 10/12/2024 - v3.16.0 {{taskList @@ -2122,4 +2141,4 @@ Massive changelog incoming: * Added `phb.standalone.css` plus a build system for creating it * Added page numbers and footer text -* Page accent now flips each page +* Page accent now flips each page \ No newline at end of file From 23944f4fe05e0a133fb99d4260db7bae2d4bbd6f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 31 Jan 2025 00:03:44 -0500 Subject: [PATCH 17/22] smartypants package updated to support higher Marked versions Next Marked versions break things; need to update incrementally --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1697ccc35..0889af57e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,11 +34,11 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "11.2.0", + "marked": "12.0.0", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", - "marked-smartypants-lite": "^1.0.2", + "marked-smartypants-lite": "^1.0.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", "mongoose": "^8.9.5", @@ -9788,9 +9788,9 @@ } }, "node_modules/marked": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz", - "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.0.tgz", + "integrity": "sha512-Vkwtq9rLqXryZnWaQc86+FHLC6tr/fycMfYAhiOIXkrNmeGAyhSxjqu0Rs1i0bBqw5u0S7+lV9fdH2ZSVaoa0w==", "license": "MIT", "bin": { "marked": "bin/marked.js" @@ -9828,12 +9828,12 @@ } }, "node_modules/marked-smartypants-lite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/marked-smartypants-lite/-/marked-smartypants-lite-1.0.2.tgz", - "integrity": "sha512-cEANts+s3+gnTzXPvPT2z4V8NfbMEL9QooKUviug0DkaKkXQWrUwDAmFnQAkLSJCw2BQcD8YPDyxu0HJ3mg36w==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/marked-smartypants-lite/-/marked-smartypants-lite-1.0.3.tgz", + "integrity": "sha512-OOL8cjFog8KtgUFpkihRu6G42Dz2QPOU4k2xfKmMJ0CdoX+BHBDmdesHUdoQKM0mlwTsRSU3shpMeM/LWuUokg==", "license": "MIT", "peerDependencies": { - "marked": ">=4 <12" + "marked": ">=4 <16" } }, "node_modules/markedLegacy": { diff --git a/package.json b/package.json index 854f0c2f7..3ad7ac233 100644 --- a/package.json +++ b/package.json @@ -109,11 +109,11 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "11.2.0", + "marked": "12.0.0", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", - "marked-smartypants-lite": "^1.0.2", + "marked-smartypants-lite": "^1.0.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", "mongoose": "^8.9.5", From 4e0b6d634dbc70dce49177c30419c4154df0d16a Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 31 Jan 2025 00:12:13 -0500 Subject: [PATCH 18/22] Marked 12.0.1 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0889af57e..79d4a210a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.0", + "marked": "12.0.1", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", @@ -9788,9 +9788,9 @@ } }, "node_modules/marked": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.0.tgz", - "integrity": "sha512-Vkwtq9rLqXryZnWaQc86+FHLC6tr/fycMfYAhiOIXkrNmeGAyhSxjqu0Rs1i0bBqw5u0S7+lV9fdH2ZSVaoa0w==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.1.tgz", + "integrity": "sha512-Y1/V2yafOcOdWQCX0XpAKXzDakPOpn6U0YLxTJs3cww6VxOzZV1BTOOYWLvH3gX38cq+iLwljHHTnMtlDfg01Q==", "license": "MIT", "bin": { "marked": "bin/marked.js" diff --git a/package.json b/package.json index 3ad7ac233..985435ff6 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.0", + "marked": "12.0.1", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", From b1e99f1385ec8bc4efa744e61405a761953e1e06 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 31 Jan 2025 00:16:37 -0500 Subject: [PATCH 19/22] Marked 12.0.2 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 79d4a210a..8142ef89d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.1", + "marked": "12.0.2", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", @@ -9788,9 +9788,9 @@ } }, "node_modules/marked": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.1.tgz", - "integrity": "sha512-Y1/V2yafOcOdWQCX0XpAKXzDakPOpn6U0YLxTJs3cww6VxOzZV1BTOOYWLvH3gX38cq+iLwljHHTnMtlDfg01Q==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.2.tgz", + "integrity": "sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==", "license": "MIT", "bin": { "marked": "bin/marked.js" diff --git a/package.json b/package.json index 985435ff6..fe77b3e17 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.1", + "marked": "12.0.2", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", "marked-gfm-heading-id": "^3.2.0", From e87acc3f0f66b8bce7c228b9cf07ae3def719528 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 05:17:57 +0000 Subject: [PATCH 20/22] Bump dompurify from 3.2.3 to 3.2.4 Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.2.3 to 3.2.4. - [Release notes](https://github.com/cure53/DOMPurify/releases) - [Commits](https://github.com/cure53/DOMPurify/compare/3.2.3...3.2.4) --- updated-dependencies: - dependency-name: dompurify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8142ef89d..af0d9e14d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", - "dompurify": "^3.2.3", + "dompurify": "^3.2.4", "expr-eval": "^2.0.2", "express": "^4.21.2", "express-async-handler": "^1.2.0", @@ -5313,9 +5313,10 @@ } }, "node_modules/dompurify": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.3.tgz", - "integrity": "sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.4.tgz", + "integrity": "sha512-ysFSFEDVduQpyhzAob/kkuJjf5zWkZD8/A9ywSp1byueyuCfHamrCBa14/Oc2iiB0e51B+NpxSl5gmzn+Ms/mg==", + "license": "(MPL-2.0 OR Apache-2.0)", "optionalDependencies": { "@types/trusted-types": "^2.0.7" } diff --git a/package.json b/package.json index fe77b3e17..2ef557033 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", - "dompurify": "^3.2.3", + "dompurify": "^3.2.4", "expr-eval": "^2.0.2", "express": "^4.21.2", "express-async-handler": "^1.2.0", From 7e826cd4f5629e517af0cd1c44ebd7b5c482ef7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 05:22:30 +0000 Subject: [PATCH 21/22] Bump react-router from 7.1.3 to 7.1.4 Bumps [react-router](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router) from 7.1.3 to 7.1.4. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router@7.1.4/packages/react-router) --- updated-dependencies: - dependency-name: react-router dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index af0d9e14d..3e0e541ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router": "^7.1.3", + "react-router": "^7.1.4", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -11609,9 +11609,10 @@ "license": "MIT" }, "node_modules/react-router": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.3.tgz", - "integrity": "sha512-EezYymLY6Guk/zLQ2vRA8WvdUhWFEj5fcE3RfWihhxXBW7+cd1LsIiA3lmx+KCmneAGQuyBv820o44L2+TtkSA==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.4.tgz", + "integrity": "sha512-aJWVrKoLI0nIK1lfbTU3d5al1ZEUiwtSus/xjYL8K5sv2hyPesiOIojHM7QnaNLVtroOB1McZsWk37fMQVoc6A==", + "license": "MIT", "dependencies": { "@types/cookie": "^0.6.0", "cookie": "^1.0.1", diff --git a/package.json b/package.json index 2ef557033..0598cdbd8 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router": "^7.1.3", + "react-router": "^7.1.4", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From 6269651c8dc0b8e25f25c9b139e9ebbd66c815d1 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 31 Jan 2025 12:42:54 -0500 Subject: [PATCH 22/22] Update Marked to v13.0.3 --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e0e541ff..643d1f0e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,10 +34,10 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.2", + "marked": "13.0.3", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", - "marked-gfm-heading-id": "^3.2.0", + "marked-gfm-heading-id": "^4.0.1", "marked-smartypants-lite": "^1.0.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", @@ -9789,9 +9789,9 @@ } }, "node_modules/marked": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.2.tgz", - "integrity": "sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==", + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-13.0.3.tgz", + "integrity": "sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA==", "license": "MIT", "bin": { "marked": "bin/marked.js" @@ -9817,15 +9817,15 @@ } }, "node_modules/marked-gfm-heading-id": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.2.0.tgz", - "integrity": "sha512-Xfxpr5lXLDLY10XqzSCA9l2dDaiabQUgtYM9hw8yunyVsB/xYBRpiic6BOiY/EAJw1ik1eWr1ET1HKOAPZBhXg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-4.1.1.tgz", + "integrity": "sha512-EeQZieAQmsI6c2tWLx0ETd0VjPwLV8qi+HT0dIsfVMERm0rCIuXfRvZXJbo1SgUi++lmuR1LVY+QzgNiLNvVpw==", "license": "MIT", "dependencies": { "github-slugger": "^2.0.0" }, "peerDependencies": { - "marked": ">=4 <13" + "marked": ">=13 <16" } }, "node_modules/marked-smartypants-lite": { diff --git a/package.json b/package.json index 0598cdbd8..cd43bb5e2 100644 --- a/package.json +++ b/package.json @@ -109,10 +109,10 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "12.0.2", + "marked": "13.0.3", "marked-emoji": "^1.4.3", "marked-extended-tables": "^1.1.0", - "marked-gfm-heading-id": "^3.2.0", + "marked-gfm-heading-id": "^4.0.1", "marked-smartypants-lite": "^1.0.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1",