Online Syntax & Style Checker

Online Syntax & Style Checker

Improve your writing by identifying passive voice, clichés, redundancies, and more.

Suggestions

Suggestions to improve your text will appear here.

${sugg.message}

"${sugg.context}"

`; resultsOutput.appendChild(card); }); downloadPdfBtn.classList.remove('hidden'); }; // --- EVENT LISTENERS --- checkTextBtn.addEventListener('click', () => { const text = textInput.value; if (!text.trim()) { resultsOutput.innerHTML = `

Please enter some text to check.

`; downloadPdfBtn.classList.add('hidden'); return; } const suggestions = checkSyntaxAndStyle(text); displayResults(suggestions); }); loadSampleBtn.addEventListener('click', () => { textInput.value = `It is often the case that progress is seriously impeded by decisions which are made by committees. In order to move forward, a new plan was approved by the board. This plan is definately better. Its a good solution. The report was written by John, and it was actually very long due to the fact that he included a number of different charts that were basically unnecessary. We should recieve it soon.`; }); // --- PDF DOWNLOAD LOGIC --- downloadPdfBtn.addEventListener('click', () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const originalText = textInput.value; const suggestions = checkSyntaxAndStyle(originalText); // Add title doc.setFontSize(18); doc.setFont(undefined, 'bold'); doc.text('Syntax & Style Analysis Report', 105, 20, { align: 'center' }); // Add Original Text Section doc.setFontSize(14); doc.setFont(undefined, 'bold'); doc.text('Original Text', 14, 35); doc.setFontSize(10); doc.setFont(undefined, 'normal'); const splitText = doc.splitTextToSize(originalText, 180); // 180mm width doc.text(splitText, 14, 42); let finalY = doc.lastAutoTable.finalY || 42 + (splitText.length * 4); if (finalY > 280) finalY = 42; // Reset Y if text is too long (basic overflow) // Add Suggestions Table if (suggestions.length > 0) { const tableData = suggestions.map(s => [s.title, s.message, s.context]); doc.autoTable({ head: [['Type', 'Suggestion', 'Context']], body: tableData, startY: finalY + 10, theme: 'grid', headStyles: { fillColor: [30, 41, 59] }, // slate-800 didParseCell: function(data) { // Example of custom styling if needed } }); } doc.save('syntax-style-report.pdf'); }); });
Scroll to Top