GitbookIO / kramed

A markdown (kramdown compatible) parser and compiler. Built for speed. (Fork of marked)
MIT License
223 stars 47 forks source link

Append identical header ids with counter #28

Open emilbayes opened 8 years ago

emilbayes commented 8 years ago

This ensures unique HTML id's in line with the HTML spec, and allows anchors to always reference the intended header.

Fixes #27

emilbayes commented 8 years ago

Not that this change will break another test that has two identical headers. It is also not finished, since the instance of Renderer persists across blobs of Markdown, and therefore the counters do not get reset. However looking at renderer.js it doesn't hold much state, and probably would be cheap to instantiate anew for each Markdown blob.