From 87aade6243b47539cd7748e2c63068e6c27eaa87 Mon Sep 17 00:00:00 2001 From: SansGuidon Date: Thu, 21 Aug 2025 13:03:02 +0000 Subject: [PATCH] feat: style auto-summary blocks with Mistral result formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detects "--- RÉSUMÉ AUTO ---" blocks and applies green styling consistent with existing Mistral script results --- miniflux_scripts/auto-summary-styler.js | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 miniflux_scripts/auto-summary-styler.js diff --git a/miniflux_scripts/auto-summary-styler.js b/miniflux_scripts/auto-summary-styler.js new file mode 100644 index 0000000..f19f6eb --- /dev/null +++ b/miniflux_scripts/auto-summary-styler.js @@ -0,0 +1,65 @@ +(function() { + 'use strict'; + + // Only run on entry pages + if (!window.location.href.match(/\/entry\//)) return; + + function styleAutoSummaries() { + const content = document.querySelector('.entry-content'); + if (!content) return; + + // Find text nodes containing "--- RÉSUMÉ AUTO ---" + const walker = document.createTreeWalker( + content, + NodeFilter.SHOW_TEXT, + null, + false + ); + + let node; + while (node = walker.nextNode()) { + const text = node.nodeValue; + if (text.includes('--- RÉSUMÉ AUTO ---')) { + // Find the paragraph or container + let container = node.parentElement; + while (container && !['P', 'DIV', 'ARTICLE'].includes(container.tagName)) { + container = container.parentElement; + } + + if (container) { + // Apply the same styling as Mistral results + Object.assign(container.style, { + margin: '12px 0', + padding: '10px', + background: 'rgb(51 85 67)', + borderLeft: '3px solid rgb(71 180 103)', + fontFamily: 'Geist Mono', + whiteSpace: 'pre-wrap' + }); + + // Add header + const header = document.createElement('div'); + header.textContent = 'RÉSUMÉ AUTO'; + Object.assign(header.style, { + fontWeight: 'bold', + marginBottom: '8px', + color: 'rgb(71 180 103)', + fontSize: '0.9em' + }); + + container.insertBefore(header, container.firstChild); + + // Clean up the content text + container.innerHTML = container.innerHTML.replace(/--- RÉSUMÉ AUTO ---/g, ''); + } + } + } + } + + // Run when page loads + if (document.readyState === 'complete') { + styleAutoSummaries(); + } else { + window.addEventListener('load', styleAutoSummaries); + } +})(); \ No newline at end of file