#3220·mdBook

Definition list are broken with several definitions and block elements

Author: pinage404Created Sep 9, 2026Updated Sep 9, 2026
LabelsC-bug

Hello,

Problem

When adding block elements (<ul>, <blockquote>, <dl>...) in a definition (<dd>) the render is good, unless having several definitions

markdown
# Example

Single definition
  : a definition with some block elements

    > This is a blockquote

    * This is an item of unordered list
    * Another item

    Nested definition term
      : foo
      : bar

Several definitions
  : the same definition as above list with some block elements

    > This is a blockquote

    * This is an item of unordered list
    * Another item

    Nested definition term
      : foo
      : bar

  : but with another definition

Several definitions "fixed" with a `<div>`
  : <div>the same definition as above list with some block elements wrapped in a <code>&lt;div&gt;</code>

    > This is a blockquote

    * This is an item of unordered list
    * Another item

    Nested definition term
      : foo
      : bar

    </div>

  : but with another definition
Image

Steps

  1. use a definition list
  2. add block elements in the definition
  3. add another definitions

Possible Solution(s)

It is caused by this display: flex

https://github.com/rust-lang/mdBook/blob/6a75867463828eb5b0b00f78feb0224c1bbc39aa/crates/mdbook-html/front-end/css/general.css#L314

  • maybe the CSS can be changed (i think, it's preferable)
  • maybe a <div> can wrap the content of the <dd>

Notes

Also, i would recommend wrapping definitions (<dl> + <dd>) in <div>, it is easier to add custom style

xml
<dl>
	<div>
		<dt>Term 1</dt>
		<dd>Definition</dd>
	</div>
	<div>
		<dt>Term 2</dt>
		<dd>Definition 1</dd>
		<dd>Definition 2</dd>
	</div>
</dl>

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dl#wrapping_name-value_groups_in_div_elements

Version

0.5.4

And the current main branch