diff --git a/CliClient/tests/html_to_md/table1.html b/CliClient/tests/html_to_md/table1.html
new file mode 100644
index 0000000000..edeb12810c
--- /dev/null
+++ b/CliClient/tests/html_to_md/table1.html
@@ -0,0 +1,12 @@
+
+
+
+ $ sudo ethtool --set-priv-flags p2p1 mlx4_rss_xor_hash_function on
+# Three empty lines follow
+
+
+ |
+
+
+
+Some text
\ No newline at end of file
diff --git a/CliClient/tests/html_to_md/table1.md b/CliClient/tests/html_to_md/table1.md
new file mode 100644
index 0000000000..84b87b4b70
--- /dev/null
+++ b/CliClient/tests/html_to_md/table1.md
@@ -0,0 +1,5 @@
+| |
+| --- |
+| $ sudo ethtool --set-priv-flags p2p1 mlx4_rss_xor_hash_function on
# Three empty lines follow
|
+
+Some text
\ No newline at end of file
diff --git a/ReactNativeClient/lib/import-enex-md-gen.js b/ReactNativeClient/lib/import-enex-md-gen.js
index a21c6ccc7d..3a0bdc3f30 100644
--- a/ReactNativeClient/lib/import-enex-md-gen.js
+++ b/ReactNativeClient/lib/import-enex-md-gen.js
@@ -377,7 +377,7 @@ function processMdArrayNewLines(md, isTable = false) {
// on various rules.
const isHeading = function(line) {
- return !!line.match(/#+\s/);
+ return !!line.match(/^#+\s/);
}
const isListItem = function(line) {
@@ -389,7 +389,7 @@ function processMdArrayNewLines(md, isTable = false) {
}
const isTableLine = function(line) {
- return line.indexOf('|') === 0;
+ return line.indexOf('| ') === 0;
}
const isPlainParagraph = function(line) {
@@ -433,6 +433,12 @@ function formatMdLayout(lines) {
} else if (!isCodeLine(line) && isCodeLine(previous)) {
newLines.push('');
+
+ } else if (isTableLine(line) && !isTableLine(previous)) {
+ newLines.push('');
+
+ } else if (!isTableLine(line) && isTableLine(previous)) {
+ newLines.push('');
// Add a new line at beginning of paragraph
} else if (isPlainParagraph(line) && previous) {