It appears RST is messing up or something. For reference, here the more legible
version of this code:
.. code-block:: nim
# The nim code
#? stdtmpl(subsChar = '$', metaChar = '#')
#import "../database"
#import user
#import xmltree
proc `$!`(text: string): string = escape(text)
proc renderMain*(body: string): string =
result = ""
return $"""
<!doctype html>
<html>
<head>
<title>Blog Written in Nim</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
${body}
</body>
</html>
"""
proc renderLogin*(): string =
result = ""
return $"""
<div id="login">
<span>Login</span>
<span>Please type in your username...</span>
<form action="login" method="post">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login">
</form>
</div>
"""
Run