Files
WooNooW/TEMPLATE_UPDATE_SCRIPT.md
dwindown 4471cd600f feat: Complete markdown syntax refinement and variable protection
 New cleaner syntax implemented:
- [card:type] instead of [card type='type']
- [button:style](url)Text[/button] instead of [button url='...' style='...']
- Standard markdown images: ![alt](url)

 Variable protection from markdown parsing:
- Variables with underscores (e.g., {order_items_table}) now protected
- HTML comment placeholders prevent italic/bold parsing
- All variables render correctly in preview

 Button rendering fixes:
- Buttons work in Visual mode inside cards
- Buttons work in Preview mode
- Button clicks prevented in visual editor
- Proper styling for solid and outline buttons

 Backward compatibility:
- Old syntax still supported
- No breaking changes

 Bug fixes:
- Fixed order_item_table → order_items_table naming
- Fixed button regex to match across newlines
- Added button/image parsing to parseMarkdownBasics
- Prevented button clicks on .button and .button-outline classes

📚 Documentation:
- NEW_MARKDOWN_SYNTAX.md - Complete user guide
- MARKDOWN_SYNTAX_AND_VARIABLES.md - Technical analysis
2025-11-15 20:05:50 +07:00

3.6 KiB

Template Update Script

Changes to Make in DefaultTemplates.php

For ALL templates, replace the footer pattern:

Pattern to Find:

---

[Any text with {support_email} or similar]
© {current_year} {site_name}

Replace With:

[card type="basic"]

[Same text with {support_email}]

[/card]

Remove:

  • All instances of © {current_year} {site_name} (already in global footer)
  • All instances of standalone --- before footer text

Specific Updates:

Customer Templates:

  1. customer_order_placed (line 138-141):
// OLD:
---

Need help? Contact us: {support_email}
© {current_year} {site_name}';

// NEW:
[card type="basic"]

Need help? Contact us: {support_email}

[/card]';
  1. customer_order_confirmed (line 180-183):
// OLD:
---

Questions? We\'re here to help: {support_email}
© {current_year} {site_name}';

// NEW:
[card type="basic"]

Questions? We\'re here to help: {support_email}

[/card]';
  1. customer_order_shipped (line 222-225):
// OLD:
---

Need assistance? Contact {support_email}
© {current_year} {site_name}';

// NEW:
[card type="basic"]

Need assistance? Contact {support_email}

[/card]';
  1. customer_order_completed (line 262-267):
// OLD:
---

Questions or issues with your order? We\'re here to help.
{support_email}

© {current_year} {site_name}';

// NEW:
[card type="basic"]

Questions or issues with your order? We\'re here to help.

Contact: {support_email}

[/card]';
  1. customer_order_cancelled (line 309-311):
// OLD:
---

© {current_year} {site_name}';

// NEW:
';
// (Just remove the footer entirely - no support text here)
  1. customer_payment_received (line 349-351):
// OLD:
---

© {current_year} {site_name}';

// NEW:
';
// (Just remove)
  1. customer_payment_failed (line 398-400):
// OLD:
---

© {current_year} {site_name}';

// NEW:
';
// (Already has support text in card, just remove footer)
  1. customer_registered (line 436-439):
// OLD:
---

Need help? Contact {support_email}
© {current_year} {site_name}';

// NEW:
[card type="basic"]

Need help? Contact {support_email}

[/card]';
  1. customer_vip_upgraded (line 473-476):
// OLD:
---

Questions? {support_email}
© {current_year} {site_name}';

// NEW:
[card type="basic"]

Questions? {support_email}

[/card]';

Staff Templates:

  1. staff_order_placed (line 535-538):
// OLD:
---

WooNooW Order Management
© {current_year} {site_name}';

// NEW:
';
// (Remove - staff doesn't need this footer)
  1. staff_order_confirmed (line 582-585):
// OLD:
---

WooNooW Order Management
© {current_year} {site_name}';

// NEW:
';
  1. staff_order_shipped (line 618-621):
// OLD:
---

WooNooW Order Management
© {current_year} {site_name}';

// NEW:
';
  1. staff_order_completed (line 664-667):
// OLD:
---

WooNooW Order Management
© {current_year} {site_name}';

// NEW:
';
  1. staff_order_cancelled (line 716-719):
// OLD:
---

WooNooW Order Management
© {current_year} {site_name}';

// NEW:
';
  1. staff_payment_received (line 763-766):
// OLD:
---

WooNooW Payment Management
© {current_year} {site_name}';

// NEW:
';
  1. staff_payment_failed (line 809-812):
// OLD:
---

WooNooW Payment Management
© {current_year} {site_name}';

// NEW:
';

Summary:

  • Customer templates: Wrap support text in [card type="basic"], remove copyright
  • Staff templates: Remove footer entirely (they don't need support contact)
  • All templates: Remove © {current_year} {site_name} (handled by global footer)