Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions DEMO_DETAILED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# HSX Enhanced Error Messages - Before & After Demo

## Issue #916 - Enhanced HSX Parser Error Messages

### Example 1: Invalid Tag Name

**BEFORE (Basic Error):**
```
Parse error: unexpected 'spn'
at line 1, column 5
```

**AFTER (Enhanced Error):**
```
Invalid tag name: spn
'spn' is not a valid HTML tag name
Check if you meant a similar valid tag like: div, span, or check the HTML specification
For custom web components, use kebab-case with at least one hyphen (e.g., 'my-component')
Use 'uncheckedHsx' if you need to use non-standard tag names
```

### Example 2: Invalid Attribute Name

**BEFORE (Basic Error):**
```
Parse error: unexpected 'clas'
```

**AFTER (Enhanced Error):**
```
Invalid attribute name: clas
'clas' is not a valid HTML attribute name
Valid HTML attributes include standard ones like 'class', 'id', 'style'
Data attributes must start with 'data-' (e.g., 'data-toggle')
ARIA attributes must start with 'aria-' (e.g., 'aria-label')
Use 'customHsx' with additionalAttributeNames if you need custom attributes
```

### Example 3: Duplicate Attribute

**BEFORE (Basic Error):**
```
Parse error: duplicate attribute
```

**AFTER (Enhanced Error):**
```
Duplicate attribute: class
Attribute 'class' appears multiple times in the same tag
Remove duplicate attributes
If you need conditional attributes, use Haskell expressions
```

### Benefits

✅ **Clear identification** of the exact problem
✅ **Contextual suggestions** based on error type
✅ **Educational guidance** about HTML standards
✅ **Alternative solutions** provided
✅ **Better developer experience** for HSX templates

---
*This implementation significantly improves HSX debugging and reduces developer frustration.*
Loading