diff --git a/changelog_unreleased/markdown/19987.md b/changelog_unreleased/markdown/19987.md
new file mode 100644
index 000000000..49fcd70ea
--- /dev/null
+++ b/changelog_unreleased/markdown/19987.md
@@ -0,0 +1,25 @@
+#### Fix HTML block indentation drift in markdown list items (#19987 by @lazerg)
+
+
+```markdown
+
+1. Enable images:
+
+
+
+
+
+
+1. Enable images:
+
+
+
+
+
+
+1. Enable images:
+
+
+
+
+```
diff --git a/src/language-markdown/print/list.js b/src/language-markdown/print/list.js
index eb4c5c673..755d76769 100644
--- a/src/language-markdown/print/list.js
+++ b/src/language-markdown/print/list.js
@@ -99,7 +99,7 @@ function printListItem(path, options, print, listPrefix) {
prefix,
printChildren(path, options, print, {
processor({ node, isFirst }) {
- if (isFirst && node.type !== "list") {
+ if ((isFirst && node.type !== "list") || node.type === "html") {
return align(" ".repeat(prefix.length), print());
}
diff --git a/tests/format/markdown/list/html-indent/__snapshots__/format.test.js.snap b/tests/format/markdown/list/html-indent/__snapshots__/format.test.js.snap
new file mode 100644
index 000000000..69e9823ca
--- /dev/null
+++ b/tests/format/markdown/list/html-indent/__snapshots__/format.test.js.snap
@@ -0,0 +1,113 @@
+// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
+
+exports[`issue-19986.md - {"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+tabWidth: 4
+ printWidth: 80 (default) |
+=====================================input======================================
+1. Enable images:
+
+ \`\`\`json
+ {}
+ \`\`\`
+
+
+
+
+
+2. Continue.
+
+=====================================output=====================================
+1. Enable images:
+
+ \`\`\`json
+ {}
+ \`\`\`
+
+
+
+
+
+2. Continue.
+
+================================================================================
+`;
+
+exports[`issue-19986.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+ printWidth: 80 (default) |
+=====================================input======================================
+1. Enable images:
+
+ \`\`\`json
+ {}
+ \`\`\`
+
+
+
+
+
+2. Continue.
+
+=====================================output=====================================
+1. Enable images:
+
+ \`\`\`json
+ {}
+ \`\`\`
+
+
+
+
+
+2. Continue.
+
+================================================================================
+`;
+
+exports[`issue-19986-uneven-indent.md - {"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+tabWidth: 4
+ printWidth: 80 (default) |
+=====================================input======================================
+1. Enable images:
+
+
+
+
+
+=====================================output=====================================
+1. Enable images:
+
+
+
+
+
+
+================================================================================
+`;
+
+exports[`issue-19986-uneven-indent.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+ printWidth: 80 (default) |
+=====================================input======================================
+1. Enable images:
+
+
+
+
+
+=====================================output=====================================
+1. Enable images:
+
+
+
+
+
+
+================================================================================
+`;
diff --git a/tests/format/markdown/list/html-indent/format.test.js b/tests/format/markdown/list/html-indent/format.test.js
new file mode 100644
index 000000000..47801ffa2
--- /dev/null
+++ b/tests/format/markdown/list/html-indent/format.test.js
@@ -0,0 +1,2 @@
+runFormatTest(import.meta, ["markdown"], { tabWidth: 4 });
+runFormatTest(import.meta, ["markdown"]);
diff --git a/tests/format/markdown/list/html-indent/issue-19986-uneven-indent.md b/tests/format/markdown/list/html-indent/issue-19986-uneven-indent.md
new file mode 100644
index 000000000..a9b988e9e
--- /dev/null
+++ b/tests/format/markdown/list/html-indent/issue-19986-uneven-indent.md
@@ -0,0 +1,5 @@
+1. Enable images:
+
+
+
+
diff --git a/tests/format/markdown/list/html-indent/issue-19986.md b/tests/format/markdown/list/html-indent/issue-19986.md
new file mode 100644
index 000000000..e0872c46e
--- /dev/null
+++ b/tests/format/markdown/list/html-indent/issue-19986.md
@@ -0,0 +1,11 @@
+1. Enable images:
+
+ ```json
+ {}
+ ```
+
+
+
+
+
+2. Continue.