diff --git a/docs/extensions/attr_list.md b/docs/extensions/attr_list.md index 1050676f..42c5d7cc 100644 --- a/docs/extensions/attr_list.md +++ b/docs/extensions/attr_list.md @@ -216,3 +216,31 @@ A trivial example: ```python markdown.markdown(some_text, extensions=['attr_list']) ``` + +#### Combining with Definition Lists + +You can use `attr_list` in combination with the [`def_list`](def_list.md) extension to add IDs or classes to definition terms. This is particularly useful for creating anchor links to specific items in a glossary or list. + +```python +import markdown + +text = """ +Term 1 +: Definition of term 1. + +Term 2 {: #term-2 .highlight } +: Definition of term 2. +""" + +html = markdown.markdown(text, extensions=['def_list', 'attr_list']) +print(html) + +The output will be: + +```html +