fix: inline FAQ markdown rendering and add inst_040

## Bug Fixes
- Fixed inline FAQ markdown rendering with error handling
- Added try-catch around marked.parse() for inline FAQs
- Added fallback to plain text with line breaks on parse failure
- Enhanced logging for FAQ rendering diagnostics

## New Instruction (inst_040)
Created rule requiring complete coverage when user says "all":
- "update all pages" means EVERY page, not representative subset
- Must identify complete scope before starting
- Verify ALL items processed before marking complete
- Ask user to prioritize if scope >20 items

## Rationale
User reported inline FAQs showing raw markdown instead of formatted HTML.
Root cause: createInlineFAQItemHTML lacked error handling that was added
to createFAQItemHTML in previous version. Both functions now have consistent
error handling with logging.

User directive: When saying "all", Claude must not choose subset.

## Version
- Bumped to 1.0.5
- Force update enabled
- Synced inst_040 to production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TheFlow 2025-10-14 12:51:08 +13:00
parent 720594199e
commit be59c6dd52
4 changed files with 26 additions and 11 deletions

View file

@ -655,7 +655,7 @@
<!-- Version Management & PWA -->
<script src="/js/version-manager.js"></script>
<script src="/js/faq.js?v=1760427000"></script>
<script src="/js/faq.js?v=1760430000"></script>
</body>
</html>

View file

@ -2918,11 +2918,16 @@ function setupModalListeners() {
*/
function renderInlineFAQs() {
const container = document.getElementById('inline-faq-container');
if (!container) return;
if (!container) {
console.error('[FAQ] inline-faq-container not found');
return;
}
// Get top 6 most important FAQs (mix of all audiences)
const topFAQs = FAQ_DATA.filter(faq => [19, 12, 27, 13, 1, 2].includes(faq.id));
console.log(`[FAQ] Rendering ${topFAQs.length} inline FAQs (marked available: ${typeof marked !== 'undefined'})`);
// Sort by ID to maintain order
const sorted = topFAQs.sort((a, b) => a.id - b.id);
@ -2977,7 +2982,17 @@ function createInlineFAQItemHTML(faq) {
// Parse markdown answer
let answerHtml = faq.answer;
if (typeof marked !== 'undefined') {
answerHtml = marked.parse(faq.answer);
try {
answerHtml = marked.parse(faq.answer);
} catch (error) {
console.error('[FAQ] Inline markdown parsing failed for FAQ', faq.id, error);
// Fallback to plain text with line breaks
answerHtml = `<p>${faq.answer.replace(/\n\n/g, '</p><p>').replace(/\n/g, '<br>')}</p>`;
}
} else {
console.warn('[FAQ] marked.js not loaded for inline FAQs - using plain text');
// Fallback to plain text with line breaks
answerHtml = `<p>${faq.answer.replace(/\n\n/g, '</p><p>').replace(/\n/g, '<br>')}</p>`;
}
return `

View file

@ -5,7 +5,7 @@
* - PWA functionality
*/
const CACHE_VERSION = '1.0.4';
const CACHE_VERSION = '1.0.5';
const CACHE_NAME = `tractatus-v${CACHE_VERSION}`;
const VERSION_CHECK_INTERVAL = 3600000; // 1 hour in milliseconds

View file

@ -1,12 +1,12 @@
{
"version": "1.0.4",
"buildDate": "2025-10-14T13:00:00Z",
"version": "1.0.5",
"buildDate": "2025-10-14T13:15:00Z",
"changelog": [
"Fixed modal scrolling - changed to h-[85vh] with min-h-0 for proper flex scroll",
"Removed Quick Actions section from FAQ page",
"Standardized footer across all pages with newsletter link",
"Enhanced markdown parsing with error handling"
"Fixed inline FAQ markdown rendering with error handling",
"Added logging for FAQ rendering diagnostics",
"Enhanced markdown fallback for both modal and inline FAQs",
"Created inst_040: 'all' keyword requires complete coverage"
],
"forceUpdate": true,
"minVersion": "1.0.4"
"minVersion": "1.0.5"
}