@@ -245,13 +245,13 @@ def gcd(a, b):
245245 : Definition starts with a paragraph, followed by an unordered list:
246246
247247 - Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
248- foo bar foo bar foo bar foo bar.
249-
250- - (3) bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
251248 foo bar foo bar foo bar foo bar.
252249
253- - foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
254- bar (split) foo bar foo bar foo bar foo bar.
250+ - (3) bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
251+ foo bar foo bar foo bar foo bar.
252+
253+ - foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
254+ bar (split) foo bar foo bar foo bar foo bar.
255255 """ ,
256256)
257257
@@ -299,3 +299,43 @@ def test_definition_list_wrap_with_gfm():
299299 )
300300 print_text (output , DEF_LIST_WITH_NESTED_WRAP_EXPECTED )
301301 assert output == DEF_LIST_WITH_NESTED_WRAP_EXPECTED
302+
303+
304+ def test_definition_list_nested_indentation ():
305+ """Test that nested lists in definition bodies use 4-space increments.
306+
307+ This is a regression test for issue #63.
308+ """
309+ input_text = dedent (
310+ """\
311+ term
312+
313+ : Definition with a list:
314+
315+ - First item
316+ - Nested item
317+ - Deep nested item
318+ """ ,
319+ )
320+ expected = dedent (
321+ """\
322+ term
323+
324+ : Definition with a list:
325+
326+ - First item
327+ - Nested item
328+ - Deep nested item
329+ """ ,
330+ )
331+ output = mdformat .text (input_text , extensions = {"mkdocs" })
332+ print_text (output , expected )
333+ assert output == expected
334+
335+ # Verify the indentation levels are multiples of 4
336+ lines = output .split ('\n ' )
337+ for line in lines :
338+ if line .strip ().startswith ('-' ):
339+ spaces = len (line ) - len (line .lstrip ())
340+ # Spaces before '-' should be 4, 8, or 12 (multiples of 4)
341+ assert spaces in [4 , 8 , 12 ], f"Expected 4/8/12 spaces, got { spaces } in: { repr (line )} "
0 commit comments