Add an ID to a definition list term

9 views
Skip to first unread message

Misty Stanley-Jones

unread,
Apr 8, 2016, 4:21:19 PM4/8/16
to kramdown-users
Hi,

I am trying to add an iD to a definition list term and not having any luck. Given a list like this:

### My List

Item 1

: Something about item 1

Item 2

: Something about item 2


<a href="#item_1">Link to item 1</a>
<a href="#item_2">Link to item 2</a>

I can't figure out where to put the {:#item_1} to make "Item 1"'s resulting <dt> to have an ID. I have tried a few things:

Attempt 1:
### My List

{:#item_1)
Item 1

: Something about item 1

{:#item_1)
Item 2
: Something about item 2


<a href="#item_1">Link to item 1</a>
<a href="#item_2">Link to item 2</a>

This puts the ID only on the <dl> and not on the <dt>. Therefore the second list item doesn't get an ID at all.

Attempt 2 and 2a:
### My List
{:#item_1) Item 1

: Something about item 1

Item 2 {:#item_1) 

: Something about item 2


<a href="#item_1">Link to item 1</a>
<a href="#item_2">Link to item 2</a>

This actually renders {:item_1} and {:item_2} as part of the <dt> text. Yes, the same thing happens if I have it at the beginning or the end of the line.

Attempt 3:
### My List
Item 1
{:#item_1) 

: Something about item 1

Item 2
{:#item_1) 

: Something about item 2


<a href="#item_1">Link to item 1</a>
<a href="#item_2">Link to item 2</a>

This short-circuits the list creation and renders the list items as paragraphs instead.

Attempt 4:
### My List
Item 1 

{:#item_1) Something about item 1

Item 2 

{:#item_1) Something about item 2


<a href="#item_1">Link to item 1</a>
<a href="#item_2">Link to item 2</a>

This is the closest to what I want, but links to the <dd> instead of to the <dt>.

Does anybody have any idea what secret sauce I may be missing?

Thanks,
Misty

Thomas Leitner

unread,
Apr 9, 2016, 5:14:29 AM4/9/16
to kramdow...@googlegroups.com
On 2016-04-08 13:21 -0700 Misty Stanley-Jones wrote:
> I am trying to add an iD to a definition list term and not having any
> luck. Given a list like this:

This is currently not possible with kramdown.

-- Thomas
Reply all
Reply to author
Forward
0 new messages