diff --git a/packages/app-cli/tests/enex_to_md/code5.html b/packages/app-cli/tests/enex_to_md/code5.html
new file mode 100644
index 000000000..3d6d0f5d6
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_md/code5.html
@@ -0,0 +1 @@
+
public class SwapIntegerWithoutTemp {
public void swapAddition() {
int a = 3;
int b = 5;
a = a + b; // a=8, b=5
b = a - b; // a=8, b=3
a = a - b; // a=5, b=3
}
}
\ No newline at end of file
diff --git a/packages/app-cli/tests/enex_to_md/code5.md b/packages/app-cli/tests/enex_to_md/code5.md
new file mode 100644
index 000000000..a5dbcb99a
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_md/code5.md
@@ -0,0 +1,13 @@
+```
+public class SwapIntegerWithoutTemp {
+
+ public void swapAddition() {
+ int a = 3;
+ int b = 5;
+
+ a = a + b; // a=8, b=5
+ b = a - b; // a=8, b=3
+ a = a - b; // a=5, b=3
+ }
+}
+```
\ No newline at end of file
diff --git a/packages/lib/import-enex-md-gen.ts b/packages/lib/import-enex-md-gen.ts
index 78d1098b5..49bddf2c6 100644
--- a/packages/lib/import-enex-md-gen.ts
+++ b/packages/lib/import-enex-md-gen.ts
@@ -503,31 +503,15 @@ function isCodeBlock(context: any, nodeName: string, attributes: any) {
if (nodeName === 'code') return true;
if (attributes && attributes.style) {
- const enCodeBlock = cssValue(context, attributes.style, '-en-codeblock');
+ // Yes, this property sometimes appears as -en-codeblock, sometimes as
+ // --en-codeblock. Would be too easy to import ENEX data otherwise.
+ // https://github.com/laurent22/joplin/issues/4965
+ const enCodeBlock = cssValue(context, attributes.style, '-en-codeblock') || cssValue(context, attributes.style, '--en-codeblock');
if (enCodeBlock && enCodeBlock.toLowerCase() === 'true') return true;
}
return false;
}
-// function removeSectionParent(section:Section | string) {
-// if (typeof section === 'string') return section;
-
-// section = { ...section };
-// delete section.parent;
-
-// section.lines = section.lines.slice();
-
-// for (let i = 0; i < section.lines.length; i++) {
-// section.lines[i] = removeSectionParent(section.lines[i]);
-// }
-
-// return section;
-// }
-
-// function printSection(section:Section) {
-// console.info(JSON.stringify(removeSectionParent(section), null, 4));
-// }
-
function enexXmlToMdArray(stream: any, resources: ResourceEntity[]): Promise {
const remainingResources = resources.slice();