I did now the following:
STEP 1
In order to text a code block, I manually created the code block throug typing the ``` and inserting a code snippet, including an intentional white line in the code snippet:
STEP 2
When exporting that, I see in the export file:
STEP 3
I Ctrl-V paste that directly in the Description field (without manually creating a code block) which shows as:
STEP 4
After exporting the entity as Markdown, the export file shows:
CONCLUSIONS:
During step 3, the pasting of the correct markdown into the Description field results in intentional empty lines in the code snippet to be DELETED.
This is confirmed by the second export in step 4, which shows that the empty line is also deleted, but also extra white lines are added. This is basically data corruption/loss.
So I guess this is a bug?
Anyhow, the script that removes the escape backslashes actually works correctly but returns something that happened before the script, which was what the ProseMirror editor modified about the pasted text. So the problem can only be fixed by fixing this bug in how ProseMirror handles pasted text.