extract gist rendering in function, handle /? and ? cases