type Html = object tags: seq[string] type Tag {.acyclic.} = object name: string text: string nested: seq[Tag] func parseHTML(html: string): Html = discard # Todo: revamp parsing: keep track of tags, entities, etc proc renderHTML*(html: string) = var in_angle = false in_body = false # _Why_ is it i, c and not c, i... for i, c in html: if c == '<': in_angle = true if html[i..i+4] == "': in_angle = false elif not in_angle and in_body and c in {char(32)..char(126), '\n'}: stdout.write(c) proc renderSource*(html: string) = for i, c in html: stdout.write(c)