if done then strike out text
- User
if done then strike out text
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
if done then strike out text
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is one tidy update that gives you automatic strike-through when a task is marked “Done”, both on first render and whenever the checkbox is toggled.
––––––––––––––––– 1 Add a tiny CSS helper –––––––––––––––––
/* put this near the bottom of your style sheet */
.done-task {
text-decoration: line-through;
opacity: .55; /* optional – faint it a little */
}
––––––––––––––––– 2 Tweak renderTables() –––––––––––––––––
function renderTables() {
tablesContainer.innerHTML = '';
tables.forEach(table => {
const tableContainer = document.createElement('div');
tableContainer.className = 'table-container';
/* HEADER ---------------------------------------------------- */
const tableHeader = document.createElement('div');
tableHeader.className = 'table-header';
const tableTitle = document.createElement('h2');
tableTitle.textContent = table.title;
const copyBtn = document.createElement('button');
copyBtn.className = 'copy-btn';
copyBtn.textContent = 'Copy as Markdown';
copyBtn.addEventListener('click', () => copyTableAsMarkdown(table));
tableHeader.appendChild(tableTitle);
tableHeader.appendChild(copyBtn);
tableContainer.appendChild(tableHeader);
/* TABLE ----------------------------------------------------- */
const tableElement = document.createElement('table');
/* – thead – */
const thead = document.createElement('thead');
const headerRow = document.createElement('tr');
table.headers.forEach(header => {
const th = document.createElement('th');
th.textContent = header;
if (header.toLowerCase() === 'done') th.style.width = '60px';
headerRow.appendChild(th);
});
thead.appendChild(headerRow);
tableElement.appendChild(thead);
/* – tbody – */
const tbody = document.createElement('tbody');
table.rows.forEach(rowArr => {
const tr = document.createElement('tr');
let taskCell; // keep reference for strike-through
rowArr.forEach((cell, index) => {
const td = document.createElement('td');
if (index === 0) { // TASK column
td.className = 'task-cell';
td.style.whiteSpace = 'pre-wrap';
td.style.wordBreak = 'break-word';
td.textContent = cell;
taskCell = td; // save ref
}
else if (index === 1 && (cell === '[x]' || cell === '[ ]')) {
/* DONE column – checkbox */
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = 'checkbox';
checkbox.checked = cell === '[x]';
td.appendChild(checkbox);
td.style.textAlign = 'center';
/* strike-through toggle */
if (checkbox.checked) taskCell.classList.add('done-task');
checkbox.addEventListener('change', e => {
rowArr[index] = e.target.checked ? '[x]' : '[ ]';
taskCell.classList.toggle('done-task', e.target.checked);
updateTables(); // or whatever persistence you use
});
}
else {
td.textContent = cell;
}
tr.appendChild(td);
});
tbody.appendChild(tr);
});
tableElement.appendChild(tbody);
tableContainer.appendChild(tableElement);
/* ADD-ROW --------------------------------------------------- */
const addRowForm = document.createElement('div');
addRowForm.className = 'add-row';
const taskInput = document.createElement('input');
taskInput.type = 'text';
taskInput.placeholder = 'New task name…';
const addBtn = document.createElement('button');
addBtn.textContent = '+ ADD';
addBtn.addEventListener('click', () => {
const val = taskInput.value.trim();
if (val) {
addRow(table.title, val); // your existing helper
taskInput.value = '';
}
});
addRowForm.appendChild(taskInput);
addRowForm.appendChild(addBtn);
tableContainer.appendChild(addRowForm);
tablesContainer.appendChild(tableContainer);
});
}
What changed?
• The very first (task) cell is stored in taskCell.
• When a row is first rendered we look at checkbox.checked and, if true, immediately apply taskCell.classList.add('done-task').
• When the checkbox changes we toggle the same class and also keep your [x] / [ ] data in sync.
That’s all you need—now every completed task is neatly struck out.