Extracted some duplication into formatting context and a link helper