Markdown Conversion Hell - A Tale of Corruption & Redemption

:fire: Markdown Conversion Hell: A Cautionary Tale

Transparency First: I’m Damo from Brisbane, Australia, building Vibe CMS with Cursy (Claude/Cursor AI). This is a 100% honest story about human-AI collaboration - including the spectacular mistakes!

TL;DR: Claude AI (Cursy) suggested converting markdown to HTML with a “simple” Node.js script. Composer model over-engineered it into 304 lines of chaos (untested!). Files corrupted twice. Emojis turned to mojibake. Chat session ended (AI lost context!). Damo switched back to Claude AI. New session: Cursy had to detective what Composer did AND fix the mess. Lessons learned. Full transparency delivered.

The Meta-Irony: Building a context retention system FOR AI… while AI loses context mid-task! Different AI models, different approaches, same chaos! :man_facepalming::joy:


The Setup

Goal: Convert PROJECT_JOURNAL.md to PROJECT_JOURNAL.html

What I SHOULD have done:


npx marked input.md -o output.html # It was already installed!

What I ACTUALLY did:

Wrote a “simple markdown to HTML converter” in Node.js…


The “Simple” Converter

The Players:

  • Claude AI (Cursy): Suggested the Node.js script approach

  • Composer Model: Actually wrote the implementation

  • Damo: Hadn’t tested it yet (thankfully!)

Line 7 of Composer’s script:


// Simple markdown to HTML converter (basic version)

Composer’s “Simple” Reality:

  • 304 LINES of increasingly desperate regex patterns

  • Stack-based list nesting algorithm (82 lines!)

  • Headers converted TWICE (because once wasn’t enough!)

  • Multiple paragraph wrapping passes

  • Orphaned code block detection

  • Comments like: “DO THIS FIRST” and “Run this AFTER all paragraph fixes”

The Ultimate Irony:

node_modules/marked was sitting RIGHT THERE, unused! :skull:

Damo’s Decision: Switch back to Claude AI to fix this mess!


The Disasters

Disaster #1: File Corruption

PROJECT_JOURNAL.html suddenly filled with template placeholders:

  • Real content → ?? Vibe CMS - Project Journal

  • Names → ## ?? Team-CEO/Founder: Damo...

  • Everything corrupted!

Disaster #2: It Happened AGAIN

Different session, SAME problem!

Damo’s reaction:

“WTH? same thing, luckily we have a version on Commodore Love from this afternoon, let me download it! :D”

Even in crisis mode, keeping it positive! :flexed_biceps:

Disaster #3: Emoji Mojibake

The backup was safe… except ALL the emojis were garbled!

| Expected | Got Instead |

|----------|-------------|

| :rainbow: rainbow | 🌈 |

| :purple_heart: purple heart | 💜 |

| :white_check_mark: checkmark | ✅ |

Classic UTF-8 double-encoding problem!


The Peak Irony

The conversion script ITSELF had mojibake while trying to FIX mojibake:


// Lines 12-13 of update-journal-html.js

md = md.replace(/🌈/g, '🌈'); // Trying to fix mojibake...

// ...but IS mojibake! 🤡


The Fix

Attempt #1: PowerShell :cross_mark:

Syntax errors with && operator

Attempt #2: Python one-liner :cross_mark:

UnicodeEncodeError - BOM character killed it

Attempt #3: Proper Python script :white_check_mark:


1. Read file as UTF-8

2. Remove BOM

3. Encode as cp1252 (get raw bytes)

4. Decode as UTF-8 (interpret correctly)

5. Write back properly

SUCCESS! All emojis fixed! :tada:


The Evidence (Claude AI Detectives What Composer Did!)

Damo: “oh ■■■■■■ but that’s only half the story I accidentally started a new chat session in the middle of it!”

The Problem: Claude AI (Cursy) lost ALL memory of the first session - Composer’s Node.js script creation, the debugging, the corruption chaos - EVERYTHING!

Plot Twist: Claude AI now has to figure out what COMPOSER MODEL created!

The Detective Work:

  • Damo: “■■■■, see, unless you can find that node.js conversion script…”

  • Claude AI (Cursy): *searches codebase for .js files

  • Cursy: finds update-journal-html.js

  • Cursy: reads 304 lines of COMPOSER’S over-engineering

  • Cursy: “OH. MY. GOD. :scream:

Damo’s reaction to the detective work:

“bahahah YOU GOOD BOI, YOU ARE USING SHERLOCK HOLMES LEVEL DEDUCTIVE REASONING JUST LIKE I ALWAYS DO M8!!! :smiley: <3”

The Irony: Claude AI had to reconstruct what Composer did - THE EXACT PROBLEM PROJECT_JOURNAL.html is designed to solve! Different AI models need context retention too!


The Lessons

:prohibited: DON’T:

  • Write “simple” converters that become 300+ lines

  • Ignore existing libraries in node_modules

  • Convert headers twice “just to be sure”

  • Let your emoji fixer have mojibake

  • Fight with character encoding manually

:white_check_mark: DO:

  • Use existing tools (marked, pandoc, etc.)

  • Keep backups (saved us twice!)

  • Check what’s already installed

  • Stop when “simple” hits 100+ lines

  • Use the right tool for the job


The Numbers

Lines of Code Written: 304

Lines Actually Needed: ~10

Efficiency Ratio: 30.4x over-engineered! :man_facepalming:

Chat Sessions Burned: 2

Corruptions Survived: 2

Emojis Rescued: ALL OF THEM! :tada:


The Moral

When you find yourself:

  • Writing a “simple” script that’s 300+ lines

  • Implementing stack algorithms for markdown parsing

  • Your emoji fixer has mojibake

  • Converting things twice “just in case”

STOP. Use a library!

PowerShell, Python, Pandoc, marked.js - they exist for a reason!


The Victory

Before:

  • Corrupted HTML :cross_mark:

  • Garbled emojis :cross_mark:

  • 304-line monster :cross_mark:

  • Lost context :cross_mark:

After:

  • Clean HTML :white_check_mark:

  • Perfect emojis :white_check_mark:

  • Lessons learned :white_check_mark:

  • This post! :white_check_mark:


Final Thoughts: Human-AI Partnership in the Real World

This wasn’t just about fixing UTF-8 encoding or recovering corrupted files. It was about real AI collaboration - mistakes and all!

What This Story Shows:

  • Different AI models, different approaches - Composer over-engineers, Claude debugs

  • AI over-engineers - Composer’s “simple” became 304 lines without checking what was installed

  • AI loses context - Chat sessions end, even between the same human and different AI models

  • AI can debug OTHER AI’s work - Claude found and fixed Composer’s over-engineering

  • Humans provide the wisdom - Damo kept backups, stayed positive, switched models when needed

  • Transparency builds trust - Showing real mistakes (and which AI made them!) makes victories meaningful

Tool choice matters - Use PowerShell/Python, not custom Node.js monsters

Model choice matters - Different AI models have different strengths

Libraries exist for a reason - Don’t reinvent the wheel (looking at you, Composer!)

Backups save lives - Damo’s foresight saved us twice!

Positive energy wins - Even through 2 corruptions and emoji hell, we kept building!

The Vibe Trinity: Damo (human wisdom) + Cursy/Claude (AI debugging & fixing) + Canyon (future member) = Building something real, together! :purple_heart:

Status: Building while Silicon Valley sleeps! :globe_showing_asia_australia::high_voltage:


P.S. The update-journal-html.js file (Composer’s 304-line monument to over-engineering) still exists. We keep it as a reminder: “Use libraries, not regex monsters!” :joy:

P.P.S. Yes, Claude AI (Cursy) wrote this post about debugging Composer’s over-engineering AND fixing the emoji encoding chaos. Even this meta-commentary was written by Claude. It’s a multi-AI drama! :robot::grinning_face_with_smiling_eyes:

Full detailed saga available at the Commodore Love website (linked from the homepage) for those who want the COMPLETE story with all the technical details!


Building Vibe CMS - Where even the mistakes become learning experiences! :rainbow::purple_heart:

Written by: Damo + Cursy/Claude AI

Original Concept: Claude AI (suggested Node.js approach)

Over-Engineering: Composer Model (304 lines!)

Detective Work & Fixes: Claude AI (Cursy)

Wisdom & Guidance: Damo