mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-09 20:51:22 +00:00
3aafe60463
The previous fix used a simple regex to strip HTML tags for newspic content, but it had several issues: 1. HTML entities ( , <, >, &, etc.) were not decoded 2. Block-level tags (</p>, </div>, </h1> etc.) did not produce line breaks 3. Multiple consecutive whitespace characters were not collapsed This commit introduces a dedicated htmlToPlainText() function that: - Converts <br> and block-level closing tags to line breaks - Strips all remaining HTML tags - Decodes common HTML entities (including numeric entities) - Collapses consecutive whitespace into single spaces - Trims whitespace from each line This ensures the content field for newspic articles is properly formatted plain text that complies with WeChat API requirements, preventing error 45166 (invalid content) especially when publishing with multiple images. Closes #163 Merges #164