One of the big lacunae in Markdown (IMNSHO) is that there’s no way to get
id="" attributes in the generated HTML, and therefore, no way to use fragment references when linking to the containing document.
A general mechanism for adding id attributes to generated HTML elements seems Too Hard, and any mechanism for adding user-specified attributes to generated elements is going to have backward compatibility headaches. However, id attributes are most useful on headers, and it’s possible to generate id attributes algorithmically from the header text, so I’d like to propose that Markdown should do that. A reasonable algorithm might look something like
- Apply aggressive Unicode normalization (NFKC + lowercasing) to the text of the header.
- Replace all characters not in Unicode categories [L*] and [N*] (that is, that are neither letters nor numbers) with
- Compress all runs of
-characters to a single
I’m sure this can be bikeshedded, but the important thing is to get implementations consistently doing something, not the exact details.