# Strip heading id
fun strip_id(text: String): String do
# strip id
var b = new FlatBuffer
for c in text do
if c == ' ' then
b.add '_'
else
if not c.is_letter and
not c.is_digit and
not allowed_id_chars.has(c) then continue
b.add c
end
end
var res = b.to_s
if res.is_empty then res = "_"
var key = res
# check for multiple id definitions
if headings.has_key(key) then
var i = 1
key = "{res}_{i}"
while headings.has_key(key) do
i += 1
key = "{res}_{i}"
end
end
return key
end
lib/markdown2/markdown_html_rendering.nit:149,2--176,4