Skip to content

Render Markdown definition lists#13950

Merged
Turbo87 merged 1 commit into
rust-lang:mainfrom
mistaste:feature-markdown-definition-lists
Jun 15, 2026
Merged

Render Markdown definition lists#13950
Turbo87 merged 1 commit into
rust-lang:mainfrom
mistaste:feature-markdown-definition-lists

Conversation

@mistaste

Copy link
Copy Markdown
Contributor

Closes #13890.

Most forges (GitHub, GitLab, Forgejo) render Markdown definition lists:

First term
: First definition

crates.io previously ignored this syntax. This enables comrak's description_lists
extension so definition lists in crate READMEs and descriptions render as
<dl>/<dt>/<dd>:

<dl>
<dt>First term</dt>
<dd>First definition</dd>
</dl>

The <dl>/<dt>/<dd> tags are already on the ammonia sanitizer allowlist, so
no sanitizer change is needed. Added a snapshot test covering the rendering.

cargo test -p crates_io_markdown, cargo clippy -p crates_io_markdown --all-targets
and cargo fmt all pass.

Enable comrak's `description_lists` extension so that Markdown definition
lists in crate READMEs and descriptions render as `<dl>`/`<dt>`/`<dd>`,
matching GitHub, GitLab and Forgejo. The `<dl>`/`<dt>`/`<dd>` tags are
already permitted by the `ammonia` sanitizer, so no allowlist change is
needed.

Closes rust-lang#13890

@Turbo87 Turbo87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Turbo87 Turbo87 merged commit 6ca5065 into rust-lang:main Jun 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown definition lists rendering

3 participants