diff --git a/src/html2md.js b/src/html2md.js
index 50d4aef7..8bba0a6f 100644
--- a/src/html2md.js
+++ b/src/html2md.js
@@ -31,6 +31,7 @@ import {
TYPE_GRID_TABLE, TYPE_GT_BODY, TYPE_GT_CELL, TYPE_GT_ROW, handleTableAsGridTable,
} from './mdast-table-handler.js';
import formatPlugin from './markdownFormatPlugin.js';
+import { unspreadLists } from './unspread-lists.js';
function m(type, children, props = {}) {
return {
@@ -300,6 +301,7 @@ export async function html2md(html, opts) {
imageReferences(mdast);
sanitizeHeading(mdast);
sanitizeTextAndFormats(mdast);
+ unspreadLists(mdast);
// noinspection JSVoidFunctionReturnValueUsed
const md = unified()
diff --git a/src/unspread-lists.js b/src/unspread-lists.js
new file mode 100644
index 00000000..b03714eb
--- /dev/null
+++ b/src/unspread-lists.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2024 Adobe. All rights reserved.
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
+ * OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+import { visit, CONTINUE } from 'unist-util-visit';
+
+/**
+ * Collapse (un-spread) all lists
+ * @param {object} tree
+ */
+export function unspreadLists(tree) {
+ visit(tree, (node) => {
+ if (node.type === 'list' || node.type === 'listItem') {
+ // eslint-disable-next-line no-param-reassign
+ node.spread = false;
+ }
+ return CONTINUE;
+ });
+}
diff --git a/test/fixtures/codeblock.md b/test/fixtures/codeblock.md
index b5f6843a..29c023bb 100644
--- a/test/fixtures/codeblock.md
+++ b/test/fixtures/codeblock.md
@@ -4,15 +4,11 @@
| Procedure |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| 1. Log in to Azure with the Azure CLI. |
-| |
| 2. Query Azure for your tenant and subscription IDs. . |
-| |
| ``` |
| az account list |
| ``` |
-| |
| 3. Copy the output which is similar to the following example. In the output, identify the `tenantId` tenant ID and the `id` of the subscription. |
-| |
| ```bash |
| "cloudName": "AzureCloud", |
| "homeTenantId": , |
diff --git a/test/roundtrip/roundtrip-fixtures/nested-lists.input.html b/test/roundtrip/roundtrip-fixtures/nested-lists.input.html
new file mode 100644
index 00000000..2fb2ed6d
--- /dev/null
+++ b/test/roundtrip/roundtrip-fixtures/nested-lists.input.html
@@ -0,0 +1,27 @@
+
+
+
+
+ Nested Lists
+
+
+
+
+