WikiDocs icon indicating copy to clipboard operation
WikiDocs copied to clipboard

Wikidocs change line blocks and code blocks

Open ffiesta opened this issue 5 months ago • 0 comments

Describe your issue

After using WikiDocs for a while, I noticed that Wikidocs on sometimes on edit/save change code inside line block and code blocks.

Device and settings

Windows 10

Steps to reproduce

1. Clean WikiDocs Installation

Image: WikiDocs clean installation

Image

2. Backslash Error

# Call the function to create a backup  
create_backup  

LOG_FILE="$backup_file"  

# Add logo to log  
echo "                  _______    _______  " >> $LOG_FILE  
echo "       (\        (  ___  )  (  ____ \ " >> $LOG_FILE  
echo "       | )       | (   ) |  | (   _\/ " >> $LOG_FILE  
echo "       | |       | |   | |  | (_____  " >> $LOG_FILE  
echo "       | |       | |   | |  |  ___  \ " >> $LOG_FILE  
echo "       | |       | |   | |  | (   ) | " >> $LOG_FILE  
echo "       | (____   | (___) |  | (___) | " >> $LOG_FILE  
echo "       (______)  (_______)  (_______) bY aaa " >> $LOG_FILE  
echo "" >> $LOG_FILE  
echo "[$(date +"%Y-%m-%d %H:%M:%S")]" >> $LOG_FILE  

sleep 1  
read -p "Log file $LOG_FILE created successfully! Press Enter to continue..."  

Image before saving

Image

Image after saving (browser view)

Image

Image after saving (content.md file)

Image

WikiDocs converts \ to \textbackslash on the first save inside code blocks.


3. HTML Entity Issues

**Entity: ⚠ **

  1. HTML Entity in code block:
if (file_exists('error_log')) {echo " ⚠" ;}  
  1. HTML Entity inline:
    if (file_exists('error_log')) {echo " ⚠" ;}

**Entity: ⚠ **`

  1. HTML Entity in code block:
if (file_exists('error_log')) {echo " ⚠" ;}  
  1. HTML Entity inline:
    if (file_exists('error_log')) {echo " ⚠" ;}

Image before saving (entities)

Image

Image after saving (entities)

Image

Image on first edit (browser view)

Image

Image during first edit (content.md)

Image

Image after second save (browser view)

Image

Image after second save (content.md)

Image

After the first edit (second save), WikiDocs converts HTML entities into their corresponding symbols (emojis) inside code blocks and inline code.


4. Textarea Issue

Image before saving (textarea)

Image

Image after saving (browser view)

Image

Image after saving (content.md)

Image

Image first edit (browser view)

Image

Image after first edit save

Image

After the first edit (second save), WikiDocs removes everything after textarea.

  • This error occasionally occurs with HTML hrefs as well.

Conclusion

Based on my analysis:

  • The backslash error (\ → \textbackslash) was introduced in version 65 (XSS implementation).
  • All other errors existed before version 64.

I tested with EasyMDE 2.20.0, but the issues persisted.

I’ll try to replicate the issue in WikiDocs v1, but since my programming knowledge is limited, I might not find the root cause. However, code inside blocks or inline should never be modified by the system.

I suppose the The content is modified due to:

  • Sanitization
  • htmlspecialchars()
  • Multiple HTML entity processing
  • Parser issues
  • XSS protection

Screenshots (optional)

No response

Extra fields

  • [ ] I'd like to work on this issue

ffiesta avatar Aug 01 '25 00:08 ffiesta