core :: Text :: read_md_link_id
out
buffer.
# Read a markdown link text and append it to the `out` buffer.
private fun read_md_link_id(out: FlatBuffer, start: Int): Int do
var pos = start
var counter = 1
while pos < length do
var c = self[pos]
var end_reached = false
if c == '[' then
counter += 1
out.add c
else if c == ']' then
counter -= 1
if counter == 0 then
end_reached = true
else
out.add c
end
else
out.add c
end
if end_reached then break
pos += 1
end
if pos == length then return -1
return pos
end
lib/markdown/markdown.nit:2516,2--2541,4