diff --git a/src/html2md.js b/src/html2md.js
index 829240f9..58330f4c 100644
--- a/src/html2md.js
+++ b/src/html2md.js
@@ -21,6 +21,7 @@ import gfm from 'remark-gfm';
import {
imageReferences,
sanitizeTextAndFormats,
+ sanitizeHeading,
} from '@adobe/helix-markdown-support';
import { remarkMatter } from '@adobe/helix-markdown-support/matter';
import remarkGridTable from '@adobe/remark-gridtables';
@@ -263,6 +264,7 @@ export async function html2md(html, opts) {
await processImages(log, mdast, mediaHandler, url);
imageReferences(mdast);
+ sanitizeHeading(mdast);
sanitizeTextAndFormats(mdast);
// noinspection JSVoidFunctionReturnValueUsed
diff --git a/test/fixtures/breaks-in-headings.html b/test/fixtures/breaks-in-headings.html
new file mode 100644
index 00000000..0012f6e1
--- /dev/null
+++ b/test/fixtures/breaks-in-headings.html
@@ -0,0 +1,12 @@
+
+
+ Breaks in Headings
+
+
+
+
+
Break
in
Heading
+
+
+
+
diff --git a/test/fixtures/breaks-in-headings.md b/test/fixtures/breaks-in-headings.md
new file mode 100644
index 00000000..80a65b83
--- /dev/null
+++ b/test/fixtures/breaks-in-headings.md
@@ -0,0 +1,7 @@
+# Break
in
Heading
+
++----------------------------+
+| Metadata |
++=======+====================+
+| title | Breaks in Headings |
++-------+--------------------+
\ No newline at end of file
diff --git a/test/html2md.test.js b/test/html2md.test.js
index f45359c1..f3da32a1 100644
--- a/test/html2md.test.js
+++ b/test/html2md.test.js
@@ -79,6 +79,10 @@ describe('html2md Tests', () => {
it('convert a document with underling, sub-, and superscript', async () => {
await test('sub-sup-u');
});
+
+ it('convert a document with headline and soft breaks correctly', async () => {
+ await test('breaks-in-headings');
+ });
});
describe('className to block type tests', () => {